mirror of
https://github.com/d0zingcat/MoviePilot-Plugins.git
synced 2026-05-29 23:16:50 +00:00
fix 豆瓣订阅插件
This commit is contained in:
@@ -484,12 +484,14 @@ class DoubanRank(_PluginBase):
|
||||
|
||||
title = rss_info.get('title')
|
||||
douban_id = rss_info.get('doubanid')
|
||||
year = rss_info.get('year')
|
||||
unique_flag = f"doubanrank: {title} (DB:{douban_id})"
|
||||
# 检查是否已处理过
|
||||
if unique_flag in [h.get("unique") for h in history]:
|
||||
continue
|
||||
# 元数据
|
||||
meta = MetaInfo(title)
|
||||
meta.year = year
|
||||
# 识别媒体信息
|
||||
if douban_id:
|
||||
# 识别豆瓣信息
|
||||
@@ -565,25 +567,36 @@ class DoubanRank(_PluginBase):
|
||||
items = rootNode.getElementsByTagName("item")
|
||||
for item in items:
|
||||
try:
|
||||
rss_info = {}
|
||||
|
||||
# 标题
|
||||
title = DomUtils.tag_value(item, "title", default="")
|
||||
# 链接
|
||||
link = DomUtils.tag_value(item, "link", default="")
|
||||
# 年份
|
||||
description = DomUtils.tag_value(item, "description", default="")
|
||||
|
||||
if not title and not link:
|
||||
logger.warn(f"条目标题和链接均为空,无法处理")
|
||||
continue
|
||||
rss_info['title'] = title
|
||||
rss_info['link'] = link
|
||||
|
||||
doubanid = re.findall(r"/(\d+)/", link)
|
||||
if doubanid:
|
||||
doubanid = doubanid[0]
|
||||
if doubanid and not str(doubanid).isdigit():
|
||||
logger.warn(f"解析的豆瓣ID格式不正确:{doubanid}")
|
||||
continue
|
||||
rss_info['doubanid'] = doubanid
|
||||
|
||||
# 匹配4位独立数字1900-2099年
|
||||
year = re.findall(r"\b(19\d{2}|20\d{2})\b", description)
|
||||
if year:
|
||||
rss_info['year'] = year[0]
|
||||
|
||||
# 返回对象
|
||||
ret_array.append({
|
||||
'title': title,
|
||||
'link': link,
|
||||
'doubanid': doubanid
|
||||
})
|
||||
ret_array.append(rss_info)
|
||||
except Exception as e1:
|
||||
logger.error("解析RSS条目失败:" + str(e1))
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user