diff options
Diffstat (limited to 'youtube_dl')
-rwxr-xr-x | youtube_dl/InfoExtractors.py | 35 | ||||
-rw-r--r-- | youtube_dl/update.py | 2 | ||||
-rw-r--r-- | youtube_dl/version.py | 2 |
3 files changed, 21 insertions, 18 deletions
diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py index d3c3ac264..d661d517d 100755 --- a/youtube_dl/InfoExtractors.py +++ b/youtube_dl/InfoExtractors.py @@ -1472,7 +1472,7 @@ class YoutubeSearchIE(InfoExtractor): result_url = self._API_URL % (compat_urllib_parse.quote_plus(query), (50*pagenum)+1) request = compat_urllib_request.Request(result_url) try: - data = compat_urllib_request.urlopen(request).read() + data = compat_urllib_request.urlopen(request).read().decode('utf-8') except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: self._downloader.trouble(u'ERROR: unable to download API page: %s' % compat_str(err)) return @@ -1921,9 +1921,8 @@ class BlipTVUserIE(InfoExtractor): while True: self.report_download_page(username, pagenum) - - request = compat_urllib_request.Request( page_base + "&page=" + str(pagenum) ) - + url = page_base + "&page=" + str(pagenum) + request = compat_urllib_request.Request( url ) try: page = compat_urllib_request.urlopen(request).read().decode('utf-8') except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err: @@ -3627,18 +3626,22 @@ class SteamIE(InfoExtractor): 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 in zip(mweb,titles): + 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: self._downloader.trouble(u'ERROR: Cannot find video url for %s' % video_id) info = { 'id':video_id, 'url':video_url, 'ext': 'flv', - 'title': unescapeHTML(title) + 'title': unescapeHTML(title), + 'thumbnail': video_thumb } videos.append(info) return videos @@ -4011,31 +4014,30 @@ class TEDIE(InfoExtractor): ([.\s]*?)data-playlist_item_id="(\d+)" ([.\s]*?)data-mediaslug="(?P<mediaSlug>.+?)" ''' - video_name_RE=r'<p\ class="talk-title"><a href="/talks/(.+).html">(?P<fullname>.+?)</a></p>' + video_name_RE=r'<p\ class="talk-title"><a href="(?P<talk_url>/talks/(.+).html)">(?P<fullname>.+?)</a></p>' webpage=self._download_webpage(url, playlist_id, 'Downloading playlist webpage') m_videos=re.finditer(video_RE,webpage,re.VERBOSE) m_names=re.finditer(video_name_RE,webpage) info=[] for m_video, m_name in zip(m_videos,m_names): - video_dic={ - 'id': m_video.group('video_id'), - 'url': self._talk_video_link(m_video.group('mediaSlug')), - 'ext': 'mp4', - 'title': m_name.group('fullname') - } - info.append(video_dic) + video_id=m_video.group('video_id') + talk_url='http://www.ted.com%s' % m_name.group('talk_url') + info.append(self._talk_info(talk_url,video_id)) return info + def _talk_info(self, url, video_id=0): """Return the video for the talk in the url""" m=re.match(self._VALID_URL, url,re.VERBOSE) videoName=m.group('name') webpage=self._download_webpage(url, video_id, 'Downloading \"%s\" page' % videoName) # If the url includes the language we get the title translated - title_RE=r'<h1><span id="altHeadline" >(?P<title>[\s\w:/\.\?=\+-\\\']*)</span></h1>' + title_RE=r'<h1><span id="altHeadline" >(?P<title>.*)</span></h1>' title=re.search(title_RE, webpage).group('title') info_RE=r'''<script\ type="text/javascript">var\ talkDetails\ =(.*?) "id":(?P<videoID>[\d]+).*? "mediaSlug":"(?P<mediaSlug>[\w\d]+?)"''' + thumb_RE=r'</span>[\s.]*</div>[\s.]*<img src="(?P<thumbnail>.*?)"' + thumb_match=re.search(thumb_RE,webpage) info_match=re.search(info_RE,webpage,re.VERBOSE) video_id=info_match.group('videoID') mediaSlug=info_match.group('mediaSlug') @@ -4044,7 +4046,8 @@ class TEDIE(InfoExtractor): 'id': video_id, 'url': video_url, 'ext': 'mp4', - 'title': title + 'title': title, + 'thumbnail': thumb_match.group('thumbnail') } return info diff --git a/youtube_dl/update.py b/youtube_dl/update.py index 8e5326196..b446dd94c 100644 --- a/youtube_dl/update.py +++ b/youtube_dl/update.py @@ -78,7 +78,7 @@ def update_self(to_screen, verbose, filename): to_screen(u'Updating to version ' + versions_info['latest'] + '...') version = versions_info['versions'][versions_info['latest']] - print_notes(version_info['versions']) + print_notes(versions_info['versions']) if not os.access(filename, os.W_OK): to_screen(u'ERROR: no write permissions on %s' % filename) diff --git a/youtube_dl/version.py b/youtube_dl/version.py index bcc618c44..ce8f6ca23 100644 --- a/youtube_dl/version.py +++ b/youtube_dl/version.py @@ -1,2 +1,2 @@ -__version__ = '2012.02.22' +__version__ = '2013.02.25' |