Skip to content

Commit

Permalink
Merge pull request #72 from danesjenovdan/main
Browse files Browse the repository at this point in the history
try to fix invalid url on articles
  • Loading branch information
LepkoQQ authored Apr 23, 2024
2 parents 2d5b88a + 3367b2f commit b4b8713
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions novdan_api/articles/management/commands/parse_articles.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,19 @@ def parse_rss_feed(self, medium, url):

self.stdout.write(f" > {title[:67]}")

if item.link and item.link.content and not item.link.content.startswith("http"):
if item.link.content.startswith("//"):
item.link.content = f"http:{item.link.content}"
if "://" not in item.link.content:
item.link.content = f"http://{item.link.content}"

if not self.is_url(item.link.content):
with push_scope() as scope:
scope.set_extra("command", "parse_articles")
scope.set_extra("rss_url", url)
capture_message(f"Invalid url: {item.link.content}")
self.stdout.write(f" > invalid url: {item.link.content}")
self.stdout.write("")
continue

url = item.link.content[:512]
Expand Down

0 comments on commit b4b8713

Please sign in to comment.