Browse Source

make all IEs return 'upload_date' and 'uploader', even if only u'NA'

Filippo Valsorda 12 years ago
parent
commit
9ce5d9ee75
1 changed files with 24 additions and 11 deletions
  1. 24 11
      youtube_dl/InfoExtractors.py

+ 24 - 11
youtube_dl/InfoExtractors.py

@@ -40,7 +40,7 @@ class InfoExtractor(object):
 
 
 	id:             Video identifier.
 	id:             Video identifier.
 	url:            Final video URL.
 	url:            Final video URL.
-	uploader:       Nickname of the video uploader.
+	uploader:       Nickname of the video uploader, unescaped.
 	upload_date:    Video upload date (YYYYMMDD).
 	upload_date:    Video upload date (YYYYMMDD).
 	title:          Video title, unescaped.
 	title:          Video title, unescaped.
 	ext:            Video filename extension.
 	ext:            Video filename extension.
@@ -52,6 +52,8 @@ class InfoExtractor(object):
 	description:    One-line video description.
 	description:    One-line video description.
 	player_url:     SWF Player URL (used for rtmpdump).
 	player_url:     SWF Player URL (used for rtmpdump).
 
 
+	The fields should all be Unicode strings.
+
 	Subclasses of this one should re-define the _real_initialize() and
 	Subclasses of this one should re-define the _real_initialize() and
 	_real_extract() methods and define a _VALID_URL regexp.
 	_real_extract() methods and define a _VALID_URL regexp.
 	Probably, they should also be added to the list of extractors.
 	Probably, they should also be added to the list of extractors.
@@ -1018,7 +1020,6 @@ class YahooIE(InfoExtractor):
 			'ext':		video_extension.decode('utf-8'),
 			'ext':		video_extension.decode('utf-8'),
 			'thumbnail':	video_thumbnail.decode('utf-8'),
 			'thumbnail':	video_thumbnail.decode('utf-8'),
 			'description':	video_description,
 			'description':	video_description,
-			'thumbnail':	video_thumbnail,
 		}]
 		}]
 
 
 
 
@@ -2129,6 +2130,8 @@ class BlipTVIE(InfoExtractor):
 				info = {
 				info = {
 					'id': title,
 					'id': title,
 					'url': url,
 					'url': url,
+					'uploader': u'NA',
+					'upload_date': u'NA',
 					'title': title,
 					'title': title,
 					'ext': ext,
 					'ext': ext,
 					'urlhandle': urlh
 					'urlhandle': urlh
@@ -2486,7 +2489,7 @@ class EscapistIE(InfoExtractor):
 			'id': videoId,
 			'id': videoId,
 			'url': videoUrl,
 			'url': videoUrl,
 			'uploader': showName,
 			'uploader': showName,
-			'upload_date': None,
+			'upload_date': u'NA',
 			'title': showName,
 			'title': showName,
 			'ext': 'flv',
 			'ext': 'flv',
 			'thumbnail': imgUrl,
 			'thumbnail': imgUrl,
@@ -2535,6 +2538,8 @@ class CollegeHumorIE(InfoExtractor):
 		info = {
 		info = {
 			'id': video_id,
 			'id': video_id,
 			'internal_id': internal_video_id,
 			'internal_id': internal_video_id,
+			'uploader': u'NA',
+			'upload_date': u'NA',
 		}
 		}
 
 
 		self.report_extraction(video_id)
 		self.report_extraction(video_id)
@@ -2619,8 +2624,8 @@ class XVideosIE(InfoExtractor):
 		info = {
 		info = {
 			'id': video_id,
 			'id': video_id,
 			'url': video_url,
 			'url': video_url,
-			'uploader': None,
-			'upload_date': None,
+			'uploader': u'NA',
+			'upload_date': u'NA',
 			'title': video_title,
 			'title': video_title,
 			'ext': 'flv',
 			'ext': 'flv',
 			'thumbnail': video_thumbnail,
 			'thumbnail': video_thumbnail,
@@ -2700,7 +2705,7 @@ class SoundcloudIE(InfoExtractor):
 			description = mobj.group(1)
 			description = mobj.group(1)
 
 
 		# upload date
 		# upload date
-		upload_date = None
+		upload_date = u'NA'
 		mobj = re.search("pretty-date'>on ([\w]+ [\d]+, [\d]+ \d+:\d+)</abbr></h2>", webpage)
 		mobj = re.search("pretty-date'>on ([\w]+ [\d]+, [\d]+ \d+:\d+)</abbr></h2>", webpage)
 		if mobj:
 		if mobj:
 			try:
 			try:
@@ -2781,8 +2786,8 @@ class InfoQIE(InfoExtractor):
 		info = {
 		info = {
 			'id': video_id,
 			'id': video_id,
 			'url': video_url,
 			'url': video_url,
-			'uploader': None,
-			'upload_date': None,
+			'uploader': u'NA',
+			'upload_date': u'NA',
 			'title': video_title,
 			'title': video_title,
 			'ext': extension, # Extension is always(?) mp4, but seems to be flv
 			'ext': extension, # Extension is always(?) mp4, but seems to be flv
 			'thumbnail': None,
 			'thumbnail': None,
@@ -2929,6 +2934,8 @@ class StanfordOpenClassroomIE(InfoExtractor):
 			video = mobj.group('video')
 			video = mobj.group('video')
 			info = {
 			info = {
 				'id': course + '_' + video,
 				'id': course + '_' + video,
+				'uploader': u'NA',
+				'upload_date': u'NA',
 			}
 			}
 
 
 			self.report_extraction(info['id'])
 			self.report_extraction(info['id'])
@@ -2953,6 +2960,8 @@ class StanfordOpenClassroomIE(InfoExtractor):
 			info = {
 			info = {
 				'id': course,
 				'id': course,
 				'type': 'playlist',
 				'type': 'playlist',
+				'uploader': u'NA',
+				'upload_date': u'NA',
 			}
 			}
 
 
 			self.report_download_webpage(info['id'])
 			self.report_download_webpage(info['id'])
@@ -2989,6 +2998,8 @@ class StanfordOpenClassroomIE(InfoExtractor):
 			info = {
 			info = {
 				'id': 'Stanford OpenClassroom',
 				'id': 'Stanford OpenClassroom',
 				'type': 'playlist',
 				'type': 'playlist',
+				'uploader': u'NA',
+				'upload_date': u'NA',
 			}
 			}
 
 
 			self.report_download_webpage(info['id'])
 			self.report_download_webpage(info['id'])
@@ -3097,6 +3108,7 @@ class MTVIE(InfoExtractor):
 			'id': video_id,
 			'id': video_id,
 			'url': video_url,
 			'url': video_url,
 			'uploader': performer,
 			'uploader': performer,
+			'upload_date': u'NA',
 			'title': video_title,
 			'title': video_title,
 			'ext': ext,
 			'ext': ext,
 			'format': format,
 			'format': format,
@@ -3217,7 +3229,8 @@ class YoukuIE(InfoExtractor):
 			info = {
 			info = {
 				'id': '%s_part%02d' % (video_id, index),
 				'id': '%s_part%02d' % (video_id, index),
 				'url': download_url,
 				'url': download_url,
-				'uploader': None,
+				'uploader': u'NA',
+				'upload_date': u'NA',
 				'title': video_title,
 				'title': video_title,
 				'ext': ext,
 				'ext': ext,
 			}
 			}
@@ -3280,8 +3293,8 @@ class XNXXIE(InfoExtractor):
 		return [{
 		return [{
 			'id': video_id,
 			'id': video_id,
 			'url': video_url,
 			'url': video_url,
-			'uploader': None,
-			'upload_date': None,
+			'uploader': u'NA',
+			'upload_date': u'NA',
 			'title': video_title,
 			'title': video_title,
 			'ext': 'flv',
 			'ext': 'flv',
 			'thumbnail': video_thumbnail,
 			'thumbnail': video_thumbnail,