From af401df0fe33cecc402a6cc7fef273c484c1f278 Mon Sep 17 00:00:00 2001
From: jianbo <20397795@qq.com>
Date: Thu, 6 Aug 2020 21:56:24 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=85=BE=E8=AE=AF=E8=A7=86?=
=?UTF-8?q?=E9=A2=91=E8=A7=A3=E6=9E=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
includes/ram-util.php | 55 +++++++++++++++++++++++++++++++------------
1 file changed, 40 insertions(+), 15 deletions(-)
diff --git a/includes/ram-util.php b/includes/ram-util.php
index 62822e1..5eec0da 100644
--- a/includes/ram-util.php
+++ b/includes/ram-util.php
@@ -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('~~s','',$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('~~s','',$content);
-
- }
+ $vids=$matches[2];
+ $videoUrl= get_qq_video_url($vids);
+ $vcontent = preg_replace('~~s','',$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();
--
GitLab