not sure if it's used

This commit is contained in:
Trim21
2023-04-29 17:30:52 +08:00
parent d63cc8efe2
commit 7739a32d69
2 changed files with 6 additions and 10 deletions

View File

@@ -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

View File

@@ -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)