Browse Source
Merge remote-tracking branch 'origin/master'
Merge remote-tracking branch 'origin/master'
Conflicts: youtube_dl/YoutubeDL.pymaster
13 changed files with 246 additions and 34 deletions
Split View
Diff Options
-
32test/test_utils.py
-
5youtube_dl/YoutubeDL.py
-
4youtube_dl/downloader/f4m.py
-
2youtube_dl/extractor/__init__.py
-
44youtube_dl/extractor/adultswim.py
-
2youtube_dl/extractor/breakcom.py
-
38youtube_dl/extractor/gazeta.py
-
19youtube_dl/extractor/generic.py
-
90youtube_dl/extractor/pladform.py
-
6youtube_dl/extractor/teamcoco.py
-
7youtube_dl/extractor/twitch.py
-
6youtube_dl/extractor/vidme.py
-
25youtube_dl/utils.py
@ -0,0 +1,38 @@ |
|||
# coding: utf-8 |
|||
from __future__ import unicode_literals |
|||
|
|||
import re |
|||
|
|||
from .common import InfoExtractor |
|||
|
|||
|
|||
class GazetaIE(InfoExtractor): |
|||
_VALID_URL = r'(?P<url>https?://(?:www\.)?gazeta\.ru/(?:[^/]+/)?video/(?:(?:main|\d{4}/\d{2}/\d{2})/)?(?P<id>[A-Za-z0-9-_.]+)\.s?html)' |
|||
_TESTS = [{ |
|||
'url': 'http://www.gazeta.ru/video/main/zadaite_vopros_vladislavu_yurevichu.shtml', |
|||
'md5': 'd49c9bdc6e5a7888f27475dc215ee789', |
|||
'info_dict': { |
|||
'id': '205566', |
|||
'ext': 'mp4', |
|||
'title': '«70–80 процентов гражданских в Донецке на грани голода»', |
|||
'description': 'md5:38617526050bd17b234728e7f9620a71', |
|||
'thumbnail': 're:^https?://.*\.jpg', |
|||
}, |
|||
}, { |
|||
'url': 'http://www.gazeta.ru/lifestyle/video/2015/03/08/master-klass_krasivoi_byt._delaem_vesennii_makiyazh.shtml', |
|||
'only_matching': True, |
|||
}] |
|||
|
|||
def _real_extract(self, url): |
|||
mobj = re.match(self._VALID_URL, url) |
|||
|
|||
display_id = mobj.group('id') |
|||
embed_url = '%s?p=embed' % mobj.group('url') |
|||
embed_page = self._download_webpage( |
|||
embed_url, display_id, 'Downloading embed page') |
|||
|
|||
video_id = self._search_regex( |
|||
r'<div[^>]*?class="eagleplayer"[^>]*?data-id="([^"]+)"', embed_page, 'video id') |
|||
|
|||
return self.url_result( |
|||
'eagleplatform:gazeta.media.eagleplatform.com:%s' % video_id, 'EaglePlatform') |
@ -0,0 +1,90 @@ |
|||
# coding: utf-8 |
|||
from __future__ import unicode_literals |
|||
|
|||
from .common import InfoExtractor |
|||
from ..utils import ( |
|||
ExtractorError, |
|||
int_or_none, |
|||
xpath_text, |
|||
qualities, |
|||
) |
|||
|
|||
|
|||
class PladformIE(InfoExtractor): |
|||
_VALID_URL = r'''(?x) |
|||
https?:// |
|||
(?: |
|||
(?: |
|||
out\.pladform\.ru/player| |
|||
static\.pladform\.ru/player\.swf |
|||
) |
|||
\?.*\bvideoid=| |
|||
video\.pladform\.ru/catalog/video/videoid/ |
|||
) |
|||
(?P<id>\d+) |
|||
''' |
|||
_TESTS = [{ |
|||
# http://muz-tv.ru/kinozal/view/7400/ |
|||
'url': 'http://out.pladform.ru/player?pl=24822&videoid=100183293', |
|||
'md5': '61f37b575dd27f1bb2e1854777fe31f4', |
|||
'info_dict': { |
|||
'id': '100183293', |
|||
'ext': 'mp4', |
|||
'title': 'Тайны перевала Дятлова • Тайна перевала Дятлова 1 серия 2 часть', |
|||
'description': 'Документальный сериал-расследование одной из самых жутких тайн ХХ века', |
|||
'thumbnail': 're:^https?://.*\.jpg$', |
|||
'duration': 694, |
|||
'age_limit': 0, |
|||
}, |
|||
}, { |
|||
'url': 'http://static.pladform.ru/player.swf?pl=21469&videoid=100183293&vkcid=0', |
|||
'only_matching': True, |
|||
}, { |
|||
'url': 'http://video.pladform.ru/catalog/video/videoid/100183293/vkcid/0', |
|||
'only_matching': True, |
|||
}] |
|||
|
|||
def _real_extract(self, url): |
|||
video_id = self._match_id(url) |
|||
|
|||
video = self._download_xml( |
|||
'http://out.pladform.ru/getVideo?pl=1&videoid=%s' % video_id, |
|||
video_id) |
|||
|
|||
if video.tag == 'error': |
|||
raise ExtractorError( |
|||
'%s returned error: %s' % (self.IE_NAME, video.text), |
|||
expected=True) |
|||
|
|||
quality = qualities(('ld', 'sd', 'hd')) |
|||
|
|||
formats = [{ |
|||
'url': src.text, |
|||
'format_id': src.get('quality'), |
|||
'quality': quality(src.get('quality')), |
|||
} for src in video.findall('./src')] |
|||
self._sort_formats(formats) |
|||
|
|||
webpage = self._download_webpage( |
|||
'http://video.pladform.ru/catalog/video/videoid/%s' % video_id, |
|||
video_id) |
|||
|
|||
title = self._og_search_title(webpage, fatal=False) or xpath_text( |
|||
video, './/title', 'title', fatal=True) |
|||
description = self._search_regex( |
|||
r'</h3>\s*<p>([^<]+)</p>', webpage, 'description', fatal=False) |
|||
thumbnail = self._og_search_thumbnail(webpage) or xpath_text( |
|||
video, './/cover', 'cover') |
|||
|
|||
duration = int_or_none(xpath_text(video, './/time', 'duration')) |
|||
age_limit = int_or_none(xpath_text(video, './/age18', 'age limit')) |
|||
|
|||
return { |
|||
'id': video_id, |
|||
'title': title, |
|||
'description': description, |
|||
'thumbnail': thumbnail, |
|||
'duration': duration, |
|||
'age_limit': age_limit, |
|||
'formats': formats, |
|||
} |
Write
Preview
Loading…
Cancel
Save