diff options
author | Jesús <heckyel@hyperbola.info> | 2022-05-17 10:10:39 +0800 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2022-05-17 10:10:39 +0800 |
commit | 4bbf329feb5a820ac21269fa426c95ca14d7af25 (patch) | |
tree | 2c147a162b4bddc7862ed5895f1f66edd9a675e8 /yt_dlp/extractor/gofile.py | |
parent | e21342911839b7796a5c788a7c3f13b06d975c64 (diff) | |
parent | 5faf6528fb701724ac32e0a487f92281c7800bda (diff) | |
download | hypervideo-pre-4bbf329feb5a820ac21269fa426c95ca14d7af25.tar.lz hypervideo-pre-4bbf329feb5a820ac21269fa426c95ca14d7af25.tar.xz hypervideo-pre-4bbf329feb5a820ac21269fa426c95ca14d7af25.zip |
updated from upstream | 17/05/2022 at 10:10
Diffstat (limited to 'yt_dlp/extractor/gofile.py')
-rw-r--r-- | yt_dlp/extractor/gofile.py | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/yt_dlp/extractor/gofile.py b/yt_dlp/extractor/gofile.py index 858bac52c..ddbce2ee8 100644 --- a/yt_dlp/extractor/gofile.py +++ b/yt_dlp/extractor/gofile.py @@ -1,4 +1,5 @@ -# coding: utf-8 +import hashlib + from .common import InfoExtractor from ..utils import ( ExtractorError, @@ -38,6 +39,15 @@ class GofileIE(InfoExtractor): 'id': 'TMjXd9', }, 'playlist_count': 1, + }, { + 'url': 'https://gofile.io/d/gqOtRf', + 'info_dict': { + 'id': 'gqOtRf', + }, + 'playlist_mincount': 1, + 'params': { + 'videopassword': 'password', + }, }] _TOKEN = None @@ -53,14 +63,22 @@ class GofileIE(InfoExtractor): self._set_cookie('gofile.io', 'accountToken', self._TOKEN) def _entries(self, file_id): - files = self._download_json('https://api.gofile.io/getContent', 'Gofile', note='Getting filelist', query={ + query_params = { 'contentId': file_id, 'token': self._TOKEN, 'websiteToken': 12345, - }) + } + password = self.get_param('videopassword') + if password: + query_params['password'] = hashlib.sha256(password.encode('utf-8')).hexdigest() + files = self._download_json( + 'https://api.gofile.io/getContent', file_id, note='Getting filelist', query=query_params) status = files['status'] - if status != 'ok': + if status == 'error-passwordRequired': + raise ExtractorError( + 'This video is protected by a password, use the --video-password option', expected=True) + elif status != 'ok': raise ExtractorError(f'{self.IE_NAME} said: status {status}', expected=True) found_files = False |