mirror of
https://github.com/Wanxp/obsidian-douban.git
synced 2026-04-04 16:48:44 +08:00
Update DoubanBookLoadHandler.ts
Adjust book descriptions to use more complete data
This commit is contained in:
parent
46d61d3e84
commit
5dd02b1433
@ -72,7 +72,13 @@ export default class DoubanBookLoadHandler extends DoubanAbstractLoadHandler<Dou
|
||||
|
||||
|
||||
parseSubjectFromHtml(html: CheerioAPI, context: HandleContext): DoubanBookSubject {
|
||||
let desc = html(html("head > meta[property= 'og:description']").get(0)).attr("content");
|
||||
let desc = html('#link-report > span.all.hidden > div > div[class= "intro"]').html();
|
||||
if (desc) {
|
||||
//替换p标签 为换行符
|
||||
desc = desc.replace(/<p>/g, '').replace(/<\/p>/g, '\n');
|
||||
//去掉开头的换行符
|
||||
desc = desc.replace(/^\n/, '');
|
||||
}
|
||||
let image = html(html("head > meta[property= 'og:image']").get(0)).attr("content");
|
||||
let item = html(html("head > script[type='application/ld+json']").get(0)).text();
|
||||
item = super.html_decode(item);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user