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

merge #6115: [inkbunny:favorite] update default directory

- extract 'favs_username' metadata
- store files in 'favs_username' directory
This commit is contained in:
Mike Fährmann 2024-09-25 20:28:14 +02:00
commit e8c5b57a33
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 14 additions and 2 deletions

View File

@ -132,6 +132,7 @@ class InkbunnyPoolExtractor(InkbunnyExtractor):
class InkbunnyFavoriteExtractor(InkbunnyExtractor):
"""Extractor for inkbunny user favorites"""
subcategory = "favorite"
directory_fmt = ("{category}", "{favs_username!l}", "Favorites")
pattern = (BASE_PATTERN + r"/(?:"
r"userfavorites_process\.php\?favs_user_id=(\d+)|"
r"submissionsviewall\.php"
@ -151,7 +152,17 @@ class InkbunnyFavoriteExtractor(InkbunnyExtractor):
self.orderby = params.get("orderby", "fav_datetime")
def metadata(self):
return {"favs_user_id": self.user_id}
# Lookup fav user ID as username
url = "{}/userfavorites_process.php?favs_user_id={}".format(
self.root, self.user_id)
page = self.request(url).text
user_link = text.extr(page, '<a rel="author"', '</a>')
favs_username = text.extr(user_link, 'href="/', '"')
return {
"favs_user_id": self.user_id,
"favs_username": favs_username,
}
def posts(self):
params = {

View File

@ -91,7 +91,8 @@ __tests__ = (
"#pattern" : r"https://[\w.]+\.metapix\.net/files/full/\d+/\d+_\w+_.+",
"#range" : "20-50",
"favs_user_id": "20969",
"favs_user_id" : "20969",
"favs_username": "soina",
},
{