Created
June 6, 2025 17:47
-
-
Save AndrewBarfield/e8a0a48f7e463ab0c675743549813f97 to your computer and use it in GitHub Desktop.
Read RSS feed from Reddit without HTTP 403 error
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
import feedparser | |
# Some sites either require a standard UA or have blocked the feedparser UA | |
feedparser.USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" | |
# Reddit seems to require the 'accept-language' request header | |
fpd = feedparser.parse("https://www.reddit.com/r/ApteraMotors/.rss", | |
request_headers={ | |
'accept-language': 'en-US,en;q=0.9'}) | |
# Show the feed and attributes | |
print(fpd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment