Compare commits

..

No commits in common. "51049b4d3039906bdbfe6279dd54e8bfc20e31ab" and "03d420e412f11e50127177d69fd2fcde3f1a7059" have entirely different histories.

2 changed files with 5 additions and 24 deletions

View file

@ -664,14 +664,14 @@ def classify_links(links, baseuri) -> typing.Tuple[list[str], list[str]]:
"""
baseuri = baseuri.lower()
local, remote = set(), set()
local, remote = [], []
for link in links:
if link.lower().startswith(baseuri):
local.add(link)
local.append(link)
else:
remote.add(link)
remote.append(link)
return list(local), list(remote)
return local, remote
def is_feed_link(link: str) -> bool:
@ -687,27 +687,18 @@ def is_feed_link(link: str) -> bool:
def is_XML_related_link(link: str) -> bool:
link = link.lower()
return (
"rss" in link
or "rdf" in link
or "xml" in link
or "atom" in link
or "feed" in link
)
return "rss" in link or "rdf" in link or "xml" in link or "atom" in link
async def check_feed(url: str) -> Feed | None:
"""Check to see if the given URL is a feed. If it is, return the feed,
otherwise return None.
"""
LOG.debug(f"Checking {url}: checking...")
meta = FeedMeta.from_url(url)
result, meta = await fetch_feed(meta)
if isinstance(result, Feed):
LOG.debug(f"Checking {url}: is a feed")
return result
LOG.debug(f"Checking {url}: is not a feed")
return None
@ -747,11 +738,6 @@ async def feed_search(uri: str) -> list[Feed]:
LOG.debug("No links, checking A tags...")
local_links, remote_links = classify_links(parser.a_links, meta.url)
for link in local_links:
LOG.debug(f" LOCAL {link}")
for link in remote_links:
LOG.debug(f" REMOTE {link}")
outfeeds = await check_links(filter(is_feed_link, local_links))
if len(outfeeds) > 0:
return outfeeds
@ -773,7 +759,6 @@ async def feed_search(uri: str) -> list[Feed]:
"rss.xml", # Dave Winer/Manila
"index.xml", # MT
"index.rss", # Slash
"feed", # catandgirl.com and sometimes others.
]
outfeeds = await check_links([urllib.parse.urljoin(meta.url, x) for x in suffixes])
return outfeeds

View file

@ -1,7 +1,3 @@
[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"
[project]
name = "cry"
version = "0.1"