Skip to content

Fix reddit fetch by mimicking real browser behaviour#60

Open
msilvoso wants to merge 1 commit into
thevinter:masterfrom
msilvoso:master
Open

Fix reddit fetch by mimicking real browser behaviour#60
msilvoso wants to merge 1 commit into
thevinter:masterfrom
msilvoso:master

Conversation

@msilvoso

@msilvoso msilvoso commented Jun 4, 2026

Copy link
Copy Markdown

Reddit now returns "403 Blocked" for the unauthenticated .json API
regardless of User-Agent. Switch to scraping the server-rendered
old.reddit.com HTML listing (which a real browser actually loads) and
extract direct i.redd.it image links.

Use a realistic Firefox User-Agent with full browser headers, and send
distinct header sets for the page navigation (Accept: text/html,
Sec-Fetch-Dest: document) versus the image download (Accept: image/*,
Sec-Fetch-Dest: image) — i.redd.it serves an HTML interstitial unless
the request looks like a genuine fetch.

I like your script but it stopped working with reddit wallpapers.
I asked Claude to do a fix for me :)

    Reddit now returns "403 Blocked" for the unauthenticated .json API
    regardless of User-Agent. Switch to scraping the server-rendered
    old.reddit.com HTML listing (which a real browser actually loads) and
    extract direct i.redd.it image links.

    Use a realistic Firefox User-Agent with full browser headers, and send
    distinct header sets for the page navigation (Accept: text/html,
    Sec-Fetch-Dest: document) versus the image download (Accept: image/*,
    Sec-Fetch-Dest: image) — i.redd.it serves an HTML interstitial unless
    the request looks like a genuine <img> fetch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant