mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-22 16:06:49 +00:00
Update extractor for current site behaviour
This commit is contained in:
parent
d4d99b1b51
commit
3525025a6f
@ -1,6 +1,8 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import base64
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
int_or_none,
|
int_or_none,
|
||||||
@ -12,8 +14,8 @@ from ..utils import (
|
|||||||
class VOEIE(InfoExtractor):
|
class VOEIE(InfoExtractor):
|
||||||
IE_NAME = 'voe'
|
IE_NAME = 'voe'
|
||||||
IE_DESC = 'VOE.SX'
|
IE_DESC = 'VOE.SX'
|
||||||
_VALID_URL = r'https?://voe\.sx/(e/)?(?P<id>[a-z0-9]+)'
|
_VALID_URL = r'https?://voe\.sx(?P<path>/(e/)?(?P<id>[a-z0-9]+))'
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
'url': 'https://voe.sx/e/ng7ja5n5n2y8',
|
'url': 'https://voe.sx/e/ng7ja5n5n2y8',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'ng7ja5n5n2y8',
|
'id': 'ng7ja5n5n2y8',
|
||||||
@ -21,29 +23,39 @@ class VOEIE(InfoExtractor):
|
|||||||
'thumbnail': r're:^https?://.*\.jpg$',
|
'thumbnail': r're:^https?://.*\.jpg$',
|
||||||
'ext': 'm3u8',
|
'ext': 'm3u8',
|
||||||
},
|
},
|
||||||
}
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id, video_path = self._match_valid_url(url).group('id', 'path')
|
||||||
|
|
||||||
webpage = self._download_webpage(
|
webpage = self._download_webpage(
|
||||||
'https://voe.sx/e/%s' % video_id, video_id)
|
'https://voe.sx/e/%s' % video_id, video_id)
|
||||||
|
|
||||||
sources = self._parse_json(
|
player_url = self._search_regex(
|
||||||
self._search_regex(r'\bsources\s*=\s*(\{[^}]+\})', webpage, 'sources'),
|
r'''("|')(?P<url>https://(?!voe\.sx/)[^/]+%s)\1\s*;''' % (path,),
|
||||||
video_id, transform_source=js_to_json)
|
webpage, 'redirect', group='url', default=None)
|
||||||
|
if player_url:
|
||||||
|
webpage = self._download_webpage(
|
||||||
|
player_url, video_id, note='Redirecting to player page')
|
||||||
|
|
||||||
|
|
||||||
|
sources = self._search_json(
|
||||||
|
r'\bsources\s*=', webpage, 'sources', video_id, transform_source=js_to_json)
|
||||||
|
|
||||||
title = self._search_regex(
|
title = self._search_regex(
|
||||||
r'<title>(?:Watch\s+)?(?P<title>.+?)(?:-\s+VOE\s+\|.+)?</title>',
|
r'<title>(?:Watch\s+)?(?P<title>.+?)(?:-\s+VOE\s+\|.+)?</title>',
|
||||||
webpage, 'title', group='title')
|
webpage, 'title', group='title')
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
|
for fmt in ('mp4, 'hls'):
|
||||||
f_url = url_or_none(sources.get('hls'))
|
if fmt not in sources:
|
||||||
|
continue
|
||||||
|
sources[fmt] = url_or_none(sources['fmt']) or url_or_none(base64.b64decode(sources['fmt']))
|
||||||
|
f_url = sources.get('hls')
|
||||||
if f_url:
|
if f_url:
|
||||||
formats.extend(self._extract_m3u8_formats(
|
formats.extend(self._extract_m3u8_formats(
|
||||||
f_url, video_id, entry_protocol='m3u8_native', fatal=False))
|
f_url, video_id, entry_protocol='m3u8_native', fatal=False))
|
||||||
f_url = url_or_none(sources.get('mp4'))
|
f_url = sources.get('mp4')
|
||||||
if f_url:
|
if f_url:
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': f_url,
|
'url': f_url,
|
||||||
@ -54,7 +66,7 @@ class VOEIE(InfoExtractor):
|
|||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
thumbnail = url_or_none(self._search_regex(
|
thumbnail = url_or_none(self._search_regex(
|
||||||
r'(?:VOEPlayer.|data-)poster\s*=\s*(["\'])(?P<thumbnail>(?:(?!\1)\S)+)\1',
|
r'''(?:VOEPlayer\s*\.\s*|data-)poster\s*=\s*("|')(?P<thumbnail>(?:(?!\1)\S)+)\1''',
|
||||||
webpage, 'thumbnail', group='thumbnail', default=None))
|
webpage, 'thumbnail', group='thumbnail', default=None))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user