summary refs log tree commit diff
diff options
context:
space:
mode:
authorRicardo Garcia <sarbalap+freshmeat@gmail.com>2008-11-01 15:52:51 +0100
committerRicardo Garcia <sarbalap+freshmeat@gmail.com>2010-10-31 11:23:41 +0100
commit27d98b6e25fa76c14ad813bb70e2f53d0fd36ef1 (patch)
tree46e94775da2db9edbbd90956c8ee39cc494b0089
parent5487aea5d8f3b39257bd7e25a35239bb16b5a52e (diff)
downloadyoutube-dl-27d98b6e25fa76c14ad813bb70e2f53d0fd36ef1.tar.gz
youtube-dl-27d98b6e25fa76c14ad813bb70e2f53d0fd36ef1.tar.xz
youtube-dl-27d98b6e25fa76c14ad813bb70e2f53d0fd36ef1.zip
Fix TypeError in decode() method and unordered playlist URLs
-rwxr-xr-xyoutube-dl12
1 files changed, 8 insertions, 4 deletions
diff --git a/youtube-dl b/youtube-dl
index d8e14f3ee..e5cf43411 100755
--- a/youtube-dl
+++ b/youtube-dl
@@ -753,10 +753,11 @@ class YoutubePlaylistIE(InfoExtractor):
 				return [None]
 
 			# Extract video identifiers
-			ids_in_page = set()
+			ids_in_page = []
 			for mobj in re.finditer(self._VIDEO_INDICATOR, page):
-				ids_in_page.add(mobj.group(1))
-			video_ids.extend(list(ids_in_page))
+				if mobj.group(1) not in ids_in_page:
+					ids_in_page.append(mobj.group(1))
+			video_ids.extend(ids_in_page)
 
 			if (self._MORE_PAGES_INDICATOR % (playlist_id, pagenum + 1)) not in page:
 				break
@@ -901,6 +902,9 @@ if __name__ == '__main__':
 		youtube_pl_ie = YoutubePlaylistIE(youtube_ie)
 
 		# File downloader
+		charset = locale.getdefaultlocale()[1]
+		if charset is None:
+			charset = 'ascii'
 		fd = FileDownloader({
 			'usenetrc': opts.usenetrc,
 			'username': opts.username,
@@ -910,7 +914,7 @@ if __name__ == '__main__':
 			'forcetitle': opts.gettitle,
 			'simulate': (opts.simulate or opts.geturl or opts.gettitle),
 			'format': opts.format,
-			'outtmpl': ((opts.outtmpl is not None and opts.outtmpl.decode(locale.getdefaultlocale()[1]))
+			'outtmpl': ((opts.outtmpl is not None and opts.outtmpl.decode(charset))
 				or (opts.usetitle and u'%(stitle)s-%(id)s.%(ext)s')
 				or (opts.useliteral and u'%(title)s-%(id)s.%(ext)s')
 				or u'%(id)s.%(ext)s'),