!136 fix优酷视频URL有多余参数导致解析错误的问题

Merge pull request !136 from 他乡启程/master
This commit is contained in:
他乡启程 2017-12-12 14:04:26 +08:00 committed by Discuz!
parent 14ec6ab0ed
commit 5785043780
2 changed files with 15 additions and 14 deletions

View File

@ -4,11 +4,11 @@ if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$checkurl = array('v.qq.com/x/page/');
$checkurl = array('v.qq.com/x/page/','v.qq.com/x/cover/');
function media_qq($url, $width, $height) {
if(preg_match("/https?:\/\/v.qq.com\/x\/page\/([^\/]+)(.html|)/i", $url, $matches)) {
$vid = explode(".html", $matches[1]);
if(preg_match("/https?:\/\/v.qq.com\/x\/(page|cover)\/([^\/]+)(.html|)/i", $url, $matches)) {
$vid = explode(".html", $matches[2]);
$flv = 'https://imgcache.qq.com/tencentvideo_v1/playerv3/TPout.swf?vid='.$vid[0];
$iframe = 'https://v.qq.com/iframe/player.html?vid='.$vid[0];
}

View File

@ -9,10 +9,11 @@ $checkurl = array('v.youku.com/v_show/');
function media_youku($url, $width, $height) {
$ctx = stream_context_create(array('http' => array('timeout' => 10)));
if(preg_match("/^https?:\/\/v.youku.com\/v_show\/id_([^\/]+)(.html|)/i", $url, $matches)) {
$flv = 'https://player.youku.com/player.php/sid/'.$matches[1].'/v.swf';
$iframe = 'https://player.youku.com/embed/'.$matches[1];
$params = explode('.', $matches[1]);
$flv = 'https://player.youku.com/player.php/sid/'.$params[0].'/v.swf';
$iframe = 'https://player.youku.com/embed/'.$params[0];
if(!$width && !$height) {
$api = 'http://v.youku.com/player/getPlayList/VideoIDS/'.$matches[1];
$api = 'http://v.youku.com/player/getPlayList/VideoIDS/'.$params[0];
$str = stripslashes(file_get_contents($api, false, $ctx));
if(!empty($str) && preg_match("/\"logo\":\"(.+?)\"/i", $str, $image)) {
$url = substr($image[1], 0, strrpos($image[1], '/')+1);