1
0
mirror of https://github.com/l1ving/youtube-dl synced 2020-11-18 19:53:54 -08:00

Improved code based on review.

This commit is contained in:
Daniel Höpfl 2019-02-15 07:28:24 +01:00
parent 4b99952e6c
commit 0b0b0cf4d7

View File

@ -2,16 +2,15 @@ from __future__ import unicode_literals
import re import re
from .common import ( from .common import InfoExtractor
InfoExtractor,
unescapeHTML
)
from ..compat import compat_b64decode from ..compat import compat_b64decode
from ..utils import ( from ..utils import (
ExtractorError, ExtractorError,
int_or_none, int_or_none,
url_or_none, url_or_none,
urlencode_postdata, urlencode_postdata,
unescapeHTML,
extract_attributes,
) )
@ -95,12 +94,10 @@ class VivoIE(SharedBaseIE):
} }
def _extract_title(self, webpage): def _extract_title(self, webpage):
data_title = self._search_regex( stream_content = extract_attributes(self._search_regex(
r'data-name\s*=\s*(["\'])(?P<title>(?:.(?!\1))*.)\1', webpage, r'(<div[^>]+class="[^"]*stream-content[^"]*"[^>]*>)',
'title', default=None, group='title') webpage, 'stream-content element'))
if data_title: return stream_content['data-name'] or self._og_search_title(webpage)
return unescapeHTML(re.sub(r"\.[a-z0-9]{3,4}$", "", data_title))
return None
def _extract_video_url(self, webpage, video_id, *args): def _extract_video_url(self, webpage, video_id, *args):
def decode_url(encoded_url): def decode_url(encoded_url):