Skip to content

Commit

Permalink
fix(refreshrss): PT RSS下载失败
Browse files Browse the repository at this point in the history
  • Loading branch information
xuyanling committed Jan 11, 2024
1 parent 151b40c commit 05c4fc7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/rsschecker.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import re
import json
import time
import html
import traceback

import jsonpath
Expand Down Expand Up @@ -491,9 +492,9 @@ def __parse_userrss_result(self, taskinfo):
for key, attr in rss_parser_format.get("item", {}).items():
item_html = etree.tostring(item, encoding='unicode')
if key == "enclosure":
enclosure_matches = re.findall(r'magnet:\?xt=urn:btih:(\w+)', item_html)
enclosure_matches = re.findall(r'<media:content\s+url="(.*?)"', item_html)
if enclosure_matches and len(enclosure_matches) >= 1:
value = f"magnet:?xt=urn:btih:{enclosure_matches[0]}"
value = html.unescape(enclosure_matches[0])
rss_item.update({key: value})
else:
continue
Expand Down

0 comments on commit 05c4fc7

Please sign in to comment.