- webpage = self._download_webpage(videourl, gameID)
-
- self.report_extraction(gameID)
- game_title = self._html_search_regex(r'<h2 class="pageheader">(.*?)</h2>',
- webpage, 'game title')
-
- urlRE = r"'movie_(?P<videoID>\d+)': \{\s*FILENAME: \"(?P<videoURL>[\w:/\.\?=]+)\"(,\s*MOVIE_NAME: \"(?P<videoName>[\w:/\.\?=\+-]+)\")?\s*\},"
- mweb = re.finditer(urlRE, webpage)
- namesRE = r'<span class="title">(?P<videoName>.+?)</span>'
- titles = re.finditer(namesRE, webpage)
- thumbsRE = r'<img class="movie_thumb" src="(?P<thumbnail>.+?)">'
- thumbs = re.finditer(thumbsRE, webpage)
- videos = []
- for vid,vtitle,thumb in zip(mweb,titles,thumbs):
- video_id = vid.group('videoID')
- title = vtitle.group('videoName')
- video_url = vid.group('videoURL')
- video_thumb = thumb.group('thumbnail')
- if not video_url:
- raise ExtractorError(u'Cannot find video url for %s' % video_id)
- info = {
- 'id':video_id,
- 'url':video_url,
- 'ext': 'flv',
- 'title': unescapeHTML(title),
- 'thumbnail': video_thumb
- }
- videos.append(info)
- return [self.playlist_result(videos, gameID, game_title)]
+ webpage = self._download_webpage(videourl, playlist_id)
+
+ if fileID:
+ playlist_title = self._html_search_regex(
+ r'<div class="workshopItemTitle">(.+)</div>', webpage, 'title')
+ mweb = re.finditer(r'''(?x)
+ 'movie_(?P<videoID>[0-9]+)':\s*\{\s*
+ YOUTUBE_VIDEO_ID:\s*"(?P<youtube_id>[^"]+)",
+ ''', webpage)
+ videos = [{
+ '_type': 'url',
+ 'url': vid.group('youtube_id'),
+ 'ie_key': 'Youtube',
+ } for vid in mweb]
+ else:
+ playlist_title = self._html_search_regex(
+ r'<h2 class="pageheader">(.*?)</h2>', webpage, 'game title')
+
+ mweb = re.finditer(r'''(?x)
+ 'movie_(?P<videoID>[0-9]+)':\s*\{\s*
+ FILENAME:\s*"(?P<videoURL>[\w:/\.\?=]+)"
+ (,\s*MOVIE_NAME:\s*\"(?P<videoName>[\w:/\.\?=\+-]+)\")?\s*\},
+ ''', webpage)
+ titles = re.finditer(
+ r'<span class="title">(?P<videoName>.+?)</span>', webpage)
+ thumbs = re.finditer(
+ r'<img class="movie_thumb" src="(?P<thumbnail>.+?)">', webpage)
+ videos = []
+
+ for vid, vtitle, thumb in zip(mweb, titles, thumbs):
+ video_id = vid.group('videoID')
+ title = vtitle.group('videoName')
+ video_url = vid.group('videoURL')
+ video_thumb = thumb.group('thumbnail')
+ if not video_url:
+ raise ExtractorError('Cannot find video url for %s' % video_id)
+ videos.append({
+ 'id': video_id,
+ 'url': video_url,
+ 'ext': 'flv',
+ 'title': unescapeHTML(title),
+ 'thumbnail': video_thumb
+ })
+ if not videos:
+ raise ExtractorError('Could not find any videos')
+
+ return self.playlist_result(videos, playlist_id, playlist_title)