From 05a41e285eee0795112c936010baac52fd0f27ce Mon Sep 17 00:00:00 2001 From: Evil0ctal Date: Mon, 16 May 2022 20:16:14 -0700 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=E5=A2=9E=E5=8A=A0=E4=BA=86=E6=8A=96?= =?UTF-8?q?=E9=9F=B31080p=E6=97=A0=E6=B0=B4=E5=8D=B0=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scraper.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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'即可获得无水印地址)