Skip to content

Commit

Permalink
Merge pull request #663 from MrServo/master
Browse files Browse the repository at this point in the history
[SimpleRSS] tiny bugfix
  • Loading branch information
mike-99 committed May 9, 2024
2 parents edcde0b + 7a6378c commit dbb82b3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions simplerss/src/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1125,19 +1125,20 @@ def __getattr__(self, tag):
myl.append((elem.get("url"), elem.get("type"), elem.get("length")))
for elem in self._element.findall("%sdescription" % self._ns): # alternative #1: search for enclosures
if elem.text:
res = search(r'src="(.*?)"', elem.text) # perhaps not the most elegant way but it works
res = search(r'src="(.*?)"', elem.text) # search for 'src=', perhaps not the most elegant way but it works
if res:
url = res.group(1)
url = res.group(1).replace("http://", "https://")
myl.append((url, EXT2MIME.get(cleanupUrl(url[url.rfind("."):]), "unknown"), "0")) # create missing MIME type
else: # alternative #2: search for enclosures. HINT: tag '<content:encoded>' can't be found by self._element.findall()
res = search(r'src="(.*?)"', tostring(self._element).decode()) # quick'n'dirty but it works
if res:
url = res.group(1)
url = res.group(1).replace("http://", "https://")
myl.append((url, EXT2MIME.get(cleanupUrl(url[url.rfind("."):]), "unknown"), "0"))
for elem in self._element.findall("%simage" % self._ns): # alternative #3: search for enclosures
url = elem.text
url = elem.text.replace("http://", "https://")
myl.append((url, EXT2MIME.get(cleanupUrl(url[url.rfind("."):]), "unknown"), "0")) # create missing MIME type
return myl

elif tag == "id":
return self._element.findtext("%sguid" % self._ns, "%s%s" % (self.title, self.link))
elif tag == "updated":
Expand Down

0 comments on commit dbb82b3

Please sign in to comment.