|
@@ -30,7 +30,7 @@ def insert_data_into_feishu_sheet(platform: str, data_list: list[list[str]]) ->
|
|
match platform:
|
|
match platform:
|
|
case "toutiao":
|
|
case "toutiao":
|
|
sheet_id = toutiao_sheet_id
|
|
sheet_id = toutiao_sheet_id
|
|
- case "channels":
|
|
|
|
|
|
+ case "sph":
|
|
sheet_id = channels_sheet_id
|
|
sheet_id = channels_sheet_id
|
|
case 'hksp':
|
|
case 'hksp':
|
|
sheet_id = haokan_sheet_id
|
|
sheet_id = haokan_sheet_id
|
|
@@ -47,7 +47,7 @@ def insert_data_into_feishu_sheet(platform: str, data_list: list[list[str]]) ->
|
|
sheet_token=document_token,
|
|
sheet_token=document_token,
|
|
sheet_id=sheet_id,
|
|
sheet_id=sheet_id,
|
|
values=video_array,
|
|
values=video_array,
|
|
- ranges="A2:I{}".format(2 + len(video_array)),
|
|
|
|
|
|
+ ranges="A2:J{}".format(2 + len(video_array)),
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
@@ -56,13 +56,14 @@ if __name__ == "__main__":
|
|
channels_account_crawler = ChannelsAccountCrawler()
|
|
channels_account_crawler = ChannelsAccountCrawler()
|
|
channels_account_crawler.deal()
|
|
channels_account_crawler.deal()
|
|
|
|
|
|
- # insert data into toutiao sheet
|
|
|
|
- video_list = channels_account_crawler.get_video_list_with_score(platform="channels")
|
|
|
|
- insert_data_into_feishu_sheet(platform="toutiao", data_list=video_list)
|
|
|
|
- video_id_list = [i[0] for i in video_list]
|
|
|
|
- channels_account_crawler.update_video_status(
|
|
|
|
- video_id_tuple=tuple(video_id_list), ori_status=0, new_status=1
|
|
|
|
- )
|
|
|
|
|
|
+ # insert data into sph sheet
|
|
|
|
+ video_list = channels_account_crawler.get_video_list_with_score(platform="sph")
|
|
|
|
+ insert_data_into_feishu_sheet(platform="sph", data_list=video_list)
|
|
|
|
+ channel_video_id_list = [i[0] for i in video_list]
|
|
|
|
+ if channel_video_id_list:
|
|
|
|
+ channels_account_crawler.update_video_status(
|
|
|
|
+ video_id_tuple=tuple(channel_video_id_list), ori_status=0, new_status=1
|
|
|
|
+ )
|
|
|
|
|
|
# crawler toutiao
|
|
# crawler toutiao
|
|
toutiao_account_crawler = ToutiaoAccountCrawler()
|
|
toutiao_account_crawler = ToutiaoAccountCrawler()
|
|
@@ -71,20 +72,22 @@ if __name__ == "__main__":
|
|
# insert data into toutiao sheet
|
|
# insert data into toutiao sheet
|
|
video_list = toutiao_account_crawler.get_video_list_with_score(platform="toutiao")
|
|
video_list = toutiao_account_crawler.get_video_list_with_score(platform="toutiao")
|
|
insert_data_into_feishu_sheet(platform="toutiao", data_list=video_list)
|
|
insert_data_into_feishu_sheet(platform="toutiao", data_list=video_list)
|
|
- video_id_list = [i[0] for i in video_list]
|
|
|
|
- toutiao_account_crawler.update_video_status(
|
|
|
|
- video_id_tuple=tuple(video_id_list), ori_status=0, new_status=1
|
|
|
|
- )
|
|
|
|
|
|
+ toutiao_video_id_list = [i[0] for i in video_list]
|
|
|
|
+ if toutiao_video_id_list:
|
|
|
|
+ toutiao_account_crawler.update_video_status(
|
|
|
|
+ video_id_tuple=tuple(toutiao_video_id_list), ori_status=0, new_status=1
|
|
|
|
+ )
|
|
|
|
|
|
# crawler haokanshipin
|
|
# crawler haokanshipin
|
|
haokan_account_crawler = HaoKanAccountCrawler()
|
|
haokan_account_crawler = HaoKanAccountCrawler()
|
|
haokan_account_crawler.deal()
|
|
haokan_account_crawler.deal()
|
|
video_list = haokan_account_crawler.get_video_list_with_score(platform="hksp")
|
|
video_list = haokan_account_crawler.get_video_list_with_score(platform="hksp")
|
|
insert_data_into_feishu_sheet(platform="hksp", data_list=video_list)
|
|
insert_data_into_feishu_sheet(platform="hksp", data_list=video_list)
|
|
- video_id_list = [i[0] for i in video_list]
|
|
|
|
- haokan_account_crawler.update_video_status(
|
|
|
|
- video_id_tuple=tuple(video_id_list), ori_status=0, new_status=1
|
|
|
|
- )
|
|
|
|
|
|
+ haokan_video_id_list = [i[0] for i in video_list]
|
|
|
|
+ if haokan_video_id_list:
|
|
|
|
+ haokan_account_crawler.update_video_status(
|
|
|
|
+ video_id_tuple=tuple(haokan_video_id_list), ori_status=0, new_status=1
|
|
|
|
+ )
|
|
|
|
|
|
|
|
|
|
|
|
|