Last active
October 22, 2026 02:01
-
-
Save cmj/78af0929865144381cbfff52dabbc28b to your computer and use it in GitHub Desktop.
fix for reddit data after 2026-10-21 new restrictions
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
| #!/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