chg: [rssfind] set coherent User-Agent headers

This commit is contained in:
Alexandre Dulaunoy 2024-03-03 22:07:18 +01:00
parent 848b96a03c
commit 149c6b4489
Signed by: adulau
GPG key ID: 09E2CD4944E6CBCD

View file

@ -14,7 +14,7 @@ def findfeeds(url=None, disable_strict=False):
if url is None:
return None
raw = requests.get(url).text
raw = requests.get(url, headers=headers).text
results = []
discovered_feeds = []
html = bs4(raw, features="lxml")
@ -52,9 +52,12 @@ def findfeeds(url=None, disable_strict=False):
version = "0.2"
feedparser.USER_AGENT = (
"rssfind.py " + version + " +https://github.com/adulau/rss-tools"
)
user_agent = f"rssfind.py {version} +https://github.com/adulau/rss-tools"
feedparser.USER_AGENT = user_agent
headers = {"User-Agent": user_agent}
usage = "Find RSS or Atom feeds from an URL\nusage: %prog [options]"