mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-11-02 13:28:32 +08:00
refactor(types): govern ipt site parser
This commit is contained in:
@@ -8,13 +8,15 @@ from app.foundation import size as size_tools
|
||||
from app.foundation import temporal as time_tools
|
||||
from app.foundation import text as text_tools
|
||||
from app.foundation.dom import DomUtils
|
||||
from app.modules.indexer.parser import SiteParserBase, SiteSchema
|
||||
from app.modules.indexer.parser import SitePage, SiteParserBase, SiteSchema
|
||||
|
||||
|
||||
class IptSiteUserInfo(SiteParserBase):
|
||||
"""解析 Ipt 站点的用户资料、流量与消息。"""
|
||||
schema = SiteSchema.Ipt
|
||||
|
||||
def _parse_user_base_info(self, html_text: str):
|
||||
def _parse_user_base_info(self, html_text: SitePage) -> None:
|
||||
"""解析站点用户身份和页面提供的基础统计。"""
|
||||
html_text = self._prepare_html_text(html_text)
|
||||
html = etree.HTML(html_text)
|
||||
try:
|
||||
@@ -41,10 +43,12 @@ class IptSiteUserInfo(SiteParserBase):
|
||||
if html is not None:
|
||||
del html
|
||||
|
||||
def _parse_site_page(self, html_text: str):
|
||||
def _parse_site_page(self, html_text: SitePage) -> None:
|
||||
"""该站点在其他解析入口处理此数据,本入口不追加操作。"""
|
||||
pass
|
||||
|
||||
def _parse_user_detail_info(self, html_text: str):
|
||||
def _parse_user_detail_info(self, html_text: str) -> None:
|
||||
"""解析用户等级、注册时间及其他资料。"""
|
||||
html = etree.HTML(html_text)
|
||||
try:
|
||||
if not DomUtils.has_child_elements(html):
|
||||
@@ -62,7 +66,8 @@ class IptSiteUserInfo(SiteParserBase):
|
||||
if html is not None:
|
||||
del html
|
||||
|
||||
def _parse_user_torrent_seeding_info(self, html_text: str, multi_page: bool = False) -> Optional[str]:
|
||||
def _parse_user_torrent_seeding_info(self, html_text: str, multi_page: bool = False) -> None:
|
||||
"""读取做种页面数据并返回后续分页入口。"""
|
||||
html = etree.HTML(html_text)
|
||||
try:
|
||||
if not DomUtils.has_child_elements(html):
|
||||
@@ -91,11 +96,14 @@ class IptSiteUserInfo(SiteParserBase):
|
||||
if html is not None:
|
||||
del html
|
||||
|
||||
def _parse_user_traffic_info(self, html_text: str):
|
||||
def _parse_user_traffic_info(self, html_text: str) -> None:
|
||||
"""该站点在其他解析入口处理此数据,本入口不追加操作。"""
|
||||
pass
|
||||
|
||||
def _parse_message_unread_links(self, html_text: str, msg_links: list) -> Optional[str]:
|
||||
def _parse_message_unread_links(self, html_text: str, msg_links: list[str]) -> Optional[str]:
|
||||
"""收集未读消息链接,返回仍需读取的下一页。"""
|
||||
return None
|
||||
|
||||
def _parse_message_content(self, html_text):
|
||||
def _parse_message_content(self, html_text: str) -> tuple[Optional[str], Optional[str], Optional[str]]:
|
||||
"""解析消息标题、日期和正文;无独立消息页时返回空结果。"""
|
||||
return None, None, None
|
||||
|
||||
Reference in New Issue
Block a user