mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-01-07 17:16:08 +00:00
[vice] Modernize
This commit is contained in:
parent
65c2b21df1
commit
18ae46ad4b
|
@ -1,5 +1,4 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import re
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from .ooyala import OoyalaIE
|
from .ooyala import OoyalaIE
|
||||||
|
@ -7,7 +6,7 @@ from ..utils import ExtractorError
|
||||||
|
|
||||||
|
|
||||||
class ViceIE(InfoExtractor):
|
class ViceIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:.+?\.)?vice\.com/.*?/(?P<name>.+)'
|
_VALID_URL = r'https?://(?:.+?\.)?vice\.com/(?:[^/]+/)+(?P<id>.+)'
|
||||||
|
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
{
|
{
|
||||||
|
@ -28,9 +27,8 @@ class ViceIE(InfoExtractor):
|
||||||
]
|
]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
video_id = self._match_id(url)
|
||||||
name = mobj.group('name')
|
webpage = self._download_webpage(url, video_id)
|
||||||
webpage = self._download_webpage(url, name)
|
|
||||||
try:
|
try:
|
||||||
embed_code = self._search_regex(
|
embed_code = self._search_regex(
|
||||||
r'embedCode=([^&\'"]+)', webpage,
|
r'embedCode=([^&\'"]+)', webpage,
|
||||||
|
|
Loading…
Reference in a new issue