From 5dc733f071188496436410a9a9e7e4e404a28912 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Marqui=CC=81nez=20Ferra=CC=81ndiz?= Date: Fri, 31 Jan 2014 14:17:21 +0100 Subject: [PATCH 1/5] [vine] Simplify --- youtube_dl/extractor/vine.py | 39 +++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/youtube_dl/extractor/vine.py b/youtube_dl/extractor/vine.py index 651ba317d..e14ff91d4 100644 --- a/youtube_dl/extractor/vine.py +++ b/youtube_dl/extractor/vine.py @@ -1,18 +1,21 @@ +from __future__ import unicode_literals + import re from .common import InfoExtractor class VineIE(InfoExtractor): - _VALID_URL = r'(?:https?://)?(?:www\.)?vine\.co/v/(?P\w+)' + _VALID_URL = r'https?://(?:www\.)?vine\.co/v/(?P\w+)' _TEST = { - u'url': u'https://vine.co/v/b9KOOWX7HUx', - u'file': u'b9KOOWX7HUx.mp4', - u'md5': u'2f36fed6235b16da96ce9b4dc890940d', - u'info_dict': { - u"uploader": u"Jack Dorsey", - u"title": u"Chicken." - } + 'url': 'https://vine.co/v/b9KOOWX7HUx', + 'md5': '2f36fed6235b16da96ce9b4dc890940d', + 'info_dict': { + 'id': 'b9KOOWX7HUx', + 'ext': 'mp4', + 'uploader': 'Jack Dorsey', + 'title': 'Chicken.', + }, } def _real_extract(self, url): @@ -24,17 +27,17 @@ class VineIE(InfoExtractor): self.report_extraction(video_id) - video_url = self._html_search_regex(r'(.*?)

', - webpage, u'uploader', fatal=False, flags=re.DOTALL) + webpage, 'uploader', fatal=False, flags=re.DOTALL) - return [{ - 'id': video_id, - 'url': video_url, - 'ext': 'mp4', - 'title': self._og_search_title(webpage), + return { + 'id': video_id, + 'url': video_url, + 'ext': 'mp4', + 'title': self._og_search_title(webpage), 'thumbnail': self._og_search_thumbnail(webpage), - 'uploader': uploader, - }] + 'uploader': uploader, + } From 9bc70948e109e7ad215d74dacb8bca2c40eba7d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Marqui=CC=81nez=20Ferra=CC=81ndiz?= Date: Fri, 31 Jan 2014 14:19:22 +0100 Subject: [PATCH 2/5] [statigram] Simplify --- youtube_dl/extractor/statigram.py | 38 ++++++++++++++++--------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/youtube_dl/extractor/statigram.py b/youtube_dl/extractor/statigram.py index 1ea4a9f2f..d602e817a 100644 --- a/youtube_dl/extractor/statigram.py +++ b/youtube_dl/extractor/statigram.py @@ -1,36 +1,38 @@ +from __future__ import unicode_literals + import re from .common import InfoExtractor + class StatigramIE(InfoExtractor): - _VALID_URL = r'(?:http://)?(?:www\.)?statigr\.am/p/([^/]+)' + _VALID_URL = r'https?://(www\.)?statigr\.am/p/(?P[^/]+)' _TEST = { - u'url': u'http://statigr.am/p/522207370455279102_24101272', - u'file': u'522207370455279102_24101272.mp4', - u'md5': u'6eb93b882a3ded7c378ee1d6884b1814', - u'info_dict': { - u'uploader_id': u'aguynamedpatrick', - u'title': u'Instagram photo by @aguynamedpatrick (Patrick Janelle)', + 'url': 'http://statigr.am/p/522207370455279102_24101272', + 'md5': '6eb93b882a3ded7c378ee1d6884b1814', + 'info_dict': { + 'id': '522207370455279102_24101272', + 'ext': 'mp4', + 'uploader_id': 'aguynamedpatrick', + 'title': 'Instagram photo by @aguynamedpatrick (Patrick Janelle)', }, } def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) - video_id = mobj.group(1) + video_id = mobj.group('id') webpage = self._download_webpage(url, video_id) html_title = self._html_search_regex( r'(.+?)', - webpage, u'title') + webpage, 'title') title = re.sub(r'(?: *\(Videos?\))? \| Statigram$', '', html_title) uploader_id = self._html_search_regex( - r'@([^ ]+)', title, u'uploader name', fatal=False) - ext = 'mp4' + r'@([^ ]+)', title, 'uploader name', fatal=False) - return [{ - 'id': video_id, - 'url': self._og_search_video_url(webpage), - 'ext': ext, - 'title': title, + return { + 'id': video_id, + 'url': self._og_search_video_url(webpage), + 'title': title, 'thumbnail': self._og_search_thumbnail(webpage), - 'uploader_id' : uploader_id - }] + 'uploader_id': uploader_id + } From 50451f2a18a59d8ee2d59fe8d580ae67f98150be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Marqui=CC=81nez=20Ferra=CC=81ndiz?= Date: Tue, 4 Feb 2014 23:02:53 +0100 Subject: [PATCH 3/5] [vbox7] simplify --- youtube_dl/extractor/vbox7.py | 52 ++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/youtube_dl/extractor/vbox7.py b/youtube_dl/extractor/vbox7.py index 5a136a952..df115d251 100644 --- a/youtube_dl/extractor/vbox7.py +++ b/youtube_dl/extractor/vbox7.py @@ -1,3 +1,6 @@ +# encoding: utf-8 +from __future__ import unicode_literals + import re from .common import InfoExtractor @@ -10,45 +13,44 @@ from ..utils import ( class Vbox7IE(InfoExtractor): - """Information Extractor for Vbox7""" - _VALID_URL = r'(?:http://)?(?:www\.)?vbox7\.com/play:([^/]+)' + _VALID_URL = r'http://(www\.)?vbox7\.com/play:(?P[^/]+)' _TEST = { - u'url': u'http://vbox7.com/play:249bb972c2', - u'file': u'249bb972c2.flv', - u'md5': u'99f65c0c9ef9b682b97313e052734c3f', - u'info_dict': { - u"title": u"\u0421\u043c\u044f\u0445! \u0427\u0443\u0434\u043e - \u0447\u0438\u0441\u0442 \u0437\u0430 \u0441\u0435\u043a\u0443\u043d\u0434\u0438 - \u0421\u043a\u0440\u0438\u0442\u0430 \u043a\u0430\u043c\u0435\u0440\u0430" - } + 'url': 'http://vbox7.com/play:249bb972c2', + 'md5': '99f65c0c9ef9b682b97313e052734c3f', + 'info_dict': { + 'id': '249bb972c2', + 'ext': 'flv', + 'title': 'Смях! Чудо - чист за секунди - Скрита камера', + }, } - def _real_extract(self,url): + def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) - if mobj is None: - raise ExtractorError(u'Invalid URL: %s' % url) - video_id = mobj.group(1) + video_id = mobj.group('id') redirect_page, urlh = self._download_webpage_handle(url, video_id) - new_location = self._search_regex(r'window\.location = \'(.*)\';', redirect_page, u'redirect location') + new_location = self._search_regex(r'window\.location = \'(.*)\';', + redirect_page, 'redirect location') redirect_url = urlh.geturl() + new_location - webpage = self._download_webpage(redirect_url, video_id, u'Downloading redirect page') + webpage = self._download_webpage(redirect_url, video_id, + 'Downloading redirect page') title = self._html_search_regex(r'(.*)', - webpage, u'title').split('/')[0].strip() + webpage, 'title').split('/')[0].strip() - ext = "flv" info_url = "http://vbox7.com/play/magare.do" - data = compat_urllib_parse.urlencode({'as3':'1','vid':video_id}) + data = compat_urllib_parse.urlencode({'as3': '1', 'vid': video_id}) info_request = compat_urllib_request.Request(info_url, data) info_request.add_header('Content-Type', 'application/x-www-form-urlencoded') - info_response = self._download_webpage(info_request, video_id, u'Downloading info webpage') + info_response = self._download_webpage(info_request, video_id, 'Downloading info webpage') if info_response is None: - raise ExtractorError(u'Unable to extract the media url') + raise ExtractorError('Unable to extract the media url') (final_url, thumbnail_url) = map(lambda x: x.split('=')[1], info_response.split('&')) - return [{ - 'id': video_id, - 'url': final_url, - 'ext': ext, - 'title': title, + return { + 'id': video_id, + 'url': final_url, + 'ext': 'flv', + 'title': title, 'thumbnail': thumbnail_url, - }] + } From de563c9da07aa522a971a69593f8ceff6be03e0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Marqui=CC=81nez=20Ferra=CC=81ndiz?= Date: Tue, 4 Feb 2014 23:15:04 +0100 Subject: [PATCH 4/5] [ina] Simplify MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Download the feed with ‘_download_xml’ to make the extraction easier --- youtube_dl/extractor/ina.py | 41 +++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/youtube_dl/extractor/ina.py b/youtube_dl/extractor/ina.py index ef9bca734..e9f5f3cf9 100644 --- a/youtube_dl/extractor/ina.py +++ b/youtube_dl/extractor/ina.py @@ -1,39 +1,36 @@ +# encoding: utf-8 +from __future__ import unicode_literals + import re from .common import InfoExtractor class InaIE(InfoExtractor): - """Information Extractor for Ina.fr""" - _VALID_URL = r'(?:http://)?(?:www\.)?ina\.fr/video/(?PI?[A-F0-9]+)/.*' + _VALID_URL = r'http://(?:www\.)?ina\.fr/video/(?PI?[A-F0-9]+)/.*' _TEST = { - u'url': u'http://www.ina.fr/video/I12055569/francois-hollande-je-crois-que-c-est-clair-video.html', - u'file': u'I12055569.mp4', - u'md5': u'a667021bf2b41f8dc6049479d9bb38a3', - u'info_dict': { - u"title": u"Fran\u00e7ois Hollande \"Je crois que c'est clair\"" + 'url': 'http://www.ina.fr/video/I12055569/francois-hollande-je-crois-que-c-est-clair-video.html', + 'md5': 'a667021bf2b41f8dc6049479d9bb38a3', + 'info_dict': { + 'id': 'I12055569', + 'ext': 'mp4', + 'title': 'François Hollande "Je crois que c\'est clair"', } } - def _real_extract(self,url): + def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) video_id = mobj.group('id') - mrss_url='http://player.ina.fr/notices/%s.mrss' % video_id - video_extension = 'mp4' - webpage = self._download_webpage(mrss_url, video_id) + mrss_url = 'http://player.ina.fr/notices/%s.mrss' % video_id + info_doc = self._download_xml(mrss_url, video_id) self.report_extraction(video_id) - video_url = self._html_search_regex(r'.*?)]]>', - webpage, u'title') - - return [{ - 'id': video_id, - 'url': video_url, - 'ext': video_extension, - 'title': video_title, - }] + return { + 'id': video_id, + 'url': video_url, + 'title': info_doc.find('.//title').text, + } From 7ee50ae7b51ea24362419885964c11f3f7fcbb30 Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Tue, 4 Feb 2014 23:26:55 +0100 Subject: [PATCH 5/5] release 2014.02.04.1 --- youtube_dl/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/version.py b/youtube_dl/version.py index 7bcd1e5a5..64ff1da87 100644 --- a/youtube_dl/version.py +++ b/youtube_dl/version.py @@ -1,2 +1,2 @@ -__version__ = '2014.02.04' +__version__ = '2014.02.04.1'