mirror of
https://github.com/Radiquum/furaffinity-dl.git
synced 2025-04-05 07:44:37 +00:00
FurAffinity added ReCaptcha that we cannot meaninfully present to the user. Drop password-based authentication and require the user to dump cookies from a web browser instead.
This commit is contained in:
parent
f236e84e82
commit
5eae15966d
2 changed files with 24 additions and 27 deletions
|
@ -10,7 +10,7 @@ I'd like to eventually expand it to download the description pages as well. Patc
|
|||
Coreutils, bash and wget are the only dependencies.
|
||||
|
||||
furaffinity-dl was tested only on Linux. It should also work on Mac and BSDs.
|
||||
Windows users can probably get it to work via Cygwin, but running a virtual machine with Linux might be simpler.
|
||||
Windows users can probably get it to work via Cygwin or Microsoft's "BASH on Windows", but running a virtual machine with Linux might be simpler.
|
||||
|
||||
## Usage
|
||||
`furaffinity-dl section/username`
|
||||
|
@ -24,11 +24,9 @@ All files from the given section and user will be downloaded to the current dire
|
|||
|
||||
`furaffinity-dl favorites/kivuli`
|
||||
|
||||
You can also log in to FurAffinity and download restricted content, like this:
|
||||
You can also log in to download restricted content. To do that, log in to FurAffinity in your web browser, export cookies to a file from your web browser in Netscape format (there are extensions to do that [for Firefox](https://addons.mozilla.org/en-US/firefox/addon/export-cookies/) and [for Chrome/Vivaldi](https://addons.mozilla.org/en-US/firefox/addon/export-cookies/)) and pass them to the script as a second parameter, like this:
|
||||
|
||||
`furaffinity-dl gallery/mithril07 your_username_here`
|
||||
|
||||
In this case you will be prompted for your password. It will not be displayed on the screen as you type it!
|
||||
`furaffinity-dl gallery/gonnaneedabiggerboat /path/to/your/cookies.txt`
|
||||
|
||||
## TODO
|
||||
* Download author's description of the artwork, and ideally the entire description page along with user comments
|
||||
|
|
|
@ -11,47 +11,29 @@ Examples:
|
|||
$0 favorites/kivuli
|
||||
|
||||
You can also log in to FurAffinity and download restricted content, like this:
|
||||
$0 gallery/mithril07 your_username_here"
|
||||
$0 gallery/gonnaneedabiggerboat /path/to/your/cookies.txt"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
runtime_dir="$HOME"'/.cache/furaffinity-dl'
|
||||
# umask makes any new files created only readable by the owner.
|
||||
# It is necessary to store cookies securely
|
||||
(umask u=rwx,g=,o= && mkdir -p "$runtime_dir")
|
||||
tempfile="$(umask u=rwx,g=,o= && mktemp --tmpdir=$runtime_dir)"
|
||||
cookies_file="$(umask u=rwx,g=,o= && mktemp --tmpdir=$runtime_dir)"
|
||||
|
||||
cleanup() {
|
||||
rm -f "$tempfile"
|
||||
rm -f "$cookies_file"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
LOGIN_NAME="$2"
|
||||
if [ "$LOGIN_NAME" = "" ]; then
|
||||
COOKIES_FILE="$2"
|
||||
if [ "$COOKIES_FILE" = "" ]; then
|
||||
# set a wget wrapper with custom user agent
|
||||
fwget() {
|
||||
wget --user-agent="Mozilla/5.0 furaffinity-dl (https://github.com/Shnatsel/furaffinity-dl)" $*
|
||||
}
|
||||
else
|
||||
# prompt the user for their password
|
||||
read -r -s -e -p "Password for $LOGIN_NAME (will not be displayed): " PASSWORD
|
||||
|
||||
# log in to FurAffinity
|
||||
wget --user-agent="Mozilla/5.0 furaffinity-dl (https://github.com/Shnatsel/furaffinity-dl)" \
|
||||
--referer="https://www.furaffinity.net/login/" \
|
||||
--save-cookies "$cookies_file" \
|
||||
--post-data "action=login&retard_protection=1&name=$LOGIN_NAME&pass=$PASSWORD&login=Login+to%C2%A0FurAffinity" \
|
||||
-O - "https://www.furaffinity.net/login/" | grep "erroneous username or password" && {
|
||||
echo "Wrong password for user $LOGIN_NAME. Aborted." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# set a wget wrapper with custom user agent and cookies
|
||||
fwget() {
|
||||
wget --user-agent="Mozilla/5.0 furaffinity-dl (https://github.com/Shnatsel/furaffinity-dl)" \
|
||||
--load-cookies "$cookies_file" $*
|
||||
--load-cookies "$COOKIES_FILE" $*
|
||||
}
|
||||
fi
|
||||
|
||||
|
@ -63,6 +45,23 @@ page_counter=1
|
|||
# Iterate over the gallery pages with thumbnails and links to artwork view pages
|
||||
while true; do
|
||||
fwget -O "$tempfile" "$url"
|
||||
if grep -q 'furaffinity.net/login/' "$tempfile"; then
|
||||
echo "--------------
|
||||
|
||||
ERROR: You have provided a cookies file, but it does not contain valid cookies.
|
||||
|
||||
If this file used to work, this means that the cookies have expired;
|
||||
you will have to log in to FurAffinity from your web browser and export the cookies again.
|
||||
|
||||
If this is the first time you're trying to use cookies, make sure you have exported them
|
||||
in Netscape format (this is normally done through \"cookie export\" browser extensions)
|
||||
and supplied the correct path to the cookies.txt file to this script.
|
||||
|
||||
If that doesn't resolve the issue, please report the problem at
|
||||
https://github.com/Shnatsel/furaffinity-dl/issues" >&2
|
||||
exit 1
|
||||
fi
|
||||
# check if we've reached last page
|
||||
grep -q -i "there are no submissions to list" "$tempfile" && break
|
||||
|
||||
# Extract links to pages with individual artworks and iterate over them
|
||||
|
|
Loading…
Add table
Reference in a new issue