mirror of
https://github.com/Wanxp/obsidian-douban.git
synced 2026-04-05 01:28:46 +08:00
Merge pull request #83 from junjiemao/junjiemao-patch-1
Update DoubanBookLoadHandler.ts
This commit is contained in:
commit
5c05bf08a4
@ -72,7 +72,13 @@ export default class DoubanBookLoadHandler extends DoubanAbstractLoadHandler<Dou
|
|||||||
|
|
||||||
|
|
||||||
parseSubjectFromHtml(html: CheerioAPI, context: HandleContext): DoubanBookSubject {
|
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 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();
|
let item = html(html("head > script[type='application/ld+json']").get(0)).text();
|
||||||
item = super.html_decode(item);
|
item = super.html_decode(item);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user