mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 02:32:33 +01:00
merge #6115: [inkbunny:favorite] update default directory
- extract 'favs_username' metadata - store files in 'favs_username' directory
This commit is contained in:
commit
e8c5b57a33
@ -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 = {
|
||||
|
@ -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",
|
||||
},
|
||||
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user