12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace Content\V1;
- use Dever;
- class Video
- {
- # 从腾讯视频中解析mp4
- public function show_api($link)
- {
- $link = $this->mp4_api($link);
- $html = '<video controls="controls" width="500" src="'.$link.'">您的浏览器不支持视频播放</video>';
- return $html;
- }
- # 从腾讯视频中解析mp4
- public function html_api($link)
- {
- $url = Dever::url('content/v1/video.show?link=' . $link);
- $html = '<a href="#dever_modal" data-toggle="modal" onclick="$.get(\''.$url.'\', function(t)
- {
- $(\'#dever_modal_body\').html(t);
- })">点此播放</a><div style="display:none;">测试</div>';
- return $html;
- }
- # 从腾讯视频中解析mp4
- public function mp4_api($link)
- {
- if (!$link) {
- $link = 'https://v.qq.com/x/page/j0515xuxz37.html';
- }
- $temp = explode('/page/', $link);
- if (!isset($temp[1])) {
- return $link;
- }
- $temp = explode('.html', $temp[1]);
- $key = $temp[0];
- //$key = str_replace(array('https://v.qq.com/x/page/', '.html'), '', $link);
- $api = 'http://vv.video.qq.com/getinfo?vids='.$key.'&platform=101001&charge=0&otype=json';
- $data = Dever::curl($api);
- $data = json_decode(str_replace(array('QZOutputJson=', ';'), '', $data), true);
- //print_r($data);die;
- $data = $data['vl']['vi'][0];
- $urls = $data['ul']['ui'];
- foreach ($urls as $k => $v) {
- if (strstr($v['url'], 'vhot2.qqvideo.tc.qq.com')) {
- $url = $v['url'];
- }
- }
- if (empty($url)) {
- return $this->mp4_api($link);
- }
- $link = $url . $data['fn'] . '?vkey=' . $data['fvkey'];
- return $link;
- }
- //docker run opencoconut/ffmpeg -i http://125.39.7.23/vhot2.qqvideo.tc.qq.com/ABeZbme1SX8-pYwYN_hPTYHdjJsGJiLeTu6P2YfrUsto/j0515xuxz37.m701.mp4?vkey=3EA0D99319B7D7F439F387E804AE9C87C631D0AA8EEE639266754BF3CE14AD55F79CD0239AF29518DBAF415259976CE4767E1615F80CA41B1B12F67067E8A480A95EFD4A6B06767092DFA7252AE16CEE6AC09EBEE4525F423B840B128A7F6522902C1FA8BFC48D0D -f webm -c:v libvpx -c:a libvorbis - > test.webm
- }
|