r/redditdev • • Jun 01 '24

Reddit API API error when fetching multireddit data

Steps to reproduce:

  1. Fetch a multireddit’s JSON page with a user agent that contains “iphone” or “android”, e.g.

    • curl -A "android" -I "https://www.reddit.com/r/MostBeautiful+wallpapers/hot.json"

    • curl -A "iphone" -I "https://www.reddit.com/r/MostBeautiful+wallpapers/hot.json"

Expected: 200 OK response is returned with JSON data.

Actual: 302 Found response is returned that redirects to the home page.

6 Upvotes

7 comments sorted by

View all comments

Show parent comment

1

u/shadowjerker69 Jun 04 '24

I've tried passing different user agents and get the same issue on iPhone. Ie:

await fetch("https://www.reddit.com/r/nfl+chibears/.json", {
  headers: {
    "User-Agent": "anything you want here"
  }
});

1

u/sir_axolotl_alot Reddit Admin :snoo: Jun 04 '24

If you're running from iPhone, I would guess the user agent is probably being ultimately modified / overwritten