diff --git a/scraper.py b/scraper.py index 120edb4..cdd4b79 100644 --- a/scraper.py +++ b/scraper.py @@ -187,7 +187,11 @@ class Scraper: # vid vid = str(js['item_list'][0]['video']['vid']) # 无水印1080p视频链接 - wm_video_url_1080p = "https://aweme.snssdk.com/aweme/v1/play/?video_id={}&radio=1080p&line=0".format(vid) + try: + r = requests.get("https://aweme.snssdk.com/aweme/v1/play/?video_id={}&radio=1080p&line=0".format(vid), headers=headers, allow_redirects=False) + wm_video_url_1080p = r.headers['Location'] + except: + wm_video_url_1080p = "None" # 有水印视频链接 wm_video_url = str(js['item_list'][0]['video']['play_addr']['url_list'][0]) # 无水印视频链接 (在回执JSON中将关键字'playwm'替换为'play'即可获得无水印地址)