src/AppBundle/Component/MediaParser/ItemParser/QQVideoItemParser.php
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace AppBundle\Component\MediaParser\ItemParser;
use AppBundle\Component\MediaParser\ParserException;
class QQVideoItemParser extends AbstractItemParser
{
private $patterns = array(
'p1' => '/^http\:\/\/v\.qq\.com\/cover\//s',
'p2' => '/^http\:\/\/v\.qq\.com\/boke\/page\//s',
'p3' => '/^http\:\/\/v\.qq\.com\/page\//s',
'p4' => '/^http\:\/\/v\.qq\.com\/x\/page\//s',
'p5' => '/^http\:\/\/v\.qq\.com\/x\/cover\//s',
'p6' => '/^https\:\/\/v\.qq\.com\/cover\//s',
'p7' => '/^https\:\/\/v\.qq\.com\/boke\/page\//s',
'p8' => '/^https\:\/\/v\.qq\.com\/page\//s',
'p9' => '/^https\:\/\/v\.qq\.com\/x\/page\//s',
'p10' => '/^https\:\/\/v\.qq\.com\/x\/cover\//s',
);
protected function parseForWebUrl($item, $url)
{
$matched = preg_match('/vid=(\w+)/s', $url, $matches);
$response = array();
if (!empty($matched)) {
$vid = $matches[1];
} else {
$response = $this->fetchUrl($url);
if (200 != $response['code']) {
throw ParserException::PARSED_FAILED_QQ();
}
$matched = preg_match('/VIDEO_INFO.*?[\"]?vid[\"]?\s*:\s*"(\w+?)"/s', $response['content'], $matches);
if (empty($matched)) {
throw ParserException::PARSED_FAILED_QQ();
}
$vid = $matches[1];
}
$matched = $this->getUrlMatched($url);
if ($matched) {
$responseInfo = $response ? $response : array();
$videoUrl = 'http://sns.video.qq.com/tvideo/fcgi-bin/video?otype=json&vid='.$vid;
$response = $this->fetchUrl($videoUrl);
if (200 != $response['code']) {
throw ParserException::PARSED_FAILED_QQ();
}
$matched = preg_match('/{.*}/s', $response['content'], $matches);
if (empty($matched)) {
throw ParserException::PARSED_FAILED_QQ();
}
$video = json_decode($matches[0], true) ?: array();
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。