Skip to content

Instantly share code, notes, and snippets.

@cmj
Last active October 22, 2026 02:01
Show Gist options
  • Select an option

  • Save cmj/78af0929865144381cbfff52dabbc28b to your computer and use it in GitHub Desktop.

Select an option

Save cmj/78af0929865144381cbfff52dabbc28b to your computer and use it in GitHub Desktop.
fix for reddit data after 2026-10-21 new restrictions
#!/usr/bin/env python3
# json dump reddit post/comment data
# requires curl_cffi, reddit account cookie
# ex: reddit.py "https://www.reddit.com/r/kde/comments/.json?limit=25"
# reddit.py "https://www.reddit.com/r/kde/new/.json?limit=15"
import sys
import json
from curl_cffi import requests
url = sys.argv[1]
# now requires authed session cookie (pull `reddit_session` from devtools)
cookie = 'reddit_session='
response = requests.get(
url,
impersonate="chrome120",
headers={
"Cookie": cookie,
},
timeout=10
)
response.raise_for_status()
print(json.dumps(response.json(), indent=2, ensure_ascii=False))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment