Changed to use _smuggle_referer

Removed `std_headers` import to satisfy flake8
This commit is contained in:
KatDestroyer 2022-02-25 15:56:36 +01:00 committed by dirkf
parent 41290c1ccc
commit 457f046c3c
2 changed files with 11 additions and 7 deletions

View File

@ -2,7 +2,7 @@
from __future__ import unicode_literals
from .common import InfoExtractor
from .vimeo import VHXEmbedIE
from .vimeo import VHXEmbedIE, VimeoIE
from ..utils import (
clean_html,
ExtractorError,
@ -11,8 +11,7 @@ from ..utils import (
get_elements_by_class,
int_or_none,
unified_strdate,
urlencode_postdata,
std_headers
urlencode_postdata
)
@ -139,8 +138,6 @@ class DropoutIE(InfoExtractor):
raise ExtractorError('Incorrect username/password')
def _real_extract(self, url):
std_headers['Referer'] = 'https://www.dropout.tv' # See issue 2858
display_id = self._match_id(url)
try:
logged_in = self._login(display_id)
@ -166,7 +163,7 @@ class DropoutIE(InfoExtractor):
return {
'_type': 'url_transparent',
'ie_key': VHXEmbedIE.ie_key(),
'url': embed_url,
'url': VimeoIE._smuggle_referrer(embed_url, 'https://www.dropout.tv'),
'id': self._search_regex(r'embed.vhx.tv/videos/(.+?)\?', embed_url, 'id'),
'display_id': display_id,
'title': title,

View File

@ -1146,8 +1146,15 @@ class VHXEmbedIE(VimeoBaseInfoExtractor):
return unescapeHTML(mobj.group(1)) if mobj else None
def _real_extract(self, url):
url, data = unsmuggle_url(url, {})
headers = std_headers.copy()
if 'http_headers' in data:
headers.update(data['http_headers'])
if 'Referer' not in headers:
headers['Referer'] = url
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
webpage = self._download_webpage(url, video_id, headers=headers)
config_url = self._parse_json(self._search_regex(
r'window\.OTTData\s*=\s*({.+})', webpage,
'ott data'), video_id, js_to_json)['config_url']