[fikfap] add 'hashtag' extractor (#9018)

Added functionality to extract by hashtag and save to directory named after the hashtag.
This commit is contained in:
wise-immersion
2026-02-08 10:42:48 +00:00
committed by GitHub
parent 5d9b607158
commit a8636e75a1
3 changed files with 38 additions and 6 deletions

View File

@@ -103,3 +103,25 @@ class FikfapUserExtractor(FikfapExtractor):
if len(data) < 21:
return
params["afterId"] = data[-1]["postId"]
class FikfapHashtagExtractor(FikfapExtractor):
subcategory = "hashtag"
directory_fmt = ("{category}", "{hashtag}")
pattern = BASE_PATTERN + r"/hash/([\w-]+)"
example = "https://fikfap.com/hash/HASH"
def posts(self):
self.kwdict["hashtag"] = hashtag = self.groups[0]
url = f"{self.root_api}/hashtags/label/{hashtag}/posts"
params = {"amount": "21"}
while True:
data = self.request_api(url, params)
yield from data
if len(data) < 21:
return
params["afterId"] = data[-1]["postId"]