diff --git a/src/module/core/download_fliter.py b/src/module/core/download_fliter.py index 9bd8f040..f779898b 100644 --- a/src/module/core/download_fliter.py +++ b/src/module/core/download_fliter.py @@ -1,7 +1,7 @@ import re import logging - -from bs4 import BeautifulSoup +import xml.etree.ElementTree +from typing import Tuple from module.conf import settings from module.utils import json_config @@ -13,9 +13,9 @@ class RSSFilter: def __init__(self): self.filter_rule = json_config.load(settings.filter_rule) - def filter(self, item: BeautifulSoup): - title = item.title.string - torrent = item.find("enclosure") + def filter(self, item: xml.etree.ElementTree.Element) -> Tuple[bool, str]: + title = item.find('title').text + torrent = item.find("enclosure").attrib['url'] download = False for rule in self.filter_rule: if re.search(rule["include"], title): @@ -23,4 +23,3 @@ class RSSFilter: download = True logger.debug(f"{title} added") return download, torrent - diff --git a/src/module/network/request_contents.py b/src/module/network/request_contents.py index fe289431..546edffd 100644 --- a/src/module/network/request_contents.py +++ b/src/module/network/request_contents.py @@ -1,14 +1,11 @@ import re - +import xml.etree.ElementTree from dataclasses import dataclass -from bs4 import BeautifulSoup from .request_url import RequestURL from module.conf import settings -import xml.etree.ElementTree - FILTER = "|".join(settings.rss_parser.filter)