mikf / gallery-dl

Command-line program to download image galleries and collections from several image hosting sites
GNU General Public License v2.0
11.93k stars 975 forks source link

[FurAffinity] Add username_url keyword #821

Closed espressoelf closed 4 years ago

espressoelf commented 4 years ago

Currently, gallery-dl only lists the real username, but not the username used in urls, i.e. https://www.furaffinity.net/gallery/[username_url]/. While the difference isn't huge (mostly lower-case and underscores stripped), I'd prefer using the url-version of the username for folders.

Example: https://www.furaffinity.net/user/rabidfairy/ username is Rabid_Fairy, username_url would be rabidfairy

I'd use the avatar section for getting it.

Example image: https://www.furaffinity.net/view/36738425/ Example image from a user without a custom avatar: https://www.furaffinity.net/view/36712627/

Old layout:

<div class="classic-submissiont-title avatar">
    <a href="/user/maebuns/"><img class="avatar" alt="maebuns" src="//a.facdn.net/1591749344/maebuns.gif"></a>
</div>

New layout:

<div class="submission-id-avatar">
    <a href="/user/maebuns/"><img class="submission-user-icon floatleft avatar" src="//a.facdn.net/1591749344/maebuns.gif"></a>
</div>

Thanks for your consideration.

mikf commented 4 years ago

You can transform a real username into a url username with the not too well documented formatting options, i.e. {user!l:R_//} to lowercase the name !l and replace all underscores with an empty string R_//.

Furaffinity usernames can only consist of letter, digits, and -_~. as special characters and only underscores get removed in URLs it seems.

espressoelf commented 4 years ago

Sounds like a good workaround, I'll try that, thank you. A variable for that would still by very appreciated, if you find the time.

Another question about string manipulation: since I'm downloading faves from many artists, I started putting them in subfolders of the first letter, i.e. images from rabidfairy would be saved in ./gallery-dl/furaffinity/r/rabidfairy/ - how do I achieve that?

mikf commented 4 years ago

{user[0]} to access the first character in user, and you can combine this with lowercasing and replacing operations if needed. You can also do slicing: {user[2:5]}

espressoelf commented 4 years ago
"directory": ["{artist[0]!l}", "{artist!l:R_//}"],
"filename": "{filename}.{extension}"

Does the trick for now, thanks for your support! If you want, you can close this issue now - or later if you plan to implement the initial suggestion.

Time to retire my own script and replace it with gallery-dl. <3