[Gofile] Fix extraction (#3386)

Closes #3380
Authored by: mehq
This commit is contained in:
mehq 2022-04-11 10:29:19 +06:00 committed by GitHub
parent ca5300c7ed
commit fcdb8d6e88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,22 +19,25 @@ class GofileIE(InfoExtractor):
'id': 'de571ac1-5edc-42e2-8ec2-bdac83ad4a31', 'id': 'de571ac1-5edc-42e2-8ec2-bdac83ad4a31',
'filesize': 928116, 'filesize': 928116,
'ext': 'mp4', 'ext': 'mp4',
'title': 'nuuh' 'title': 'nuuh',
'release_timestamp': 1638338704,
'release_date': '20211201',
} }
}] }]
}, { # URL to test mixed file types }, {
'url': 'https://gofile.io/d/avt34h', 'url': 'https://gofile.io/d/is8lKr',
'info_dict': { 'info_dict': {
'id': 'avt34h', 'id': 'TMjXd9',
}, 'ext': 'mp4',
'playlist_mincount': 1,
}, { # URL to test no video/audio error
'url': 'https://gofile.io/d/aB03lZ',
'info_dict': {
'id': 'aB03lZ',
}, },
'playlist_count': 0, 'playlist_count': 0,
'skip': 'No video/audio found at provided URL.', 'skip': 'No video/audio found at provided URL.',
}, {
'url': 'https://gofile.io/d/TMjXd9',
'info_dict': {
'id': 'TMjXd9',
},
'playlist_count': 1,
}] }]
_TOKEN = None _TOKEN = None
@ -50,9 +53,11 @@ def _real_initialize(self):
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):
files = self._download_json( files = self._download_json('https://api.gofile.io/getContent', 'Gofile', note='Getting filelist', query={
f'https://api.gofile.io/getContent?contentId={file_id}&token={self._TOKEN}&websiteToken=websiteToken&cache=true', 'contentId': file_id,
'Gofile', note='Getting filelist') 'token': self._TOKEN,
'websiteToken': 12345,
})
status = files['status'] status = files['status']
if status != 'ok': if status != 'ok':
@ -65,7 +70,7 @@ def _entries(self, file_id):
continue continue
found_files = True found_files = True
file_url = file.get('directLink') file_url = file.get('link')
if file_url: if file_url:
yield { yield {
'id': file['id'], 'id': file['id'],