1
0
Fork 0
mirror of https://gitlab.com/dstftw/youtube-dl.git synced 2020-11-16 09:42:26 +00:00

[smotri:broadcast] Fix extraction (closes #16180)

This commit is contained in:
Sergey M․ 2018-04-16 00:54:21 +07:00
parent a42839e548
commit c07cb68e79
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D

View file

@ -310,6 +310,7 @@ class SmotriBroadcastIE(InfoExtractor):
IE_DESC = 'Smotri.com broadcasts' IE_DESC = 'Smotri.com broadcasts'
IE_NAME = 'smotri:broadcast' IE_NAME = 'smotri:broadcast'
_VALID_URL = r'https?://(?:www\.)?(?P<url>smotri\.com/live/(?P<id>[^/]+))/?.*' _VALID_URL = r'https?://(?:www\.)?(?P<url>smotri\.com/live/(?P<id>[^/]+))/?.*'
_NETRC_MACHINE = 'smotri'
def _real_extract(self, url): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url) mobj = re.match(self._VALID_URL, url)
@ -352,17 +353,18 @@ class SmotriBroadcastIE(InfoExtractor):
adult_content = False adult_content = False
ticket = self._html_search_regex( ticket = self._html_search_regex(
r"window\.broadcast_control\.addFlashVar\('file'\s*,\s*'([^']+)'\)", (r'data-user-file=(["\'])(?P<ticket>(?!\1).+)\1',
broadcast_page, 'broadcast ticket') r"window\.broadcast_control\.addFlashVar\('file'\s*,\s*'(?P<ticket>[^']+)'\)"),
broadcast_page, 'broadcast ticket', group='ticket')
url = 'http://smotri.com/broadcast/view/url/?ticket=%s' % ticket broadcast_url = 'http://smotri.com/broadcast/view/url/?ticket=%s' % ticket
broadcast_password = self._downloader.params.get('videopassword') broadcast_password = self._downloader.params.get('videopassword')
if broadcast_password: if broadcast_password:
url += '&pass=%s' % hashlib.md5(broadcast_password.encode('utf-8')).hexdigest() broadcast_url += '&pass=%s' % hashlib.md5(broadcast_password.encode('utf-8')).hexdigest()
broadcast_json_page = self._download_webpage( broadcast_json_page = self._download_webpage(
url, broadcast_id, 'Downloading broadcast JSON') broadcast_url, broadcast_id, 'Downloading broadcast JSON')
try: try:
broadcast_json = json.loads(broadcast_json_page) broadcast_json = json.loads(broadcast_json_page)