mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-30 07:38:18 +01:00
[vice] Fix extraction for non en_us videos (closes #12967)
This commit is contained in:
parent
50ad078b7b
commit
cc7bda4fff
|
@ -1,6 +1,7 @@
|
||||||
version <unreleased>
|
version <unreleased>
|
||||||
|
|
||||||
Extractors
|
Extractors
|
||||||
|
* [vice] Fix extraction for non en_us videos (#12967)
|
||||||
* [gdcvault] Fix extraction for some videos (#12733)
|
* [gdcvault] Fix extraction for some videos (#12733)
|
||||||
+ [cda] Support birthday verification (#12789)
|
+ [cda] Support birthday verification (#12789)
|
||||||
* [leeco] Fix extraction (#12974)
|
* [leeco] Fix extraction (#12974)
|
||||||
|
|
|
@ -20,7 +20,7 @@ from ..utils import (
|
||||||
|
|
||||||
|
|
||||||
class ViceBaseIE(AdobePassIE):
|
class ViceBaseIE(AdobePassIE):
|
||||||
def _extract_preplay_video(self, url, webpage):
|
def _extract_preplay_video(self, url, locale, webpage):
|
||||||
watch_hub_data = extract_attributes(self._search_regex(
|
watch_hub_data = extract_attributes(self._search_regex(
|
||||||
r'(?s)(<watch-hub\s*.+?</watch-hub>)', webpage, 'watch hub'))
|
r'(?s)(<watch-hub\s*.+?</watch-hub>)', webpage, 'watch hub'))
|
||||||
video_id = watch_hub_data['vms-id']
|
video_id = watch_hub_data['vms-id']
|
||||||
|
@ -45,7 +45,7 @@ class ViceBaseIE(AdobePassIE):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
host = 'www.viceland' if is_locked else self._PREPLAY_HOST
|
host = 'www.viceland' if is_locked else self._PREPLAY_HOST
|
||||||
preplay = self._download_json('https://%s.com/en_us/preplay/%s' % (host, video_id), video_id, query=query)
|
preplay = self._download_json('https://%s.com/%s/preplay/%s' % (host, locale, video_id), video_id, query=query)
|
||||||
except ExtractorError as e:
|
except ExtractorError as e:
|
||||||
if isinstance(e.cause, compat_HTTPError) and e.cause.code == 400:
|
if isinstance(e.cause, compat_HTTPError) and e.cause.code == 400:
|
||||||
error = json.loads(e.cause.read().decode())
|
error = json.loads(e.cause.read().decode())
|
||||||
|
@ -88,7 +88,7 @@ class ViceBaseIE(AdobePassIE):
|
||||||
|
|
||||||
|
|
||||||
class ViceIE(ViceBaseIE):
|
class ViceIE(ViceBaseIE):
|
||||||
_VALID_URL = r'https?://(?:.+?\.)?vice\.com/(?:[^/]+/)?videos?/(?P<id>[^/?#&]+)'
|
_VALID_URL = r'https?://(?:.+?\.)?vice\.com/(?P<locale>[^/]+/)(?:[^/]+/)?videos?/(?P<id>[^/?#&]+)'
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://www.vice.com/video/cowboy-capitalists-part-1',
|
'url': 'http://www.vice.com/video/cowboy-capitalists-part-1',
|
||||||
|
@ -115,20 +115,39 @@ class ViceIE(ViceBaseIE):
|
||||||
'add_ie': ['Youtube'],
|
'add_ie': ['Youtube'],
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://video.vice.com/en_us/video/the-signal-from-tolva/5816510690b70e6c5fd39a56',
|
'url': 'https://video.vice.com/en_us/video/the-signal-from-tolva/5816510690b70e6c5fd39a56',
|
||||||
'md5': '',
|
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '5816510690b70e6c5fd39a56',
|
'id': '5816510690b70e6c5fd39a56',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'uploader': 'Waypoint',
|
'uploader': 'Waypoint',
|
||||||
'title': 'The Signal From Tölva',
|
'title': 'The Signal From Tölva',
|
||||||
|
'description': 'md5:3927e3c79f9e8094606a2b3c5b5e55d5',
|
||||||
'uploader_id': '57f7d621e05ca860fa9ccaf9',
|
'uploader_id': '57f7d621e05ca860fa9ccaf9',
|
||||||
'timestamp': 1477941983938,
|
'timestamp': 1477941983,
|
||||||
|
'upload_date': '20161031',
|
||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
# m3u8 download
|
# m3u8 download
|
||||||
'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
'add_ie': ['UplynkPreplay'],
|
'add_ie': ['UplynkPreplay'],
|
||||||
|
}, {
|
||||||
|
'url': 'https://video.vice.com/alps/video/ulfs-wien-beruchtigste-grafitti-crew-part-1/581b12b60a0e1f4c0fb6ea2f',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '581b12b60a0e1f4c0fb6ea2f',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'ULFs - Wien berüchtigste Grafitti Crew - Part 1',
|
||||||
|
'description': '<p>Zwischen Hinterzimmer-Tattoos und U-Bahnschächten erzählen uns die Ulfs, wie es ist, "süchtig nach Sachbeschädigung" zu sein.</p>',
|
||||||
|
'uploader': 'VICE',
|
||||||
|
'uploader_id': '57a204088cb727dec794c67b',
|
||||||
|
'timestamp': 1485368119,
|
||||||
|
'upload_date': '20170125',
|
||||||
|
'age_limit': 14,
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
# AES-encrypted m3u8
|
||||||
|
'skip_download': True,
|
||||||
|
},
|
||||||
|
'add_ie': ['UplynkPreplay'],
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://news.vice.com/video/experimenting-on-animals-inside-the-monkey-lab',
|
'url': 'https://news.vice.com/video/experimenting-on-animals-inside-the-monkey-lab',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
|
@ -142,6 +161,9 @@ class ViceIE(ViceBaseIE):
|
||||||
_PREPLAY_HOST = 'video.vice'
|
_PREPLAY_HOST = 'video.vice'
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
locale = mobj.group('locale')
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage, urlh = self._download_webpage_handle(url, video_id)
|
webpage, urlh = self._download_webpage_handle(url, video_id)
|
||||||
embed_code = self._search_regex(
|
embed_code = self._search_regex(
|
||||||
|
@ -153,7 +175,7 @@ class ViceIE(ViceBaseIE):
|
||||||
r'data-youtube-id="([^"]+)"', webpage, 'youtube id', default=None)
|
r'data-youtube-id="([^"]+)"', webpage, 'youtube id', default=None)
|
||||||
if youtube_id:
|
if youtube_id:
|
||||||
return self.url_result(youtube_id, 'Youtube')
|
return self.url_result(youtube_id, 'Youtube')
|
||||||
return self._extract_preplay_video(urlh.geturl(), webpage)
|
return self._extract_preplay_video(urlh.geturl(), locale, webpage)
|
||||||
|
|
||||||
|
|
||||||
class ViceShowIE(InfoExtractor):
|
class ViceShowIE(InfoExtractor):
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
from .vice import ViceBaseIE
|
from .vice import ViceBaseIE
|
||||||
|
|
||||||
|
|
||||||
class VicelandIE(ViceBaseIE):
|
class VicelandIE(ViceBaseIE):
|
||||||
_VALID_URL = r'https?://(?:www\.)?viceland\.com/[^/]+/video/[^/]+/(?P<id>[a-f0-9]+)'
|
_VALID_URL = r'https?://(?:www\.)?viceland\.com/(?P<locale>[^/]+)/video/[^/]+/(?P<id>[a-f0-9]+)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'https://www.viceland.com/en_us/video/trapped/588a70d0dba8a16007de7316',
|
'url': 'https://www.viceland.com/en_us/video/trapped/588a70d0dba8a16007de7316',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
|
@ -24,10 +26,13 @@ class VicelandIE(ViceBaseIE):
|
||||||
'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
'add_ie': ['UplynkPreplay'],
|
'add_ie': ['UplynkPreplay'],
|
||||||
|
'skip': '404',
|
||||||
}
|
}
|
||||||
_PREPLAY_HOST = 'www.viceland'
|
_PREPLAY_HOST = 'www.viceland'
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
locale = mobj.group('locale')
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
return self._extract_preplay_video(url, webpage)
|
return self._extract_preplay_video(url, locale, webpage)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user