[foolfuuka] add 'gallery' extractor (#1785)
This commit is contained in:
@@ -966,61 +966,61 @@ Consider all sites to be NSFW unless otherwise known.
|
||||
<tr>
|
||||
<td>4plebs</td>
|
||||
<td>https://archive.4plebs.org/</td>
|
||||
<td>Boards, Search Results, Threads</td>
|
||||
<td>Boards, Galleries, Search Results, Threads</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>arch.b4k.co</td>
|
||||
<td>https://arch.b4k.co/</td>
|
||||
<td>Boards, Search Results, Threads</td>
|
||||
<td>Boards, Galleries, Search Results, Threads</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Archive of Sins</td>
|
||||
<td>https://archiveofsins.com/</td>
|
||||
<td>Boards, Search Results, Threads</td>
|
||||
<td>Boards, Galleries, Search Results, Threads</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Archived.Moe</td>
|
||||
<td>https://archived.moe/</td>
|
||||
<td>Boards, Search Results, Threads</td>
|
||||
<td>Boards, Galleries, Search Results, Threads</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Desuarchive</td>
|
||||
<td>https://desuarchive.org/</td>
|
||||
<td>Boards, Search Results, Threads</td>
|
||||
<td>Boards, Galleries, Search Results, Threads</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Fireden</td>
|
||||
<td>https://boards.fireden.net/</td>
|
||||
<td>Boards, Search Results, Threads</td>
|
||||
<td>Boards, Galleries, Search Results, Threads</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Nyafuu Archive</td>
|
||||
<td>https://archive.nyafuu.org/</td>
|
||||
<td>Boards, Search Results, Threads</td>
|
||||
<td>Boards, Galleries, Search Results, Threads</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>RebeccaBlackTech</td>
|
||||
<td>https://rbt.asia/</td>
|
||||
<td>Boards, Search Results, Threads</td>
|
||||
<td>Boards, Galleries, Search Results, Threads</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>The /b/ Archive</td>
|
||||
<td>https://thebarchive.com/</td>
|
||||
<td>Boards, Search Results, Threads</td>
|
||||
<td>Boards, Galleries, Search Results, Threads</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Wakarimasen Archive</td>
|
||||
<td>https://archive.wakarimasen.moe/</td>
|
||||
<td>Boards, Search Results, Threads</td>
|
||||
<td>Boards, Galleries, Search Results, Threads</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
|
||||
@@ -273,3 +273,47 @@ class FoolfuukaSearchExtractor(FoolfuukaExtractor):
|
||||
if len(posts) <= 3:
|
||||
return
|
||||
params["page"] += 1
|
||||
|
||||
|
||||
class FoolfuukaGalleryExtractor(FoolfuukaExtractor):
|
||||
"""Base extractor for FoolFuuka galleries"""
|
||||
subcategory = "gallery"
|
||||
directory_fmt = ("{category}", "{board}", "gallery")
|
||||
pattern = BASE_PATTERN + r"/([^/?#]+)/gallery(?:/(\d+))?"
|
||||
test = (
|
||||
("https://archive.4plebs.org/tg/gallery/1"),
|
||||
("https://archived.moe/gd/gallery/2"),
|
||||
("https://archiveofsins.com/h/gallery/3"),
|
||||
("https://arch.b4k.co/meta/gallery/"),
|
||||
("https://desuarchive.org/a/gallery/5"),
|
||||
("https://boards.fireden.net/sci/gallery/6"),
|
||||
("https://archive.nyafuu.org/c/gallery/7"),
|
||||
("https://rbt.asia/g/gallery/8"),
|
||||
("https://thebarchive.com/b/gallery/9"),
|
||||
("https://archive.wakarimasen.moe/a/gallery/10"),
|
||||
)
|
||||
|
||||
def __init__(self, match):
|
||||
FoolfuukaExtractor.__init__(self, match)
|
||||
|
||||
board = match.group(match.lastindex)
|
||||
if board.isdecimal():
|
||||
self.board = match.group(match.lastindex-1)
|
||||
self.pages = (board,)
|
||||
else:
|
||||
self.board = board
|
||||
self.pages = map(format, itertools.count(1))
|
||||
|
||||
def metadata(self):
|
||||
return {"board": self.board}
|
||||
|
||||
def posts(self):
|
||||
base = "{}/_/api/chan/gallery/?board={}&page=".format(
|
||||
self.root, self.board)
|
||||
|
||||
for page in self.pages:
|
||||
with self.request(base + page) as response:
|
||||
posts = response.json()
|
||||
if not posts:
|
||||
return
|
||||
yield from posts
|
||||
|
||||
Reference in New Issue
Block a user