Compare commits
11 Commits
2014.02.22
...
2014.02.24
Author | SHA1 | Date | |
---|---|---|---|
0bf5cf9886 | |||
919052d094 | |||
a2dafe2887 | |||
92661c994b | |||
ffe8fe356a | |||
bc2f773b4f | |||
f919201ecc | |||
7ff5d5c2e2 | |||
9b77f951c7 | |||
a25f2f990a | |||
78b373975d |
@ -23,8 +23,8 @@ class BreakIE(InfoExtractor):
|
|||||||
video_id = mobj.group(1).split("-")[-1]
|
video_id = mobj.group(1).split("-")[-1]
|
||||||
embed_url = 'http://www.break.com/embed/%s' % video_id
|
embed_url = 'http://www.break.com/embed/%s' % video_id
|
||||||
webpage = self._download_webpage(embed_url, video_id)
|
webpage = self._download_webpage(embed_url, video_id)
|
||||||
info_json = self._search_regex(r'var embedVars = ({.*?});', webpage,
|
info_json = self._search_regex(r'var embedVars = ({.*})\s*?</script>',
|
||||||
'info json', flags=re.DOTALL)
|
webpage, 'info json', flags=re.DOTALL)
|
||||||
info = json.loads(info_json)
|
info = json.loads(info_json)
|
||||||
video_url = info['videoUri']
|
video_url = info['videoUri']
|
||||||
m_youtube = re.search(r'(https?://www\.youtube\.com/watch\?v=.*)', video_url)
|
m_youtube = re.search(r'(https?://www\.youtube\.com/watch\?v=.*)', video_url)
|
||||||
|
@ -1,61 +1,51 @@
|
|||||||
|
# encoding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
ExtractorError,
|
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class NormalbootsIE(InfoExtractor):
|
class NormalbootsIE(InfoExtractor):
|
||||||
_VALID_URL = r'(?:http://)?(?:www\.)?normalboots\.com/video/(?P<videoid>[0-9a-z-]*)/?$'
|
_VALID_URL = r'http://(?:www\.)?normalboots\.com/video/(?P<videoid>[0-9a-z-]*)/?$'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://normalboots.com/video/home-alone-games-jontron/',
|
'url': 'http://normalboots.com/video/home-alone-games-jontron/',
|
||||||
u'file': u'home-alone-games-jontron.mp4',
|
'md5': '8bf6de238915dd501105b44ef5f1e0f6',
|
||||||
u'md5': u'8bf6de238915dd501105b44ef5f1e0f6',
|
'info_dict': {
|
||||||
u'info_dict': {
|
'id': 'home-alone-games-jontron',
|
||||||
u'title': u'Home Alone Games - JonTron - NormalBoots',
|
'ext': 'mp4',
|
||||||
u'description': u'Jon is late for Christmas. Typical. Thanks to: Paul Ritchey for Co-Writing/Filming: http://www.youtube.com/user/ContinueShow Michael Azzi for Christmas Intro Animation: http://michafrar.tumblr.com/ Jerrod Waters for Christmas Intro Music: http://www.youtube.com/user/xXJerryTerryXx Casey Ormond for \u2018Tense Battle Theme\u2019:\xa0http://www.youtube.com/Kiamet/',
|
'title': 'Home Alone Games - JonTron - NormalBoots',
|
||||||
u'uploader': u'JonTron',
|
'description': 'Jon is late for Christmas. Typical. Thanks to: Paul Ritchey for Co-Writing/Filming: http://www.youtube.com/user/ContinueShow Michael Azzi for Christmas Intro Animation: http://michafrar.tumblr.com/ Jerrod Waters for Christmas Intro Music: http://www.youtube.com/user/xXJerryTerryXx Casey Ormond for ‘Tense Battle Theme’:\xa0http://www.youtube.com/Kiamet/',
|
||||||
u'upload_date': u'20140125',
|
'uploader': 'JonTron',
|
||||||
|
'upload_date': '20140125',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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:
|
|
||||||
raise ExtractorError(u'Invalid URL: %s' % url)
|
|
||||||
video_id = mobj.group('videoid')
|
video_id = mobj.group('videoid')
|
||||||
|
|
||||||
info = {
|
|
||||||
'id': video_id,
|
|
||||||
'uploader': None,
|
|
||||||
'upload_date': None,
|
|
||||||
}
|
|
||||||
|
|
||||||
if url[:4] != 'http':
|
|
||||||
url = 'http://' + url
|
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
video_title = self._og_search_title(webpage)
|
|
||||||
video_description = self._og_search_description(webpage)
|
|
||||||
video_thumbnail = self._og_search_thumbnail(webpage)
|
|
||||||
video_uploader = self._html_search_regex(r'Posted\sby\s<a\shref="[A-Za-z0-9/]*">(?P<uploader>[A-Za-z]*)\s</a>',
|
video_uploader = self._html_search_regex(r'Posted\sby\s<a\shref="[A-Za-z0-9/]*">(?P<uploader>[A-Za-z]*)\s</a>',
|
||||||
webpage, 'uploader')
|
webpage, 'uploader')
|
||||||
raw_upload_date = self._html_search_regex('<span style="text-transform:uppercase; font-size:inherit;">[A-Za-z]+, (?P<date>.*)</span>',
|
raw_upload_date = self._html_search_regex('<span style="text-transform:uppercase; font-size:inherit;">[A-Za-z]+, (?P<date>.*)</span>',
|
||||||
webpage, 'date')
|
webpage, 'date')
|
||||||
video_upload_date = unified_strdate(raw_upload_date)
|
video_upload_date = unified_strdate(raw_upload_date)
|
||||||
video_upload_date = unified_strdate(raw_upload_date)
|
|
||||||
|
|
||||||
player_url = self._html_search_regex(r'<iframe\swidth="[0-9]+"\sheight="[0-9]+"\ssrc="(?P<url>[\S]+)"', webpage, 'url')
|
player_url = self._html_search_regex(r'<iframe\swidth="[0-9]+"\sheight="[0-9]+"\ssrc="(?P<url>[\S]+)"', webpage, 'url')
|
||||||
player_page = self._download_webpage(player_url, video_id)
|
player_page = self._download_webpage(player_url, video_id)
|
||||||
video_url = u'http://player.screenwavemedia.com/' + self._html_search_regex(r"'file':\s'(?P<file>[0-9A-Za-z-_\.]+)'", player_page, 'file')
|
video_url = self._html_search_regex(r"file:\s'(?P<file>[^']+\.mp4)'", player_page, 'file')
|
||||||
|
|
||||||
info['url'] = video_url
|
return {
|
||||||
info['title'] = video_title
|
'id': video_id,
|
||||||
info['description'] = video_description
|
'url': video_url,
|
||||||
info['thumbnail'] = video_thumbnail
|
'title': self._og_search_title(webpage),
|
||||||
info['uploader'] = video_uploader
|
'description': self._og_search_description(webpage),
|
||||||
info['upload_date'] = video_upload_date
|
'thumbnail': self._og_search_thumbnail(webpage),
|
||||||
|
'uploader': video_uploader,
|
||||||
return info
|
'upload_date': video_upload_date,
|
||||||
|
}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
import json
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..utils import unified_strdate
|
||||||
|
|
||||||
|
|
||||||
class VineIE(InfoExtractor):
|
class VineIE(InfoExtractor):
|
||||||
@ -13,31 +15,46 @@ class VineIE(InfoExtractor):
|
|||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'b9KOOWX7HUx',
|
'id': 'b9KOOWX7HUx',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'uploader': 'Jack Dorsey',
|
|
||||||
'title': 'Chicken.',
|
'title': 'Chicken.',
|
||||||
|
'description': 'Chicken.',
|
||||||
|
'upload_date': '20130519',
|
||||||
|
'uploader': 'Jack Dorsey',
|
||||||
|
'uploader_id': '76',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
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')
|
||||||
webpage_url = 'https://vine.co/v/' + video_id
|
|
||||||
webpage = self._download_webpage(webpage_url, video_id)
|
|
||||||
|
|
||||||
self.report_extraction(video_id)
|
webpage = self._download_webpage('https://vine.co/v/' + video_id, video_id)
|
||||||
|
|
||||||
video_url = self._html_search_meta('twitter:player:stream', webpage,
|
data = json.loads(self._html_search_regex(
|
||||||
'video URL')
|
r'window\.POST_DATA = { %s: ({.+?}) }' % video_id, webpage, 'vine data'))
|
||||||
|
|
||||||
uploader = self._html_search_regex(r'<p class="username">(.*?)</p>',
|
formats = [
|
||||||
webpage, 'uploader', fatal=False, flags=re.DOTALL)
|
{
|
||||||
|
'url': data['videoLowURL'],
|
||||||
|
'ext': 'mp4',
|
||||||
|
'format_id': 'low',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': data['videoUrl'],
|
||||||
|
'ext': 'mp4',
|
||||||
|
'format_id': 'standard',
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_url,
|
|
||||||
'ext': 'mp4',
|
|
||||||
'title': self._og_search_title(webpage),
|
'title': self._og_search_title(webpage),
|
||||||
'thumbnail': self._og_search_thumbnail(webpage),
|
'description': data['description'],
|
||||||
'uploader': uploader,
|
'thumbnail': data['thumbnailUrl'],
|
||||||
|
'upload_date': unified_strdate(data['created']),
|
||||||
|
'uploader': data['username'],
|
||||||
|
'uploader_id': data['userIdStr'],
|
||||||
|
'like_count': data['likes']['count'],
|
||||||
|
'comment_count': data['comments']['count'],
|
||||||
|
'repost_count': data['reposts']['count'],
|
||||||
|
'formats': formats,
|
||||||
}
|
}
|
@ -1488,11 +1488,15 @@ class YoutubePlaylistIE(YoutubeBaseInfoExtractor):
|
|||||||
# the id of the playlist is just 'RD' + video_id
|
# the id of the playlist is just 'RD' + video_id
|
||||||
url = 'https://youtube.com/watch?v=%s&list=%s' % (playlist_id[-11:], playlist_id)
|
url = 'https://youtube.com/watch?v=%s&list=%s' % (playlist_id[-11:], playlist_id)
|
||||||
webpage = self._download_webpage(url, playlist_id, u'Downloading Youtube mix')
|
webpage = self._download_webpage(url, playlist_id, u'Downloading Youtube mix')
|
||||||
title_span = (get_element_by_attribute('class', 'title long-title', webpage) or
|
search_title = lambda class_name: get_element_by_attribute('class', class_name, webpage)
|
||||||
get_element_by_attribute('class', 'title ', webpage))
|
title_span = (search_title('playlist-title') or
|
||||||
|
search_title('title long-title') or search_title('title'))
|
||||||
title = clean_html(title_span)
|
title = clean_html(title_span)
|
||||||
video_re = r'data-index="\d+".*?href="/watch\?v=([0-9A-Za-z_-]{11})&[^"]*?list=%s' % re.escape(playlist_id)
|
video_re = r'''(?x)data-video-username="(.*?)".*?
|
||||||
ids = orderedSet(re.findall(video_re, webpage))
|
href="/watch\?v=([0-9A-Za-z_-]{11})&[^"]*?list=%s''' % re.escape(playlist_id)
|
||||||
|
matches = orderedSet(re.findall(video_re, webpage, flags=re.DOTALL))
|
||||||
|
# Some of the videos may have been deleted, their username field is empty
|
||||||
|
ids = [video_id for (username, video_id) in matches if username]
|
||||||
url_results = self._ids_to_results(ids)
|
url_results = self._ids_to_results(ids)
|
||||||
|
|
||||||
return self.playlist_result(url_results, playlist_id, title)
|
return self.playlist_result(url_results, playlist_id, title)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@ -13,52 +14,42 @@ class ZDFIE(InfoExtractor):
|
|||||||
_VALID_URL = r'^https?://www\.zdf\.de/ZDFmediathek(?P<hash>#)?/(.*beitrag/(?:video/)?)(?P<video_id>[0-9]+)(?:/[^/?]+)?(?:\?.*)?'
|
_VALID_URL = r'^https?://www\.zdf\.de/ZDFmediathek(?P<hash>#)?/(.*beitrag/(?:video/)?)(?P<video_id>[0-9]+)(?:/[^/?]+)?(?:\?.*)?'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u"url": u"http://www.zdf.de/ZDFmediathek/beitrag/video/2037704/ZDFspezial---Ende-des-Machtpokers--?bc=sts;stt",
|
'url': 'http://www.zdf.de/ZDFmediathek/beitrag/video/2037704/ZDFspezial---Ende-des-Machtpokers--?bc=sts;stt',
|
||||||
u"file": u"2037704.webm",
|
'info_dict': {
|
||||||
u"info_dict": {
|
'id': '2037704',
|
||||||
u"upload_date": u"20131127",
|
'ext': 'webm',
|
||||||
u"description": u"Union und SPD haben sich auf einen Koalitionsvertrag geeinigt. Aber was bedeutet das für die Bürger? Sehen Sie hierzu das ZDFspezial \"Ende des Machtpokers - Große Koalition für Deutschland\".",
|
'title': 'ZDFspezial - Ende des Machtpokers',
|
||||||
u"uploader": u"spezial",
|
'description': 'Union und SPD haben sich auf einen Koalitionsvertrag geeinigt. Aber was bedeutet das für die Bürger? Sehen Sie hierzu das ZDFspezial "Ende des Machtpokers - Große Koalition für Deutschland".',
|
||||||
u"title": u"ZDFspezial - Ende des Machtpokers"
|
'duration': 1022,
|
||||||
|
'uploader': 'spezial',
|
||||||
|
'uploader_id': '225948',
|
||||||
|
'upload_date': '20131127',
|
||||||
},
|
},
|
||||||
u"skip": u"Videos on ZDF.de are depublicised in short order",
|
'skip': 'Videos on ZDF.de are depublicised in short order',
|
||||||
}
|
}
|
||||||
|
|
||||||
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('video_id')
|
video_id = mobj.group('video_id')
|
||||||
|
|
||||||
xml_url = u'http://www.zdf.de/ZDFmediathek/xmlservice/web/beitragsDetails?ak=web&id=%s' % video_id
|
xml_url = 'http://www.zdf.de/ZDFmediathek/xmlservice/web/beitragsDetails?ak=web&id=%s' % video_id
|
||||||
doc = self._download_xml(
|
doc = self._download_xml(
|
||||||
xml_url, video_id,
|
xml_url, video_id,
|
||||||
note=u'Downloading video info',
|
note='Downloading video info',
|
||||||
errnote=u'Failed to download video info')
|
errnote='Failed to download video info')
|
||||||
|
|
||||||
title = doc.find('.//information/title').text
|
title = doc.find('.//information/title').text
|
||||||
description = doc.find('.//information/detail').text
|
description = doc.find('.//information/detail').text
|
||||||
|
duration = int(doc.find('.//details/lengthSec').text)
|
||||||
uploader_node = doc.find('.//details/originChannelTitle')
|
uploader_node = doc.find('.//details/originChannelTitle')
|
||||||
uploader = None if uploader_node is None else uploader_node.text
|
uploader = None if uploader_node is None else uploader_node.text
|
||||||
duration_str = doc.find('.//details/length').text
|
uploader_id_node = doc.find('.//details/originChannelId')
|
||||||
duration_m = re.match(r'''(?x)^
|
uploader_id = None if uploader_id_node is None else uploader_id_node.text
|
||||||
(?P<hours>[0-9]{2})
|
|
||||||
:(?P<minutes>[0-9]{2})
|
|
||||||
:(?P<seconds>[0-9]{2})
|
|
||||||
(?:\.(?P<ms>[0-9]+)?)
|
|
||||||
''', duration_str)
|
|
||||||
duration = (
|
|
||||||
(
|
|
||||||
(int(duration_m.group('hours')) * 60 * 60) +
|
|
||||||
(int(duration_m.group('minutes')) * 60) +
|
|
||||||
int(duration_m.group('seconds'))
|
|
||||||
)
|
|
||||||
if duration_m
|
|
||||||
else None
|
|
||||||
)
|
|
||||||
upload_date = unified_strdate(doc.find('.//details/airtime').text)
|
upload_date = unified_strdate(doc.find('.//details/airtime').text)
|
||||||
|
|
||||||
def xml_to_format(fnode):
|
def xml_to_format(fnode):
|
||||||
video_url = fnode.find('url').text
|
video_url = fnode.find('url').text
|
||||||
is_available = u'http://www.metafilegenerator' not in video_url
|
is_available = 'http://www.metafilegenerator' not in video_url
|
||||||
|
|
||||||
format_id = fnode.attrib['basetype']
|
format_id = fnode.attrib['basetype']
|
||||||
format_m = re.match(r'''(?x)
|
format_m = re.match(r'''(?x)
|
||||||
@ -71,22 +62,28 @@ class ZDFIE(InfoExtractor):
|
|||||||
|
|
||||||
quality = fnode.find('./quality').text
|
quality = fnode.find('./quality').text
|
||||||
abr = int(fnode.find('./audioBitrate').text) // 1000
|
abr = int(fnode.find('./audioBitrate').text) // 1000
|
||||||
vbr = int(fnode.find('./videoBitrate').text) // 1000
|
vbr_node = fnode.find('./videoBitrate')
|
||||||
|
vbr = None if vbr_node is None else int(vbr_node.text) // 1000
|
||||||
|
|
||||||
format_note = u''
|
width_node = fnode.find('./width')
|
||||||
|
width = None if width_node is None else int_or_none(width_node.text)
|
||||||
|
height_node = fnode.find('./height')
|
||||||
|
height = None if height_node is None else int_or_none(height_node.text)
|
||||||
|
|
||||||
|
format_note = ''
|
||||||
if not format_note:
|
if not format_note:
|
||||||
format_note = None
|
format_note = None
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'format_id': format_id + u'-' + quality,
|
'format_id': format_id + '-' + quality,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'ext': ext,
|
'ext': ext,
|
||||||
'acodec': format_m.group('acodec'),
|
'acodec': format_m.group('acodec'),
|
||||||
'vcodec': format_m.group('vcodec'),
|
'vcodec': format_m.group('vcodec'),
|
||||||
'abr': abr,
|
'abr': abr,
|
||||||
'vbr': vbr,
|
'vbr': vbr,
|
||||||
'width': int_or_none(fnode.find('./width').text),
|
'width': width,
|
||||||
'height': int_or_none(fnode.find('./height').text),
|
'height': height,
|
||||||
'filesize': int_or_none(fnode.find('./filesize').text),
|
'filesize': int_or_none(fnode.find('./filesize').text),
|
||||||
'format_note': format_note,
|
'format_note': format_note,
|
||||||
'protocol': proto,
|
'protocol': proto,
|
||||||
@ -103,9 +100,10 @@ class ZDFIE(InfoExtractor):
|
|||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
'formats': formats,
|
|
||||||
'description': description,
|
'description': description,
|
||||||
'uploader': uploader,
|
|
||||||
'duration': duration,
|
'duration': duration,
|
||||||
|
'uploader': uploader,
|
||||||
|
'uploader_id': uploader_id,
|
||||||
'upload_date': upload_date,
|
'upload_date': upload_date,
|
||||||
|
'formats': formats,
|
||||||
}
|
}
|
@ -779,6 +779,7 @@ def unified_strdate(date_str):
|
|||||||
'%Y-%m-%dT%H:%M:%S.%fZ',
|
'%Y-%m-%dT%H:%M:%S.%fZ',
|
||||||
'%Y-%m-%dT%H:%M:%S.%f0Z',
|
'%Y-%m-%dT%H:%M:%S.%f0Z',
|
||||||
'%Y-%m-%dT%H:%M:%S',
|
'%Y-%m-%dT%H:%M:%S',
|
||||||
|
'%Y-%m-%dT%H:%M:%S.%f',
|
||||||
'%Y-%m-%dT%H:%M',
|
'%Y-%m-%dT%H:%M',
|
||||||
]
|
]
|
||||||
for expression in format_expressions:
|
for expression in format_expressions:
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
|
|
||||||
__version__ = '2014.02.22.1'
|
__version__ = '2014.02.24'
|
||||||
|
Reference in New Issue
Block a user