Skip to content

Instantly share code, notes, and snippets.

@chapmanjacobd
Created April 29, 2022 22:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chapmanjacobd/84e281d9a0790575888c8017bdf4fb99 to your computer and use it in GitHub Desktop.
Save chapmanjacobd/84e281d9a0790575888c8017bdf4fb99 to your computer and use it in GitHub Desktop.
bdfr gallerydl ytdl
function reddit-photos-getter --argument dfolder url
cd $dfolder
gallery-dl --quiet --cookies ~/.local/cookies.txt --download-archive $HOME/.local/share/gallerydl.sqlite3 $url
if not test $status -eq 0 -o $status -eq 4 -o $status -eq 8 # https://github.com/mikf/gallery-dl/issues/1120
ytdl --quiet -f bestvideo[height<=576]+bestaudio/best[height<=576] --write-sub --write-auto-sub --sub-lang en --sub-format srt/sub/ssa/vtt/ass/best -- $url
end
end
function reddit-photos-get --argument dfolder subr
set tmpfile (mktemp)
# reddit-links-m
reddit-links "$subr" | grep '^http' | sed -e 's|&list.*||' -e 's|\?list.*||' | sort --unique --stable --ignore-case | shuf | sed "s|.*|reddit-photos-getter $dfolder \0|" >$tmpfile
echo Links saved to $tmpfile
parallel -j8 <$tmpfile
end
function reddit-links
cd ~/github/o/bulk-downloader-for-reddit/
python -m bdfr download bdfr/ --disable-module SelfPost -S top --subreddit $argv
python -m bdfr download bdfr/ --disable-module SelfPost -S top -t year --subreddit $argv
python -m bdfr download bdfr/ --disable-module SelfPost -S top -t month -L 400 --subreddit $argv
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment