mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-10 03:10:38 +00:00
parent
17b96974a3
commit
0da66980d3
@ -58,21 +58,18 @@ class GofileIE(InfoExtractor):
|
|||||||
return
|
return
|
||||||
|
|
||||||
account_data = self._download_json(
|
account_data = self._download_json(
|
||||||
'https://api.gofile.io/createAccount', None, note='Getting a new guest account')
|
'https://api.gofile.io/accounts', None, 'Getting a new guest account', data=b'{}')
|
||||||
self._TOKEN = account_data['data']['token']
|
self._TOKEN = account_data['data']['token']
|
||||||
self._set_cookie('.gofile.io', 'accountToken', self._TOKEN)
|
self._set_cookie('.gofile.io', 'accountToken', self._TOKEN)
|
||||||
|
|
||||||
def _entries(self, file_id):
|
def _entries(self, file_id):
|
||||||
query_params = {
|
query_params = {'wt': '4fd6sg89d7s6'} # From https://gofile.io/dist/js/alljs.js
|
||||||
'contentId': file_id,
|
|
||||||
'token': self._TOKEN,
|
|
||||||
'wt': '4fd6sg89d7s6', # From https://gofile.io/dist/js/alljs.js
|
|
||||||
}
|
|
||||||
password = self.get_param('videopassword')
|
password = self.get_param('videopassword')
|
||||||
if password:
|
if password:
|
||||||
query_params['password'] = hashlib.sha256(password.encode('utf-8')).hexdigest()
|
query_params['password'] = hashlib.sha256(password.encode('utf-8')).hexdigest()
|
||||||
files = self._download_json(
|
files = self._download_json(
|
||||||
'https://api.gofile.io/getContent', file_id, note='Getting filelist', query=query_params)
|
f'https://api.gofile.io/contents/{file_id}', file_id, 'Getting filelist',
|
||||||
|
query=query_params, headers={'Authorization': f'Bearer {self._TOKEN}'})
|
||||||
|
|
||||||
status = files['status']
|
status = files['status']
|
||||||
if status == 'error-passwordRequired':
|
if status == 'error-passwordRequired':
|
||||||
@ -82,7 +79,7 @@ class GofileIE(InfoExtractor):
|
|||||||
raise ExtractorError(f'{self.IE_NAME} said: status {status}', expected=True)
|
raise ExtractorError(f'{self.IE_NAME} said: status {status}', expected=True)
|
||||||
|
|
||||||
found_files = False
|
found_files = False
|
||||||
for file in (try_get(files, lambda x: x['data']['contents'], dict) or {}).values():
|
for file in (try_get(files, lambda x: x['data']['children'], dict) or {}).values():
|
||||||
file_type, file_format = file.get('mimetype').split('/', 1)
|
file_type, file_format = file.get('mimetype').split('/', 1)
|
||||||
if file_type not in ('video', 'audio') and file_format != 'vnd.mts':
|
if file_type not in ('video', 'audio') and file_format != 'vnd.mts':
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user