//【高修改】
//【高修改】添加到主题的functions.php下,支持腾讯视频调用2022-09-08 使用时,直接 使用标签调用。调用标签:【hsx-video vids=视频ID】用时,把两边的中括号换成英文的 [ ] 。
function v_qq_video($atts, $content=null) {
extract(shortcode_atts(array("vids" => ''), $atts));
$url = 'https://vv.video.qq.com/getinfo?vids='. $vids.'&platform=101001&charge=0&otype=json';
$json = file_get_contents($url);
preg_match('/^QZOutputJson=(.*?);$/',$json,$json2);
$tempStr = json_decode($json2[1],true);
$vurl = 'https://ugcws.video.gtimg.com/'.$tempStr['vl']['vi'][0]['fn']."?vkey=".$tempStr['vl']['vi'][0]['fvkey'];
$video = '<video style="width: 100%;" src="'.$vurl.'" poster="https://puui.qpic.cn/qqvideo_ori/0/'.$vids.'_496_280/0" controls="controls" width="300" height="150"></video>'; return $video;
}
add_shortcode('hsx-video', 'v_qq_video');
调用标签:【hsx-video vids=视频ID】用时,把两边的中括号【】换成英文的 [ ] 。
替换原代码中的【https://ugcws.video.gtimg.com/】为【https://ugcdx.qq.com/】 现在又可以用了。继续改回来。
=============================================
以下是演示视频
=============================================
代码如下:
function v_qq_video($atts, $content=null) {
extract(shortcode_atts(array("vids" => ''), $atts));
$url = 'https://vv.video.qq.com/getinfo?vids='.$vids.'&platform=101001&charge=0&otype=json';
$json = file_get_contents($url);
preg_match('/^QZOutputJson=(.*?);$/',$json,$json2);
$tempStr = json_decode($json2[1],true);
$vurl = 'https://ugcws.video.gtimg.com/'.$tempStr['vl']['vi'][0]['fn']."?vkey=".$tempStr['vl']['vi'][0]['fvkey'];
$video = '<video x5-video-player-type="h5" x5-video-player-fullscreen="true" x5-video-orientation="portrait" style="width: 100%;" controls src="'.$vurl.'" poster="https://puui.qpic.cn/qqvideo_ori/0/'.$vids.'_496_280/0"></video>';
return $video;
}
add_shortcode('qq-video', 'v_qq_video');