mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-08 08:21:26 +01:00
Compare commits
2 Commits
6ed31be53a
...
df359266c2
Author | SHA1 | Date | |
---|---|---|---|
|
df359266c2 | ||
|
46ea59c5e6 |
|
@ -1,3 +1,4 @@
|
||||||
|
import functools
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
@ -113,21 +114,15 @@ 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 = {}
|
|
||||||
|
|
||||||
def _get_headers(self):
|
@functools.cached_property
|
||||||
geo_verification_headers = self.geo_verification_headers()
|
def _headers(self):
|
||||||
http_headers = self.get_param('http_headers', {})
|
return {
|
||||||
headers = {**http_headers, **geo_verification_headers}
|
**self.geo_verification_headers(),
|
||||||
user_agent = headers.get('User-Agent', None)
|
'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',
|
||||||
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, *args, **kwargs):
|
def _real_initialize(self):
|
||||||
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']
|
||||||
|
|
Loading…
Reference in New Issue
Block a user