This commit is contained in:
Default
2025-05-03 23:54:37 +08:00
parent 0cd2fdcdfe
commit 577a4dab02
26 changed files with 1320 additions and 132 deletions

View File

@@ -74,18 +74,23 @@ class Scheduler
*/
public function crawlFull()
{
// $arrVSourceId = [['v_source_id' => 14256]];
// $arrVSourceId = [['v_source_id' => 66471]];
// $arrTask = [
// 'callback' => [static::class, 'fetchVideo'],
// 'data' => $arrVSourceId,
// ];
// $this->QueueManage->set($arrTask);
// $this->fetchVideo($arrVSourceId);
// return;
$Site = $this->getSite();
$arrAllCategory = $Site->getCategory();
// print_r($arrAllCategory);
// return;
$intLimit = 5;
$arrTask = [
@@ -184,7 +189,7 @@ class Scheduler
$arrPic[] = $arrPicItem;
}
}
if ($arrPic) {
$Site->downRemoteImgToLocal($arrPic);
}

View File

@@ -146,7 +146,7 @@ class Site
*/
public function getCategory(): array
{
$strUri = '/inc/api_mac10.php?ac=list&t=1&page=1';
$strUri = '/inc/api_mac10.php?ac=list&t=19&page=11';
$Response = $this->getClient()->get($strUri);
$strContent = $Response->getBody()->getContents();
@@ -154,6 +154,17 @@ class Site
$arrContent = json_decode($strContent, true);
$arrFilter = $arrContent['class'];
// print_r($arrContent);
// $arrA = [];
// foreach ($arrFilter as $b) {
// $arrA[$b['type_id']] = [
// 'name' => $b['type_name'],
// 'pinyin' => zhToPinYin($b['type_name']),
// ];
// }
// print_r($arrA);
$arrCategory = [];
foreach ($arrFilter as $intKey => $arrItem) {

View File

@@ -0,0 +1,214 @@
<?php
declare(strict_types=1);
namespace app\task\crawler\youzhi\page;
class VideoCategory
{
static $arrCategory = [
1 => [
'name' => '电影',
'pinyin' => 'dian-ying',
],
2 => [
'name' => '连续剧',
'pinyin' => 'lian-xu-ju',
],
3 => [
'name' => '综艺',
'pinyin' => 'zong-yi',
],
4 => [
'name' => '动漫',
'pinyin' => 'dong-man',
],
5 => [
'name' => '动作片',
'pinyin' => 'dong-zuo-pian',
],
6 => [
'name' => '喜剧片',
'pinyin' => 'xi-ju-pian',
],
7 => [
'name' => '爱情片',
'pinyin' => 'ai-qing-pian',
],
8 => [
'name' => '科幻片',
'pinyin' => 'ke-huan-pian',
],
9 => [
'name' => '恐怖片',
'pinyin' => 'kong-bu-pian',
],
10 => [
'name' => '剧情片',
'pinyin' => 'ju-qing-pian',
],
11 => [
'name' => '战争片',
'pinyin' => 'zhan-zheng-pian',
],
12 => [
'name' => '国产剧',
'pinyin' => 'guo-chan-ju',
],
13 => [
'name' => '台湾剧',
'pinyin' => 'tai-wan-ju',
],
14 => [
'name' => '韩国剧',
'pinyin' => 'han-guo-ju',
],
15 => [
'name' => '欧美剧',
'pinyin' => 'ou-mei-ju',
],
16 => [
'name' => '香港剧',
'pinyin' => 'xiang-gang-ju',
],
17 => [
'name' => '泰国剧',
'pinyin' => 'tai-guo-ju',
],
18 => [
'name' => '日本剧',
'pinyin' => 'ri-ben-ju',
],
19 => [
'name' => '福利',
'pinyin' => 'fu-li',
],
20 => [
'name' => '记录片',
'pinyin' => 'ji-lu-pian',
],
41 => [
'name' => '动画片',
'pinyin' => 'dong-hua-pian',
],
54 => [
'name' => '海外剧',
'pinyin' => 'hai-wai-ju',
],
61 => [
'name' => '?理片',
'pinyin' => 'lun-li-pian',
],
62 => [
'name' => '大陆综艺',
'pinyin' => 'da-lu-zong-yi',
],
63 => [
'name' => '港台综艺',
'pinyin' => 'gang-tai-zong-yi',
],
64 => [
'name' => '日韩综艺',
'pinyin' => 'ri-han-zong-yi',
],
65 => [
'name' => '欧美综艺',
'pinyin' => 'ou-mei-zong-yi',
],
66 => [
'name' => '国产动漫',
'pinyin' => 'guo-chan-dong-man',
],
67 => [
'name' => '日韩动漫',
'pinyin' => 'ri-han-dong-man',
],
68 => [
'name' => '欧美动漫',
'pinyin' => 'ou-mei-dong-man',
],
69 => [
'name' => '港台动漫',
'pinyin' => 'gang-tai-dong-man',
],
70 => [
'name' => '海外动漫',
'pinyin' => 'hai-wai-dong-man',
],
78 => [
'name' => '搞笑',
'pinyin' => 'gao-xiao',
],
79 => [
'name' => '音乐',
'pinyin' => 'yin-le',
],
80 => [
'name' => '影视',
'pinyin' => 'ying-shi',
],
81 => [
'name' => '汽车',
'pinyin' => 'qi-che',
],
83 => [
'name' => '短剧大全',
'pinyin' => 'duan-ju-da-quan',
],
92 => [
'name' => '预告片',
'pinyin' => 'yu-gao-pian',
],
93 => [
'name' => '预告片',
'pinyin' => 'yu-gao-pian',
],
94 => [
'name' => '体育',
'pinyin' => 'ti-yu',
],
];
static public $arrParent = [
1 => 1,
5 => 1,
6 => 1,
7 => 1,
8 => 1,
9 => 1,
10 => 1,
11 => 1,
20 => 1,
41 => 1,
61 => 1,
92 => 1,
2 => 2,
12 => 2,
13 => 2,
14 => 2,
15 => 2,
16 => 2,
17 => 2,
18 => 2,
54 => 2,
93 => 2,
3 => 3,
62 => 3,
63 => 3,
64 => 3,
65 => 3,
4 => 4,
66 => 4,
67 => 4,
68 => 4,
69 => 4,
70 => 4,
19 => 19,
83 => 83,
94 => 94,
];
}

View File

@@ -69,6 +69,7 @@ class VideoInfoPage extends BasePage
$arrVideo = json_decode($this->getContent(), true);
$arrVideo = $arrVideo['list'][0];
// print_r($arrVideo);
$strPlayUrl = $arrVideo['vod_play_url'];
@@ -84,19 +85,43 @@ class VideoInfoPage extends BasePage
];
}
$arrVideo['type_id_1'] = VideoCategory::$arrParent[$arrVideo['type_id']];
$arrVideo['vod_actor'] = trim($arrVideo['vod_actor']);
$arrVideo['vod_director'] = trim($arrVideo['vod_director']);
$arrVideo['vod_class'] = trim($arrVideo['vod_class']);
$arrVideo['vod_lang'] = trim($arrVideo['vod_lang']);
$arrVideo['vod_area'] = trim($arrVideo['vod_area']);
$arrVideo['vod_play_url'][$this->getsite()->getSiteCode()] = $arrPlayUrl;
$arrVideo['vod_actor'] = $arrVideo['vod_actor'] === '' ? [] : explode(',', $arrVideo['vod_actor']);
$arrVideo['vod_director'] = $arrVideo['vod_director'] === '' ? [] : explode(',', $arrVideo['vod_director']);
$arrVideo['vod_class'] = $arrVideo['vod_class'] === '' ? [] : explode(',', $arrVideo['vod_class']);
$arrVideo['vod_lang'] = $arrVideo['vod_lang'] === '' ? [] : explode(',', $arrVideo['vod_lang']);
$arrVideo['vod_area'] = $arrVideo['vod_area'] === '' ? [] : explode(',', $arrVideo['vod_area']);
$arrVideo['vod_lang_en'] = $arrVideo['vod_area_en'] = [];
foreach ($arrVideo['vod_lang'] as $strVal) {
$arrVideo['vod_lang_en'][] = zhToPinYin($strVal);
}
foreach ($arrVideo['vod_area'] as $strVal) {
$arrVideo['vod_area_en'][] = zhToPinYin($strVal);
}
$arrVideo['vod_content'] = strip_tags($arrVideo['vod_content']);
$arrVideo['vod_content'] = trim($arrVideo['vod_content']);
$arrVideo['vod_content'] = mb_rtrim($arrVideo['vod_content'], '\ ');
$arrVideo['vod_content'] = ensureUtf8($arrVideo['vod_content']);
$arrVideo['v_category'] = VideoCategory::$arrCategory[$arrVideo['type_id']]['name'];
$arrVideo['v_category_en'] = VideoCategory::$arrCategory[$arrVideo['type_id']]['pinyin'];
$arrVideo['v_parent_category'] = VideoCategory::$arrCategory[$arrVideo['type_id_1']]['name'];
$arrVideo['v_parent_category_en'] = VideoCategory::$arrCategory[$arrVideo['type_id_1']]['pinyin'];
foreach ($arrVideo as $strKey => $mixedVal) {
$strKey = str_replace('vod', 'v', $strKey);
@@ -165,15 +190,19 @@ class VideoInfoPage extends BasePage
'v_id' => CountersModel::getInstance()->getNextSequence('video'),
'v_name' => $arrPageVideo['v_name'],
'v_name_en' => zhToPinYin($arrPageVideo['v_name']),
'v_parent_category' => $arrPageVideo['v_parent_category'],
'v_parent_category_en' => $arrPageVideo['v_parent_category_en'],
'v_category' => $arrPageVideo['v_category'],
'v_category_en' => zhToPinYin($arrPageVideo['v_category']),
'v_category_en' => $arrPageVideo['v_category_en'],
'v_actor' => $arrPageVideo['v_actor'],
'v_director' => $arrPageVideo['v_director'],
'v_class' => $arrPageVideo['v_class'],
'v_letter' => $arrPageVideo['v_letter'],
'v_pic' => '',
'v_lang' => $arrPageVideo['v_lang'],
'v_lang_en' => $arrPageVideo['v_lang_en'],
'v_area' => $arrPageVideo['v_area'],
'v_area_en' => $arrPageVideo['v_area_en'],
'v_year' => $arrPageVideo['v_year'],
'v_remarks' => $arrPageVideo['v_remarks'],
'v_isend' => $arrPageVideo['v_isend'],