|
@@ -19,34 +19,26 @@ def GetVideoInfo() -> str:
|
|
|
|
|
|
video_url = json_data_video['data']['dash']['video'][0]['baseUrl']
|
|
|
|
|
|
- title = re.findall('<title data-vue-meta="true">(.*?)</title>', html_video)
|
|
|
-
|
|
|
- title = title[0]
|
|
|
-
|
|
|
- if title:
|
|
|
- illegal_chars = fr'<|>\/:"*?'
|
|
|
- def remove_illegal_chars(title_ill):
|
|
|
- for char in illegal_chars:
|
|
|
- title_ill = title_ill.replace(char, "")
|
|
|
- return title_ill
|
|
|
- else:
|
|
|
- return None
|
|
|
-
|
|
|
- title = remove_illegal_chars(title)
|
|
|
-
|
|
|
- return (title,video_url)
|
|
|
+ return video_url
|
|
|
|
|
|
def GetAudioInfo() -> str:
|
|
|
response_audio = GetResponse_audio(url = url)
|
|
|
|
|
|
html_audio = response_audio.text
|
|
|
|
|
|
- info_audio = re.findall('<script>window.__playinfo__=(.*?)</script>', html_audio)[0]
|
|
|
+ info_audio = re.findall(r'<script>window.__playinfo__=(.*?)</script>', html_audio)[0]
|
|
|
|
|
|
json_data_audio = json.loads(info_audio)
|
|
|
|
|
|
audio_url = json_data_audio['data']['dash']['audio'][0]['baseUrl']
|
|
|
|
|
|
+ return audio_url
|
|
|
+
|
|
|
+def GetTitile():
|
|
|
+ response_audio = GetResponse_audio(url = url)
|
|
|
+
|
|
|
+ html_audio = response_audio.text
|
|
|
+
|
|
|
title = re.findall('<title data-vue-meta="true">(.*?)</title>', html_audio)
|
|
|
|
|
|
title = title[0]
|
|
@@ -61,8 +53,8 @@ def GetAudioInfo() -> str:
|
|
|
return None
|
|
|
|
|
|
title = remove_illegal_chars(title)
|
|
|
+ return title
|
|
|
|
|
|
- return (title,audio_url)
|
|
|
|
|
|
|
|
|
# # 测试代码
|