mirror of
https://github.com/Radiquum/furaffinity-dl.git
synced 2025-04-05 07:44:37 +00:00
Store cookies securely
This commit is contained in:
parent
444869b8f5
commit
d976ace626
1 changed files with 18 additions and 7 deletions
|
@ -3,18 +3,31 @@ set -e
|
|||
|
||||
if [ "$1" = "" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
|
||||
echo "Usage: $0 SECTION/USER [YOUR_USERNAME]
|
||||
Downloads the entire gallery/scraps/favorites of furaffinity.net user.
|
||||
Downloads the entire gallery/scraps/favorites of any furaffinity.net user.
|
||||
|
||||
Examples:
|
||||
$0 gallery/ymxa
|
||||
$0 gallery/kodardragon
|
||||
$0 scraps/---
|
||||
$0 favorites/kivuli
|
||||
|
||||
You can also log in to FurAffinity to download restricted content, like this:
|
||||
You can also log in to FurAffinity and download restricted content, like this:
|
||||
$0 gallery/simoom your_username_here"
|
||||
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
|
||||
# set a wget wrapper with custom user agent
|
||||
|
@ -28,19 +41,17 @@ else
|
|||
# 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.txt \
|
||||
--save-cookies "$cookies_file" \
|
||||
--post-data "action=login&retard_protection=1&name=$LOGIN_NAME&pass=$PASSWORD&login=Login+to%C2%A0FurAffinity" \
|
||||
"https://www.furaffinity.net/login/"
|
||||
|
||||
# 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.txt $*
|
||||
--load-cookies "$cookies_file" $*
|
||||
}
|
||||
fi
|
||||
|
||||
tempfile="$(mktemp)"
|
||||
|
||||
base_url=https://www.furaffinity.net/"$1"
|
||||
|
||||
url="$base_url"
|
||||
|
|
Loading…
Add table
Reference in a new issue