Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ijianbo
rest Api To Miniprogram
提交
af401df0
rest Api To Miniprogram
项目概览
ijianbo
/
rest Api To Miniprogram
通知
22
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
rest Api To Miniprogram
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
af401df0
编写于
8月 06, 2020
作者:
J
jianbo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化腾讯视频解析
上级
ab2cf8b5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
40 addition
and
15 deletion
+40
-15
includes/ram-util.php
includes/ram-util.php
+40
-15
未找到文件。
includes/ram-util.php
浏览文件 @
af401df0
...
...
@@ -521,33 +521,58 @@ function getUserLevel($userId)
}
// function get_post_qq_video($content)
// {
// $vcontent ='';
// preg_match('/https\:\/\/v.qq.com\/x\/(\S*)\/(\S*)\.html/',$content,$matches);
// if($matches)
// {
// $vids=$matches[2];
// //$url='http://vv.video.qq.com/getinfo?vid='.$vids.'&defaultfmt=auto&otype=json&platform=1&defn=fhd&charge=0';
// // defaultfmt: 1080P-fhd,超清-shd,高清-hd,标清-sd
// $url='http://vv.video.qq.com/getinfo?vid='.$vids.'&defaultfmt=auto&otype=json&platform=11001&defn=fhd&charge=0';
// //$res = file_get_contents($url);
// $res = https_request($url);
// if($res)
// {
// $str = substr($res,13,-1);
// $newStr =json_decode($str,true);
// //$videoUrl= $newStr['vl']['vi'][0]['ul']['ui'][2]['url'].$newStr['vl']['vi'][0]['fn'].'?vkey='.$newStr['vl']['vi'][0]['fvkey'];
// $videoUrl= $newStr['vl']['vi'][0]['ul']['ui'][0]['url'].$newStr['vl']['vi'][0]['fn'].'?vkey='.$newStr['vl']['vi'][0]['fvkey'];
// $vcontent = preg_replace('~<video (.*?)></video>~s','<video src="'.$videoUrl.'" controls="controls" width="100%"></video>',$content);
// }
// }
// return $vcontent;
// }
function
get_post_qq_video
(
$content
)
{
$vcontent
=
''
;
preg_match
(
'/https\:\/\/v.qq.com\/x\/(\S*)\/(\S*)\.html/'
,
$content
,
$matches
);
if
(
$matches
)
{
$vids
=
$matches
[
2
];
//$url='http://vv.video.qq.com/getinfo?vid='.$vids.'&defaultfmt=auto&otype=json&platform=1&defn=fhd&charge=0';
// defaultfmt: 1080P-fhd,超清-shd,高清-hd,标清-sd
$url
=
'http://vv.video.qq.com/getinfo?vid='
.
$vids
.
'&defaultfmt=auto&otype=json&platform=11001&defn=fhd&charge=0'
;
//$res = file_get_contents($url);
$res
=
https_request
(
$url
);
if
(
$res
)
{
$str
=
substr
(
$res
,
13
,
-
1
);
$newStr
=
json_decode
(
$str
,
true
);
//$videoUrl= $newStr['vl']['vi'][0]['ul']['ui'][2]['url'].$newStr['vl']['vi'][0]['fn'].'?vkey='.$newStr['vl']['vi'][0]['fvkey'];
$videoUrl
=
$newStr
[
'vl'
][
'vi'
][
0
][
'ul'
][
'ui'
][
0
][
'url'
]
.
$newStr
[
'vl'
][
'vi'
][
0
][
'fn'
]
.
'?vkey='
.
$newStr
[
'vl'
][
'vi'
][
0
][
'fvkey'
];
$vcontent
=
preg_replace
(
'~<video (.*?)></video>~s'
,
'<video src="'
.
$videoUrl
.
'" controls="controls" width="100%"></video>'
,
$content
);
}
$vids
=
$matches
[
2
];
$videoUrl
=
get_qq_video_url
(
$vids
);
$vcontent
=
preg_replace
(
'~<video (.*?)></video>~s'
,
'<video src="'
.
$videoUrl
.
'" poster="https://puui.qpic.cn/qqvideo_ori/0/'
.
$vids
.
'_496_280/0" controls="controls" width="100%"></video>'
,
$content
);
}
return
$vcontent
;
}
function
get_qq_video_url
(
$vid
)
{
$url
=
'https://vv.video.qq.com/getinfo?vids='
.
$vid
.
'&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'
];
return
$vurl
;
}
function
get_post_content_audio
(
$post_content
){
if
(
!
$post_content
){
$the_post
=
get_post
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录