aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Garcia <sarbalap+freshmeat@gmail.com>2008-07-22 10:14:13 +0200
committerRicardo Garcia <devnull@localhost>2008-07-22 10:14:13 +0200
commitf9f1e798792af95a33c3ea137768369de156f198 (patch)
treeda05afb1897dd30faf7a59bdc4d5145ad3eb7b15
parent656a7dc973f72a02eae4a2cc8c48a72ecf1dbf02 (diff)
Minor improvements and changes
-rwxr-xr-xyoutube-dl18
1 files changed, 12 insertions, 6 deletions
diff --git a/youtube-dl b/youtube-dl
index cc2ba4262..607109bb2 100755
--- a/youtube-dl
+++ b/youtube-dl
@@ -392,7 +392,7 @@ class YoutubeIE(InfoExtractor):
format_param = params.get('format', None)
# Extension
- video_extension = {18: 'mp4'}.get(format_param, 'flv')
+ video_extension = {'18': 'mp4'}.get(format_param, 'flv')
# Normalize URL, including format
normalized_url = 'http://www.youtube.com/watch?v=%s' % video_id
@@ -447,9 +447,15 @@ class YoutubeIE(InfoExtractor):
if __name__ == '__main__':
try:
+ # Modules needed only when running the main program
+ import optparse
+
# General configuration
urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler()))
urllib2.install_opener(urllib2.build_opener(urllib2.HTTPCookieProcessor()))
+ socket.setdefaulttimeout(300) # 5 minutes should be enough (famous last words)
+
+ # Parse command line
# Information extractors
youtube_ie = YoutubeIE()
@@ -459,12 +465,12 @@ if __name__ == '__main__':
'usenetrc': False,
'username': None,
'password': None,
- 'quiet': False,
- 'forceurl': False,
- 'forcetitle': False,
- 'simulate': False,
+ 'quiet': True,
+ 'forceurl': True,
+ 'forcetitle': True,
+ 'simulate': True,
'format': None,
- 'outtmpl': '%(ext)s/%(ext)s/%(id)s.%(ext)s'
+ 'outtmpl': '%(id)s.%(ext)s'
})
fd.add_info_extractor(youtube_ie)
fd.download([