[generic] Implement basic check that downloaded page is an RSS or Atom feed.
This commit is contained in:
parent
499c9e660a
commit
a1475943a7
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue