Skip to content

Commit

Permalink
[4archive] update
Browse files Browse the repository at this point in the history
  • Loading branch information
enduser420 committed Oct 25, 2023
1 parent c0714d5 commit acb713b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 6 additions & 5 deletions gallery_dl/extractor/4archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""Extractors for https://4archive.org/"""

from .common import Extractor, Message
from .. import text
from .. import text, util


class _4archiveThreadExtractor(Extractor):
Expand All @@ -17,8 +17,9 @@ class _4archiveThreadExtractor(Extractor):
directory_fmt = ("{category}", "{board}", "{thread} {title}")
filename_fmt = "{no} {filename}.{extension}"
archive_fmt = "{board}_{thread}_{no}"
pattern = r"(?:https?://)?4archive\.org/board/([^/?#]+)/thread/(\d+)"
root = "https://4archive.org"
referer = False
pattern = r"(?:https?://)?4archive\.org/board/([^/?#]+)/thread/(\d+)"
example = "https://4archive.org/board/a/thread/12345/"

def __init__(self, match):
Expand All @@ -37,8 +38,8 @@ def items(self):

for post in posts:
post.update(data)
post["time"] = text.parse_int(post["date"].timestamp())
yield Message.Directory, data
post["time"] = int(util.datetime_to_timestamp(post["date"]))
yield Message.Directory, post
if "url" in post:
yield Message.Url, post["url"], text.nameext_from_url(
post["filename"], post)
Expand Down Expand Up @@ -87,8 +88,8 @@ class _4archiveBoardExtractor(Extractor):
"""Extractor for 4archive boards"""
category = "4archive"
subcategory = "board"
pattern = r"(?:https?://)?4archive\.org/board/([^/?#]+)(?:/(\d+))?/?$"
root = "https://4archive.org"
pattern = r"(?:https?://)?4archive\.org/board/([^/?#]+)(?:/(\d+))?/?$"
example = "https://4archive.org/board/a/"

def __init__(self, match):
Expand Down
2 changes: 0 additions & 2 deletions test/results/4archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"#category": ("", "4archive", "board"),
"#class" : _4archive._4archiveBoardExtractor,
"#pattern" : _4archive._4archiveThreadExtractor.pattern,
"#board" : "u",
"#range" : "1-20",
"#count" : 20,
},
Expand All @@ -54,7 +53,6 @@
"#category": ("", "4archive", "board"),
"#class" : _4archive._4archiveBoardExtractor,
"#pattern" : _4archive._4archiveThreadExtractor.pattern,
"#board" : "jp",
"#range" : "1-50",
"#count" : 50,
}
Expand Down

0 comments on commit acb713b

Please sign in to comment.