Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion learning_resources/etl/podcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
CONFIG_FILE_REPO = "mitodl/open-podcast-data"
CONFIG_FILE_FOLDER = "podcasts"
TIMESTAMP_FORMAT = "%a, %d %b %Y %H:%M:%S %z"
BROWSER_UA_HEADERS = {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) "
"AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/39.0.2171.95 Safari/537.36"
Comment on lines +23 to +25
Copy link

Copilot AI Sep 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The user-agent string references Chrome version 39.0.2171.95 from 2014, which is extremely outdated. Consider using a more recent user-agent string to avoid potential blocking by servers that filter out very old browsers.

Suggested change
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) "
"AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/39.0.2171.95 Safari/537.36"
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) "
"AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/120.0.0.0 Safari/537.36"

Copilot uses AI. Check for mistakes.

}

log = logging.getLogger()

Expand Down Expand Up @@ -128,7 +133,7 @@ def extract():
for playlist_config in configs:
rss_url = playlist_config["rss_url"]
try:
response = requests.get(rss_url) # noqa: S113
response = requests.get(rss_url, headers=BROWSER_UA_HEADERS) # noqa: S113
response.raise_for_status()

feed = bs(response.content, "xml")
Expand Down
Loading