1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 02:32:33 +01:00

[furaffinity] add 'submissions' extractor (#5954)

This commit is contained in:
Mike Fährmann 2024-08-07 16:28:40 +02:00
parent b4733b7ea8
commit 846512f6cd
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
4 changed files with 47 additions and 1 deletions

View File

@ -250,7 +250,7 @@ Consider all listed sites to potentially be NSFW.
<tr>
<td>Fur Affinity</td>
<td>https://www.furaffinity.net/</td>
<td>Favorites, Followed Users, Galleries, Posts, Scraps, Search Results, User Profiles</td>
<td>Favorites, Followed Users, Galleries, Posts, Scraps, Search Results, New Submissions, User Profiles</td>
<td><a href="https://github.com/mikf/gallery-dl#cookies">Cookies</a></td>
</tr>
<tr>

View File

@ -335,3 +335,29 @@ class FuraffinityFollowingExtractor(FuraffinityExtractor):
if url.endswith(path):
return
url = self.root + path
class FuraffinitySubmissionsExtractor(FuraffinityExtractor):
"""Extractor for new furaffinity submissions"""
subcategory = "submissions"
pattern = BASE_PATTERN + r"(/msg/submissions(?:/[^/?#]+)?)"
example = "https://www.furaffinity.net/msg/submissions"
def posts(self):
self.user = None
url = self.root + self.groups[0]
return self._pagination_submissions(url)
def _pagination_submissions(self, url):
while True:
page = self.request(url).text
for post_id in text.extract_iter(page, 'id="sid-', '"'):
yield post_id
path = (text.extr(page, '<a class="button standard more" href="', '"') or # noqa 501
text.extr(page, '<a class="more-half" href="', '"') or
text.extr(page, '<a class="more" href="', '"'))
if not path:
return
url = self.root + text.unescape(path)

View File

@ -208,6 +208,9 @@ SUBCATEGORY_MAP = {
"fapello": {
"path": "Videos, Trending Posts, Popular Videos, Top Models",
},
"furaffinity": {
"submissions": "New Submissions",
},
"hatenablog": {
"archive": "Archive",
"entry" : "Individual Posts",

View File

@ -220,4 +220,21 @@ __tests__ = (
"#count" : 50,
},
{
"#url" : "https://www.furaffinity.net/msg/submissions",
"#category": ("", "furaffinity", "submissions"),
"#class" : furaffinity.FuraffinitySubmissionsExtractor,
"#auth" : True,
"#pattern" : r"https://d\d?\.f(uraffinity|acdn)\.net/art/mirlinthloth/\d+/\d+.\w+\.\w+",
"#range" : "45-50",
"#count" : 6,
},
{
"#url" : "https://www.furaffinity.net/msg/submissions/new~56789000@48/",
"#category": ("", "furaffinity", "submissions"),
"#class" : furaffinity.FuraffinitySubmissionsExtractor,
"#auth" : True,
},
)