Last active
July 12, 2023 21:34
-
-
Save milnak/45d56084bdc0cc60da015c7c5c8abcaa to your computer and use it in GitHub Desktop.
subreddit scraper script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # { | |
| # "kind": "Listing", | |
| # "data": { | |
| # "after": "t3_ro8uu5", | |
| # "children": [ | |
| # { | |
| # "kind": "t3", | |
| # "data": { | |
| # "url_overridden_by_dest": "https://i.redd.it/gteuq5io5ff81.jpg", | |
| # PowerShell one-liner: | |
| # ((Invoke-WebRequest -Uri 'https://www.reddit.com/r/Wallpapers.json?limit=10').Content | ConvertFrom-Json).data.children.data.url_overridden_by_dest | Select-String '(jpg|jpeg|png|mp4|gif)$' | ForEach-Object { Invoke-WebRequest -Uri $_.ToString() -OutFile ([uri]$_.ToString()).Segments[-1] } | |
| curl -s -A "reddit scraper" "https://www.reddit.com/r/Wallpapers.json?limit=10" | \ | |
| jq -r '.data.children | map(.data.url_overridden_by_dest)[] | select(.) | \ | |
| grep -E "(jpg|jpeg|png|mp4|gif)$" | \ | |
| xargs wget -U "reddit downloader" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment