[generic] Implement basic check that downloaded page is an RSS or Atom feed.

This commit is contained in:
0x80 2022-04-24 00:00:00 +00:00
parent 499c9e660a
commit a1475943a7
Signed by: 0x80
GPG Key ID: 68368BCBC000EF51
1 changed files with 6 additions and 5 deletions

View File

@ -36,11 +36,12 @@ def try_common_paths (verbosity, url, args):
for path in common_paths: for path in common_paths:
page,response_code = download (platform, url + '/' + path, args, verbosity, True) page,response_code = download (platform, url + '/' + path, args, verbosity, True)
if response_code == 200: if response_code == 200:
# TODO: verify it is a valid RSS feed # basic check that it looks like an RSS or Atom file
# Some pages serve response 200 for invalid pages if "<rss" in page or "<feed" in page:
# assume we found a feed
# assume we found a feed return url + '/' + path
return url + '/' + path else:
debug ("Server returned 200, but it does not appear to be an RSS/Atom feed.", verbosity, platform)
# failed to find # failed to find
return None return None