Initial implementation
This commit is contained in:
commit
d6d1d7ac96
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
*.json
|
||||||
|
|
||||||
|
data
|
||||||
|
!data/.gitkeep
|
19
GfycatGrab.sh
Executable file
19
GfycatGrab.sh
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )";
|
||||||
|
FALLBACK_DATA_DIR="${SCRIPT_DIR}/data";
|
||||||
|
|
||||||
|
if [[ -z "${GFYCAT_DIR}" ]]; then
|
||||||
|
echo "GFYCAT_DIR not set, using: ${FALLBACK_DATA_DIR}";
|
||||||
|
GFYCAT_DIR="${FALLBACK_DATA_DIR}";
|
||||||
|
fi
|
||||||
|
|
||||||
|
for json in $(ls *.json);
|
||||||
|
do
|
||||||
|
urls="$(cat $json | jq -r '.gfycats[] | .mp4Url')";
|
||||||
|
for url in $urls;
|
||||||
|
do
|
||||||
|
echo "Downloading $url";
|
||||||
|
curl --output-dir "${GFYCAT_DIR}" -O -C - "${url}";
|
||||||
|
done
|
||||||
|
done
|
19
README.md
Normal file
19
README.md
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# GfycatGrab
|
||||||
|
|
||||||
|
Budget way of grabbing all Gfycats from your account.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
1. jq
|
||||||
|
2. curl
|
||||||
|
- `v7.73.0+` since this script uses the `--output-dir` flag: https://daniel.haxx.se/blog/2020/09/10/store-the-curl-output-over-there/
|
||||||
|
|
||||||
|
## To use the script
|
||||||
|
|
||||||
|
1. Visit your Gfycat profile page, with your browser's developer console (network tab) open
|
||||||
|
2. Filter URLs by `/me/gfycats`
|
||||||
|
3. Copy the JSON response from the "GET" request. Save it as `any-name.json`
|
||||||
|
4. If you have more than 100 GIFs in your profile, repeat steps 1-3 for the next page (scroll to bottom), and save it as `any-name-2.json`
|
||||||
|
5. Run the script: `./GfycatGrab.sh`
|
||||||
|
- By default the script downloads to `./data` (relative to where the script is saved).
|
||||||
|
- If you want to download to a different directory, specify the `GFYCAT_DIR` environment variable: `GFYCAT_DIR=/path/to/where/you/want/download/files ./GfycatGrab.sh`
|
Loading…
Reference in New Issue
Block a user