<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WordPress 插件 _ 扒房网</title>
	<atom:link href="https://www.gxjlyf.com/tag/wordpress-%e6%8f%92%e4%bb%b6/feed" rel="self" type="application/rss+xml" />
	<link>https://www.gxjlyf.com</link>
	<description>手机系统教程_手机软件教程_手机app使用教程_电脑软件教程_电脑系统教程</description>
	<lastBuildDate>Tue, 09 Aug 2022 02:49:59 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>【WordPress 插件】Begin 视频播放插件 Smartideo 支持 B 站 BV 号。</title>
		<link>https://www.gxjlyf.com/610553.html</link>
		
		<dc:creator><![CDATA[bafang18]]></dc:creator>
		<pubDate>Tue, 09 Aug 2022 02:49:59 +0000</pubDate>
				<category><![CDATA[其他教程]]></category>
		<category><![CDATA[Begin视频播放插件Smartideo支持B站BV号]]></category>
		<category><![CDATA[B站]]></category>
		<category><![CDATA[WordPress 插件]]></category>
		<guid isPermaLink="false">https://www.chuwenyu.com/610553.html</guid>

					<description><![CDATA[相信很多朋友都遇到过以下问题，就是【WordPress 插件】Begin 视频播放插件 Smartideo 支 ...]]></description>
										<content:encoded><![CDATA[<p>相信很多朋友都遇到过以下问题，就是【WordPress 插件】Begin 视频播放插件 Smartideo 支持 B 站 BV 号。。针对这个问题，今天小编就搜集了网上的相关信息，给大家做个【WordPress 插件】Begin 视频播放插件 Smartideo 支持 B 站 BV 号。的解答。希望看完这个教程之后能够解决大家【WordPress 插件】Begin 视频播放插件 Smartideo 支持 B 站 BV 号。的相关问题。</p>
<p>    B站（bilibili）近期调整视频链接 ID 为 BV 开头，B 站说是为了保护稿件信息安全，容纳更多投稿，维护 UP 主的权益。但升级后的链接造成 WordPres 视频播放插件Smartideo 中的正则无法获取由数字和大小写字母组成的字符串，原来直接复制粘贴视频地址到文章中调用视频的方法失效，用户已在插件作者网站反映，作者并没有回应。</p>
<h2>操作指南</h2>
<p>打开Smartideo 插件 smartideo.php 文件，在大约 87 行，Begin 主题 inc 目录下大约 45 行</p>
<pre class="language-markup"><code>array($this, \'smartideo_embed_handler_bilibili\') );</code></pre>
<p>下面添加</p>
<pre class="language-markup"><code>wp_embed_register_handler( \'smartvideo_bilibili_bv\',
	\'#https?://www\\.bilibili\\.com/video/BV(?:(?[a-z0-9_=\\-]+)/(?:index_|\\#page=)(?[a-z0-9_=\\-]+)|(?[a-z0-9_=\\-]+))#i\',
	array($this, \'smartvideo_embed_handler_bilibili_bv\') );</code></pre>
<p>在大约 195 行，Begin 主题 inc 目录下大约 106 行</p>
<pre class="language-markup"><code>return apply_filters( \'embed_bilibili\', $embed, $matches, $attr, $url, $rawattr );
}</code></pre>
<p>下面添加</p>
<pre class="language-markup"><code>public function smartvideo_embed_handler_bilibili_bv( $matches, $attr, $url, $rawattr ) {
	$matches[\'video_id\'] = ($matches[\'video_id1\'] == \'\') ? $matches[\'video_id\'] : $matches[\'video_id1\'];
	$page = ($matches[\'video_id2\'] &gt; 1) ? $matches[\'video_id2\'] : 1;
	$cid = \'\';
	$embed = $this-&gt;get_iframe(\"//player.bilibili.com/player.html?bvid={$matches[\'video_id\']}&amp;cid={$cid}&amp;page={$page}\", $url);
	return apply_filters( \'embed_bilibili\', $embed, $matches, $attr, $url, $rawattr );
}</code></pre>
<p>之后直接在文章中添加 B 站视频地址</p>
<pre class="language-markup"><code>https://www.bilibili.com/video/BV1WW411b7NQ</code></pre>
<p>同时兼容原来的 av 地址修改方法</p>
<pre class="language-markup"><code>https://www.bilibili.com/video/av17792443</code></pre>
<p>找到下面代码</p>
<pre class="language-markup"><code>public function smartideo_embed_handler_bilibili( $matches, $attr, $url, $rawattr ) {
    $matches[\'video_id\'] = ($matches[\'video_id1\'] == \'\') ? $matches[\'video_id\'] : $matches[\'video_id1\'];
    $page = ($matches[\'video_id2\'] &gt; 1) ? $matches[\'video_id2\'] : 1;
    $cid = \'\';
    /*
    try{
        $request = new WP_Http();
        $url = \"https://api.bilibili.com/view?type=jsonp&amp;appkey=8e9fc618fbd41e28&amp;id=\" . $matches[\'video_id\'];
        $data = (array)$request-&gt;request($url, array(\'timeout\' =&gt; 3));
        $json = json_decode($data[\'body\'], true);
        $cid = $json[\'cid\'];
 
    }catch(Exception $e){}
    */
    if(wp_is_mobile() || $this-&gt;bilibili_pc_player == 1){
        $embed = $this-&gt;get_iframe(\"//player.bilibili.com/player.html?aid={$matches[\'video_id\']}&amp;cid={$cid}&amp;page={$page}\", $url);
    }else{
        $embed = $this-&gt;get_link($url);
    }
    return apply_filters( \'embed_bilibili\', $embed, $matches, $attr, $url, $rawattr );
}</code></pre>
<p>直接修改为</p>
<pre class="language-markup"><code>public function smartideo_embed_handler_bilibili( $matches, $attr, $url, $rawattr ) {
    $matches[\'video_id\'] = ($matches[\'video_id1\'] == \'\') ? $matches[\'video_id\'] : $matches[\'video_id1\'];
    $page = ($matches[\'video_id2\'] &gt; 1) ? $matches[\'video_id2\'] : 1;
    $cid = \'\';
        $embed = $this-&gt;get_iframe(\"//player.bilibili.com/player.html?aid={$matches[\'video_id\']}&amp;cid={$cid}&amp;page={$page}\", $url);
    return apply_filters( \'embed_bilibili\', $embed, $matches, $attr, $url, $rawattr );
}</code></pre>
<p>修改完成后同时兼容 av 和 BV 号。</p>

<p><img src="https://www.gxjlyf.com/postviews/610553.png" /></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
