Skip to content

Commit

Permalink
[e621] support e621.cc and e621.anthro.fr frontend URLs (#6809)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Jan 15, 2025
1 parent 843a39a commit 6e919a3
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/supportedsites.md
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,7 @@ Consider all listed sites to potentially be NSFW.
<tr>
<td>e621</td>
<td>https://e621.net/</td>
<td>Favorites, Pools, Popular Images, Posts, Tag Searches</td>
<td>Favorites, Pools, Popular Images, Posts, Tag Searches, Frontends</td>
<td>Supported</td>
</tr>
<tr>
Expand Down
19 changes: 18 additions & 1 deletion gallery_dl/extractor/e621.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

"""Extractors for https://e621.net/ and other e621 instances"""

from .common import Message
from .common import Extractor, Message
from . import danbooru
from ..cache import memcache
from .. import text, util
Expand Down Expand Up @@ -156,3 +156,20 @@ def metadata(self):

def posts(self):
return self._pagination("/favorites.json", self.query)


class E621FrontendExtractor(Extractor):
"""Extractor for alternative e621 frontends"""
basecategory = "E621"
category = "e621"
subcategory = "frontend"
pattern = r"(?:https?://)?e621\.(?:cc/\?tags|anthro\.fr/\?q)=([^&#]*)"
example = "https://e621.cc/?tags=TAG"

def initialize(self):
pass

def items(self):
url = "https://e621.net/posts?tags=" + self.groups[0]
data = {"_extractor": E621TagExtractor}
yield Message.Queue, url, data
3 changes: 3 additions & 0 deletions scripts/supportedsites.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,9 @@ def build_extractor_list():
default["wikifeetx"] = default["wikifeet"]
domains["wikifeetx"] = "https://www.wikifeetx.com/"

# add extra e621 extractors
categories["E621"]["e621"].extend(default.pop("e621", ()))

return categories, domains


Expand Down
25 changes: 25 additions & 0 deletions test/results/E621.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.

from gallery_dl.extractor import e621


__tests__ = (
{
"#url" : "https://e621.cc/?tags=rating:safe",
"#category": ("E621", "e621", "frontend"),
"#class" : e621.E621FrontendExtractor,
"#urls" : "https://e621.net/posts?tags=rating:safe",
},

{
"#url" : "https://e621.anthro.fr/?q=rating:safe",
"#category": ("E621", "e621", "frontend"),
"#class" : e621.E621FrontendExtractor,
"#urls" : "https://e621.net/posts?tags=rating:safe",
},

)

0 comments on commit 6e919a3

Please sign in to comment.