fugary / calibre-web-douban-api

新版calibre-web已经移除douban-api了,添加一个豆瓣api实现
Apache License 2.0
402 stars 65 forks source link

豆瓣页面结构变化 #6

Closed WindStill closed 2 years ago

WindStill commented 2 years ago

1、作者的链接变由/author变为了/serach

def author_filter(self, a_element):
    a_href = a_element.attrib['href']
    return '/search' in a_href

2、简介内容上层div标签不完整导致包含简介之外的其他内容。剪去</div>之后的内容

book['description'] = ''
if len(summary_element):
     summary = etree.tostring(summary_element[-1], encoding="utf8").decode("utf8").strip()
     book['description'] = summary[0:(summary.index("</div>") + 6)]
fugary commented 2 years ago

第一个问题是存在的,不过不是豆瓣页面结构变化,应该是部分作者在豆瓣作者库中没有映射上,所以显示成搜索。

第二个暂不修改,简介中div是普遍存在,直接去掉肯定不行(最好多找几个例子看看)

WindStill commented 2 years ago

第一个问题是存在的,不过不是豆瓣页面结构变化,应该是部分作者在豆瓣作者库中没有映射上,所以显示成搜索。

第二个暂不修改,简介中div是普遍存在,直接去掉肯定不行(最好多找几个例子看看)

第一个问题的确实是你说的作者没映射上,不过这种情况很多,尤其是外籍作者,可以考虑兼容两种情况。其他的比如丛书链接是/series开头,出品方/producer开头,应该不会有影响。

第二个问题,我大概看了二十来个,简介<div class="intro">下级都是p标签,目前没有见到有div标签的