1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-25 11:41:52 +00:00

Minor improvements and changes

This commit is contained in:
Ricardo Garcia 2008-07-22 10:14:13 +02:00 committed by Ricardo Garcia
parent 656a7dc973
commit f9f1e79879

View file

@ -392,7 +392,7 @@ class YoutubeIE(InfoExtractor):
format_param = params.get('format', None) format_param = params.get('format', None)
# Extension # Extension
video_extension = {18: 'mp4'}.get(format_param, 'flv') video_extension = {'18': 'mp4'}.get(format_param, 'flv')
# Normalize URL, including format # Normalize URL, including format
normalized_url = 'http://www.youtube.com/watch?v=%s' % video_id normalized_url = 'http://www.youtube.com/watch?v=%s' % video_id
@ -447,9 +447,15 @@ class YoutubeIE(InfoExtractor):
if __name__ == '__main__': if __name__ == '__main__':
try: try:
# Modules needed only when running the main program
import optparse
# General configuration # General configuration
urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())) urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler()))
urllib2.install_opener(urllib2.build_opener(urllib2.HTTPCookieProcessor())) urllib2.install_opener(urllib2.build_opener(urllib2.HTTPCookieProcessor()))
socket.setdefaulttimeout(300) # 5 minutes should be enough (famous last words)
# Parse command line
# Information extractors # Information extractors
youtube_ie = YoutubeIE() youtube_ie = YoutubeIE()
@ -459,12 +465,12 @@ if __name__ == '__main__':
'usenetrc': False, 'usenetrc': False,
'username': None, 'username': None,
'password': None, 'password': None,
'quiet': False, 'quiet': True,
'forceurl': False, 'forceurl': True,
'forcetitle': False, 'forcetitle': True,
'simulate': False, 'simulate': True,
'format': None, 'format': None,
'outtmpl': '%(ext)s/%(ext)s/%(id)s.%(ext)s' 'outtmpl': '%(id)s.%(ext)s'
}) })
fd.add_info_extractor(youtube_ie) fd.add_info_extractor(youtube_ie)
fd.download([ fd.download([