mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-03-09 12:50:23 -05:00
Move getting cookies before making first request
This commit is contained in:
parent
5143f916f3
commit
0a8b675da9
1 changed files with 2 additions and 1 deletions
|
@ -481,13 +481,14 @@ def _perform_login(self, username, password):
|
||||||
return
|
return
|
||||||
|
|
||||||
def _extract_from_url(self, url, video_id):
|
def _extract_from_url(self, url, video_id):
|
||||||
|
cookies = self._get_cookies(url) # Saving before making first request, as they might get discarded
|
||||||
|
|
||||||
webpage = self._download_webpage(
|
webpage = self._download_webpage(
|
||||||
url.replace('://m.facebook.com/', '://www.facebook.com/'), video_id)
|
url.replace('://m.facebook.com/', '://www.facebook.com/'), video_id)
|
||||||
|
|
||||||
sjs_data = [self._parse_json(j, video_id, fatal=False) for j in re.findall(
|
sjs_data = [self._parse_json(j, video_id, fatal=False) for j in re.findall(
|
||||||
r'data-sjs>({.*?ScheduledServerJS.*?})</script>', webpage)]
|
r'data-sjs>({.*?ScheduledServerJS.*?})</script>', webpage)]
|
||||||
|
|
||||||
cookies = self._get_cookies(url)
|
|
||||||
if cookies.get('c_user') and cookies.get('xs'): # user passed logged-in cookies or attempted to login:
|
if cookies.get('c_user') and cookies.get('xs'): # user passed logged-in cookies or attempted to login:
|
||||||
if get_first(sjs_data, (
|
if get_first(sjs_data, (
|
||||||
'require', ..., ..., ..., '__bbox', 'define',
|
'require', ..., ..., ..., '__bbox', 'define',
|
||||||
|
|
Loading…
Reference in a new issue