summary refs log tree commit diff
diff options
context:
space:
mode:
authorRicardo Garcia <sarbalap+freshmeat@gmail.com>2011-01-03 11:47:23 +0100
committerRicardo Garcia <sarbalap+freshmeat@gmail.com>2011-01-03 11:47:23 +0100
commite7cf18cb6b5c5c679583636d5b057d328655c7a6 (patch)
tree3f046e0d1f84088feb5babdbb633003d0e8201d1
parent09cc744c90ccff8d6f52cbea8c4bcb864b897cbb (diff)
downloadyoutube-dl-e7cf18cb6b5c5c679583636d5b057d328655c7a6.tar.gz
youtube-dl-e7cf18cb6b5c5c679583636d5b057d328655c7a6.tar.xz
youtube-dl-e7cf18cb6b5c5c679583636d5b057d328655c7a6.zip
Add --dump-user-agent option (patch provided by Benjamin Johnson)
-rwxr-xr-xyoutube-dl7
1 files changed, 7 insertions, 0 deletions
diff --git a/youtube-dl b/youtube-dl
index 87e0375c4..614f20c59 100755
--- a/youtube-dl
+++ b/youtube-dl
@@ -2257,6 +2257,8 @@ if __name__ == '__main__':
 				dest='playliststart', metavar='NUMBER', help='playlist video to start at (default is 1)', default=1)
 		parser.add_option('--playlist-end',
 				dest='playlistend', metavar='NUMBER', help='playlist video to end at (default is last)', default=-1)
+		parser.add_option('--dump-user-agent',
+				action='store_true', dest='dump_user_agent', help='display the current browser identification', default=False)
 
 		authentication = optparse.OptionGroup(parser, 'Authentication Options')
 		authentication.add_option('-u', '--username',
@@ -2325,6 +2327,11 @@ if __name__ == '__main__':
 			except (IOError, OSError), err:
 				sys.exit(u'ERROR: unable to open cookie file')
 
+		# Dump user agent
+		if opts.dump_user_agent:
+			print std_headers['User-Agent']
+			sys.exit(0)
+
 		# General configuration
 		cookie_processor = urllib2.HTTPCookieProcessor(jar)
 		urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler()))