Merge branch 'master' of git://github.com/rg3/youtube-dl

This commit is contained in:
Cade Scroggins 2014-02-04 14:40:07 -08:00
commit 3bbfde30cf
5 changed files with 88 additions and 84 deletions

View File

@ -1,39 +1,36 @@
# encoding: utf-8
from __future__ import unicode_literals
import re import re
from .common import InfoExtractor from .common import InfoExtractor
class InaIE(InfoExtractor): class InaIE(InfoExtractor):
"""Information Extractor for Ina.fr""" _VALID_URL = r'http://(?:www\.)?ina\.fr/video/(?P<id>I?[A-F0-9]+)/.*'
_VALID_URL = r'(?:http://)?(?:www\.)?ina\.fr/video/(?P<id>I?[A-F0-9]+)/.*'
_TEST = { _TEST = {
u'url': u'http://www.ina.fr/video/I12055569/francois-hollande-je-crois-que-c-est-clair-video.html', 'url': 'http://www.ina.fr/video/I12055569/francois-hollande-je-crois-que-c-est-clair-video.html',
u'file': u'I12055569.mp4', 'md5': 'a667021bf2b41f8dc6049479d9bb38a3',
u'md5': u'a667021bf2b41f8dc6049479d9bb38a3', 'info_dict': {
u'info_dict': { 'id': 'I12055569',
u"title": u"Fran\u00e7ois Hollande \"Je crois que c'est clair\"" '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) mobj = re.match(self._VALID_URL, url)
video_id = mobj.group('id') video_id = mobj.group('id')
mrss_url='http://player.ina.fr/notices/%s.mrss' % video_id mrss_url = 'http://player.ina.fr/notices/%s.mrss' % video_id
video_extension = 'mp4' info_doc = self._download_xml(mrss_url, video_id)
webpage = self._download_webpage(mrss_url, video_id)
self.report_extraction(video_id) self.report_extraction(video_id)
video_url = self._html_search_regex(r'<media:player url="(?P<mp4url>http://mp4.ina.fr/[^"]+\.mp4)', video_url = info_doc.find('.//{http://search.yahoo.com/mrss/}player').attrib['url']
webpage, u'video URL')
video_title = self._search_regex(r'<title><!\[CDATA\[(?P<titre>.*?)]]></title>', return {
webpage, u'title') 'id': video_id,
'url': video_url,
return [{ 'title': info_doc.find('.//title').text,
'id': video_id, }
'url': video_url,
'ext': video_extension,
'title': video_title,
}]

View File

@ -1,36 +1,38 @@
from __future__ import unicode_literals
import re import re
from .common import InfoExtractor from .common import InfoExtractor
class StatigramIE(InfoExtractor): class StatigramIE(InfoExtractor):
_VALID_URL = r'(?:http://)?(?:www\.)?statigr\.am/p/([^/]+)' _VALID_URL = r'https?://(www\.)?statigr\.am/p/(?P<id>[^/]+)'
_TEST = { _TEST = {
u'url': u'http://statigr.am/p/522207370455279102_24101272', 'url': 'http://statigr.am/p/522207370455279102_24101272',
u'file': u'522207370455279102_24101272.mp4', 'md5': '6eb93b882a3ded7c378ee1d6884b1814',
u'md5': u'6eb93b882a3ded7c378ee1d6884b1814', 'info_dict': {
u'info_dict': { 'id': '522207370455279102_24101272',
u'uploader_id': u'aguynamedpatrick', 'ext': 'mp4',
u'title': u'Instagram photo by @aguynamedpatrick (Patrick Janelle)', 'uploader_id': 'aguynamedpatrick',
'title': 'Instagram photo by @aguynamedpatrick (Patrick Janelle)',
}, },
} }
def _real_extract(self, url): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, 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) webpage = self._download_webpage(url, video_id)
html_title = self._html_search_regex( html_title = self._html_search_regex(
r'<title>(.+?)</title>', r'<title>(.+?)</title>',
webpage, u'title') webpage, 'title')
title = re.sub(r'(?: *\(Videos?\))? \| Statigram$', '', html_title) title = re.sub(r'(?: *\(Videos?\))? \| Statigram$', '', html_title)
uploader_id = self._html_search_regex( uploader_id = self._html_search_regex(
r'@([^ ]+)', title, u'uploader name', fatal=False) r'@([^ ]+)', title, 'uploader name', fatal=False)
ext = 'mp4'
return [{ return {
'id': video_id, 'id': video_id,
'url': self._og_search_video_url(webpage), 'url': self._og_search_video_url(webpage),
'ext': ext, 'title': title,
'title': title,
'thumbnail': self._og_search_thumbnail(webpage), 'thumbnail': self._og_search_thumbnail(webpage),
'uploader_id' : uploader_id 'uploader_id': uploader_id
}] }

View File

@ -1,3 +1,6 @@
# encoding: utf-8
from __future__ import unicode_literals
import re import re
from .common import InfoExtractor from .common import InfoExtractor
@ -10,45 +13,44 @@ from ..utils import (
class Vbox7IE(InfoExtractor): class Vbox7IE(InfoExtractor):
"""Information Extractor for Vbox7""" _VALID_URL = r'http://(www\.)?vbox7\.com/play:(?P<id>[^/]+)'
_VALID_URL = r'(?:http://)?(?:www\.)?vbox7\.com/play:([^/]+)'
_TEST = { _TEST = {
u'url': u'http://vbox7.com/play:249bb972c2', 'url': 'http://vbox7.com/play:249bb972c2',
u'file': u'249bb972c2.flv', 'md5': '99f65c0c9ef9b682b97313e052734c3f',
u'md5': u'99f65c0c9ef9b682b97313e052734c3f', 'info_dict': {
u'info_dict': { 'id': '249bb972c2',
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" 'ext': 'flv',
} 'title': 'Смях! Чудо - чист за секунди - Скрита камера',
},
} }
def _real_extract(self,url): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url) mobj = re.match(self._VALID_URL, url)
if mobj is None: video_id = mobj.group('id')
raise ExtractorError(u'Invalid URL: %s' % url)
video_id = mobj.group(1)
redirect_page, urlh = self._download_webpage_handle(url, video_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 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'<title>(.*)</title>', title = self._html_search_regex(r'<title>(.*)</title>',
webpage, u'title').split('/')[0].strip() webpage, 'title').split('/')[0].strip()
ext = "flv"
info_url = "http://vbox7.com/play/magare.do" 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 = compat_urllib_request.Request(info_url, data)
info_request.add_header('Content-Type', 'application/x-www-form-urlencoded') 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: 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('&')) (final_url, thumbnail_url) = map(lambda x: x.split('=')[1], info_response.split('&'))
return [{ return {
'id': video_id, 'id': video_id,
'url': final_url, 'url': final_url,
'ext': ext, 'ext': 'flv',
'title': title, 'title': title,
'thumbnail': thumbnail_url, 'thumbnail': thumbnail_url,
}] }

View File

@ -1,18 +1,21 @@
from __future__ import unicode_literals
import re import re
from .common import InfoExtractor from .common import InfoExtractor
class VineIE(InfoExtractor): class VineIE(InfoExtractor):
_VALID_URL = r'(?:https?://)?(?:www\.)?vine\.co/v/(?P<id>\w+)' _VALID_URL = r'https?://(?:www\.)?vine\.co/v/(?P<id>\w+)'
_TEST = { _TEST = {
u'url': u'https://vine.co/v/b9KOOWX7HUx', 'url': 'https://vine.co/v/b9KOOWX7HUx',
u'file': u'b9KOOWX7HUx.mp4', 'md5': '2f36fed6235b16da96ce9b4dc890940d',
u'md5': u'2f36fed6235b16da96ce9b4dc890940d', 'info_dict': {
u'info_dict': { 'id': 'b9KOOWX7HUx',
u"uploader": u"Jack Dorsey", 'ext': 'mp4',
u"title": u"Chicken." 'uploader': 'Jack Dorsey',
} 'title': 'Chicken.',
},
} }
def _real_extract(self, url): def _real_extract(self, url):
@ -24,17 +27,17 @@ class VineIE(InfoExtractor):
self.report_extraction(video_id) self.report_extraction(video_id)
video_url = self._html_search_regex(r'<meta property="twitter:player:stream" content="(.+?)"', video_url = self._html_search_meta('twitter:player:stream', webpage,
webpage, u'video URL') 'video URL')
uploader = self._html_search_regex(r'<p class="username">(.*?)</p>', uploader = self._html_search_regex(r'<p class="username">(.*?)</p>',
webpage, u'uploader', fatal=False, flags=re.DOTALL) webpage, 'uploader', fatal=False, flags=re.DOTALL)
return [{ return {
'id': video_id, 'id': video_id,
'url': video_url, 'url': video_url,
'ext': 'mp4', 'ext': 'mp4',
'title': self._og_search_title(webpage), 'title': self._og_search_title(webpage),
'thumbnail': self._og_search_thumbnail(webpage), 'thumbnail': self._og_search_thumbnail(webpage),
'uploader': uploader, 'uploader': uploader,
}] }

View File

@ -1,2 +1,2 @@
__version__ = '2014.02.04' __version__ = '2014.02.04.1'