default disable googlevideo domain debugging

This commit is contained in:
James Taylor 2018-08-31 16:36:58 -07:00
parent 7cfb66b4b8
commit a9ea97ad39
2 changed files with 13 additions and 6 deletions

View File

@ -13,6 +13,13 @@ subtitles_language = "en"
enable_related_videos = True enable_related_videos = True
enable_comments = True enable_comments = True
enable_comment_avatars = True enable_comment_avatars = True
# 0 to sort by top
# 1 to sort by newest
default_comment_sorting = 0
# developer use to debug 403s
gather_googlevideo_domains = False
''' '''
exec(default_settings) exec(default_settings)
try: try:

View File

@ -304,7 +304,7 @@ def get_watch_page(query_string):
id = urllib.parse.parse_qs(query_string)['v'][0] id = urllib.parse.parse_qs(query_string)['v'][0]
downloader = YoutubeDL(params={'youtube_include_dash_manifest':False}) downloader = YoutubeDL(params={'youtube_include_dash_manifest':False})
tasks = ( tasks = (
gevent.spawn(comments.video_comments, id ), gevent.spawn(comments.video_comments, id, int(settings.default_comment_sorting) ),
gevent.spawn(extract_info, downloader, "https://www.youtube.com/watch?v=" + id, download=False) gevent.spawn(extract_info, downloader, "https://www.youtube.com/watch?v=" + id, download=False)
) )
gevent.joinall(tasks) gevent.joinall(tasks)
@ -384,11 +384,11 @@ def get_watch_page(query_string):
music_list_html += '''<td>''' + html.escape(value) + '''</td>''' music_list_html += '''<td>''' + html.escape(value) + '''</td>'''
music_list_html += '''</tr>\n''' music_list_html += '''</tr>\n'''
music_list_html += '''</table>\n''' music_list_html += '''</table>\n'''
if settings.gather_googlevideo_domains:
with open('data/googlevideo-domains.txt', 'a+', encoding='utf-8') as f: with open('data/googlevideo-domains.txt', 'a+', encoding='utf-8') as f:
url = info['formats'][0]['url'] url = info['formats'][0]['url']
subdomain = url[0:url.find(".googlevideo.com")] subdomain = url[0:url.find(".googlevideo.com")]
f.write(subdomain + "\n") f.write(subdomain + "\n")
download_options = '' download_options = ''
for format in info['formats']: for format in info['formats']: