Skip to content

Commit

Permalink
[hentaifoundry] add 'tag' extractor (#6465)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Nov 13, 2024
1 parent b62c466 commit a3276e3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/supportedsites.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ Consider all listed sites to potentially be NSFW.
<tr>
<td>Hentai Foundry</td>
<td>https://www.hentai-foundry.com/</td>
<td>Favorites, individual Images, Pictures, Popular Images, Recent Images, Scraps, Stories, User Profiles</td>
<td>Favorites, individual Images, Pictures, Popular Images, Recent Images, Scraps, Stories, Tag Searches, User Profiles</td>
<td></td>
</tr>
<tr>
Expand Down
16 changes: 16 additions & 0 deletions gallery_dl/extractor/hentaifoundry.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,22 @@ def __init__(self, match):
self.root, self.user)


class HentaifoundryTagExtractor(HentaifoundryExtractor):
"""Extractor for tag searches on hentaifoundry.com"""
subcategory = "tag"
directory_fmt = ("{category}", "{search_tags}")
archive_fmt = "t_{search_tags}_{index}"
pattern = BASE_PATTERN + r"/pictures/tagged/([^/?#]+)"
example = "https://www.hentai-foundry.com/pictures/tagged/TAG"

def __init__(self, match):
HentaifoundryExtractor.__init__(self, match)
self.page_url = "{}/pictures/tagged/{}".format(self.root, self.user)

def metadata(self):
return {"search_tags": self.user}


class HentaifoundryRecentExtractor(HentaifoundryExtractor):
"""Extractor for 'Recent Pictures' on hentaifoundry.com"""
subcategory = "recent"
Expand Down
12 changes: 12 additions & 0 deletions test/results/hentaifoundry.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,24 @@
"#class" : hentaifoundry.HentaifoundryFavoriteExtractor,
},

{
"#url" : "https://www.hentai-foundry.com/pictures/tagged/kancolle",
"#category": ("", "hentaifoundry", "tag"),
"#class" : hentaifoundry.HentaifoundryTagExtractor,
"#pattern" : r"https://pictures.hentai-foundry.com/[^/]/[^/?#]+/\d+/",
"#range" : "20-30",

"search_tags": "kancolle",
},

{
"#url" : "https://www.hentai-foundry.com/pictures/recent/2018-09-20",
"#category": ("", "hentaifoundry", "recent"),
"#class" : hentaifoundry.HentaifoundryRecentExtractor,
"#pattern" : r"https://pictures.hentai-foundry.com/[^/]/[^/?#]+/\d+/",
"#range" : "20-30",

"date": "2018-09-20",
},

{
Expand Down

0 comments on commit a3276e3

Please sign in to comment.