Compare commits

..

No commits in common. "df359266c2b402a5bfb9089a0ff37d53f9ba4212" and "6ed31be53adeb89b363d77ec5f54e1c41e1bc113" have entirely different histories.

View File

@ -1,4 +1,3 @@
import functools
import re import re
from .common import InfoExtractor from .common import InfoExtractor
@ -114,15 +113,21 @@ class VVVVIDIE(InfoExtractor):
'only_matching': True 'only_matching': True
}] }]
_conn_id = None _conn_id = None
_default_user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.50 Safari/537.37'
_blocked_user_agents_regex = r'^Mozilla/5\.0 \(Windows NT 10\.0; Win64; x64\) AppleWebKit/537\.36 \(KHTML, like Gecko\) Chrome/[\d.]+ Safari/537\.36$'
_headers = {}
@functools.cached_property def _get_headers(self):
def _headers(self): geo_verification_headers = self.geo_verification_headers()
return { http_headers = self.get_param('http_headers', {})
**self.geo_verification_headers(), headers = {**http_headers, **geo_verification_headers}
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.50 Safari/537.37', user_agent = headers.get('User-Agent', None)
} if not user_agent or re.match(self._blocked_user_agents_regex, user_agent):
headers['User-Agent'] = self._default_user_agent
return headers
def _real_initialize(self): def _real_initialize(self, *args, **kwargs):
self._headers = self._get_headers()
self._conn_id = self._download_json( self._conn_id = self._download_json(
'https://www.vvvvid.it/user/login', 'https://www.vvvvid.it/user/login',
None, headers=self._headers)['data']['conn_id'] None, headers=self._headers)['data']['conn_id']