summaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/gofile.py
diff options
context:
space:
mode:
Diffstat (limited to 'gallery_dl/extractor/gofile.py')
-rw-r--r--gallery_dl/extractor/gofile.py48
1 files changed, 4 insertions, 44 deletions
diff --git a/gallery_dl/extractor/gofile.py b/gallery_dl/extractor/gofile.py
index 044dddb..3928792 100644
--- a/gallery_dl/extractor/gofile.py
+++ b/gallery_dl/extractor/gofile.py
@@ -4,6 +4,8 @@
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
+"""Extractors for https://gofile.io/"""
+
from .common import Extractor, Message
from .. import text, exception
from ..cache import cache, memcache
@@ -17,49 +19,7 @@ class GofileFolderExtractor(Extractor):
directory_fmt = ("{category}", "{name} ({code})")
archive_fmt = "{id}"
pattern = r"(?:https?://)?(?:www\.)?gofile\.io/d/([^/?#]+)"
- test = (
- ("https://gofile.io/d/k6BomI", {
- "pattern": r"https://store\d+\.gofile\.io/download"
- r"/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}"
- r"/test-%E3%83%86%E3%82%B9%E3%83%88-%2522%26!\.png",
- "keyword": {
- "createTime": int,
- "directLink": "re:https://store5.gofile.io/download/direct/.+",
- "downloadCount": int,
- "extension": "png",
- "filename": "test-テスト-%22&!",
- "folder": {
- "childs": [
- "b0367d79-b8ba-407f-8342-aaf8eb815443",
- "7fd4a36a-c1dd-49ff-9223-d93f7d24093f"
- ],
- "code": "k6BomI",
- "createTime": 1654076165,
- "id": "fafb59f9-a7c7-4fea-a098-b29b8d97b03c",
- "name": "root",
- "public": True,
- "totalDownloadCount": int,
- "totalSize": 182,
- "type": "folder"
- },
- "id": r"re:\w{8}-\w{4}-\w{4}-\w{4}-\w{12}",
- "link": r"re:https://store5.gofile.io/download/.+\.png",
- "md5": "re:[0-9a-f]{32}",
- "mimetype": "image/png",
- "name": "test-テスト-%22&!.png",
- "num": int,
- "parentFolder": "fafb59f9-a7c7-4fea-a098-b29b8d97b03c",
- "serverChoosen": "store5",
- "size": 182,
- "thumbnail": r"re:https://store5.gofile.io/download/.+\.png",
- "type": "file"
- },
- }),
- ("https://gofile.io/d/7fd4a36a-c1dd-49ff-9223-d93f7d24093f", {
- "options": (("website-token", None),),
- "content": "0c8768055e4e20e7c7259608b67799171b691140",
- }),
- )
+ example = "https://gofile.io/d/ID"
def __init__(self, match):
Extractor.__init__(self, match)
@@ -72,7 +32,7 @@ class GofileFolderExtractor(Extractor):
token = self.config("api-token")
if not token:
token = self._create_account()
- self.session.cookies.set("accountToken", token, domain=".gofile.io")
+ self.cookies.set("accountToken", token, domain=".gofile.io")
self.api_token = token
self.website_token = (self.config("website-token") or