Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

书籍标签 #4

Closed
Cheukfung opened this issue May 7, 2022 · 5 comments
Closed

书籍标签 #4

Cheukfung opened this issue May 7, 2022 · 5 comments

Comments

@Cheukfung
Copy link

cxfksword/douban-api-rs 这个项目是可以获取书籍的tag的,请问能不能加上书籍标签的功能呢

@fugary
Copy link
Owner

fugary commented May 7, 2022

douban官网把tag关闭了,页面上都没有,没法获取tag,douban-api-rs应该也不会有吧

@Cheukfung
Copy link
Author

感谢作者的工作。
我是用talebook/talebook来管理,他调用了douban-api-rs来更新书籍,可以更新标签,我就以为是能获取tag。后来测试了dou ban-api-rs的确无法获取tag。
最后查看talebook的源码发现,是通过匹配固定标签和简介里面的内容来实现的,虽然不会很准确,但不失为一种方法。
if len(refer_mi.tags) == 0 and len(mi.tags) == 0: ts = [] for nn, tags in constants.BOOKNAV: for tag in tags: if tag in refer_mi.title or tag in refer_mi.comments: ts.append(tag) elif tag in refer_mi.authors: ts.append(tag) if len(ts) > 0: mi.tags += ts[:8] logging.info("tags are %s" % ','.join(mi.tags)) self.db.set_tags(book_id, mi.tags) mi.smart_update(refer_mi, replace_metadata=True)

@fugary
Copy link
Owner

fugary commented May 8, 2022

用描述或者标题关键字判断tag,很容易误判,有空试试看

@Cheukfung
Copy link
Author

昨天提了pr了,你可以看看

@fugary
Copy link
Owner

fugary commented May 8, 2022

源文件中的criteria作为标签似乎更合适:
criteria = '7:计算机|7:计算机科学|7:计算机系统|7:计算机体系结构|7:操作系统|7:CSAPP|7:计算机底层|7:编程|7:CS|7:经典|3:/subject/26912767/',

@fugary fugary closed this as completed May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants