Skip to content

Instantly share code, notes, and snippets.

@HummusSamurai
Last active April 1, 2017 19:12
Show Gist options
  • Select an option

  • Save HummusSamurai/88eec97c4d525ce3c3800c76132523fb to your computer and use it in GitHub Desktop.

Select an option

Save HummusSamurai/88eec97c4d525ce3c3800c76132523fb to your computer and use it in GitHub Desktop.
Downloads video/audio content in a subreddit, and takes as parameters the subreddit title, date (optional), and limit (optional). Dependency: xargs, curl, youtube-dl, jq, at
#!/bin/bash
curl -A "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30" \
https://www.reddit.com/r/$1/top/.json?sort=top\&t=${2:-all}\&limit=${3:-25} \
| jq -r '.data.children[].data.url' | xargs \
youtube-dl -o "~/youtube-dl/r_$1/r_$1 -- %(title)s.%(ext)s"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment