Skip to content

Commit

Permalink
🔧: Fix hybrid_crawler.py -> #525
Browse files Browse the repository at this point in the history
  • Loading branch information
Evil0ctal committed Dec 22, 2024
1 parent 72ea696 commit a8be475
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions crawlers/hybrid/hybrid_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,13 @@ async def hybrid_parsing_single_video(self, url: str, minimal: bool = False):
if url_type == 'video':
# 将信息储存在字典中/Store information in a dictionary
# wm_video = data['video']['downloadAddr']
wm_video = data['video']['download_addr']['url_list'][0]
# wm_video = data['video']['download_addr']['url_list'][0]
wm_video = (
data.get('video', {})
.get('download_addr', {})
.get('url_list', [None])[0]
)

api_data = {
'video_data':
{
Expand Down Expand Up @@ -199,7 +205,8 @@ async def hybrid_parsing_single_video(self, url: str, minimal: bool = False):
async def main(self):
# 测试混合解析单一视频接口/Test hybrid parsing single video endpoint
# url = "https://v.douyin.com/L4FJNR3/"
url = "https://www.tiktok.com/@taylorswift/video/7359655005701311786"
# url = "https://www.tiktok.com/@taylorswift/video/7359655005701311786"
# url = "https://www.tiktok.com/@flukegk83/video/7360734489271700753"
# url = "https://www.tiktok.com/@minecraft/photo/7369296852669205791"
minimal = True
result = await self.hybrid_parsing_single_video(url, minimal=minimal)
Expand Down

0 comments on commit a8be475

Please sign in to comment.