mirror of
https://github.com/Wanxp/obsidian-douban.git
synced 2026-04-04 16:48:44 +08:00
fix note bug
This commit is contained in:
parent
689a43cf16
commit
92e30cf97d
@ -276,7 +276,7 @@ export default abstract class DoubanAbstractLoadHandler<T extends DoubanSubject>
|
|||||||
log.warn(i18nHelper.getMessage('100113'));
|
log.warn(i18nHelper.getMessage('100113'));
|
||||||
return resultContent;
|
return resultContent;
|
||||||
}
|
}
|
||||||
if (!userState || !userState.collectionDate) {
|
if (!userState) {
|
||||||
return resultContent;
|
return resultContent;
|
||||||
}
|
}
|
||||||
return resultContent.replaceAll(DoubanUserParameter.MY_TAGS, this.handleSpecialContent(userState.tags, textMode, context))
|
return resultContent.replaceAll(DoubanUserParameter.MY_TAGS, this.handleSpecialContent(userState.tags, textMode, context))
|
||||||
|
|||||||
@ -32,23 +32,7 @@ export default class DoubanNoteLoadHandler extends DoubanAbstractLoadHandler<Dou
|
|||||||
}
|
}
|
||||||
|
|
||||||
analysisUser(html: CheerioAPI, context: HandleContext): {data:CheerioAPI , userState: UserStateSubject} {
|
analysisUser(html: CheerioAPI, context: HandleContext): {data:CheerioAPI , userState: UserStateSubject} {
|
||||||
let rate = html(html('input#n_rating').get(0)).val();
|
return {data: html, userState: null};
|
||||||
let tagsStr = html(html('div#interest_sect_level > div.a_stars > span.color_gray').get(0)).text().trim();
|
|
||||||
let tags = tagsStr.replace('标签:', '').split(' ');
|
|
||||||
let stateWord = html(html('div#interest_sect_level > div.a_stars > span.mr10').get(0)).text().trim();
|
|
||||||
let collectionDateStr = html(html('div#interest_sect_level > div.a_stars > span.mr10 > span.collection_date').get(0)).text().trim();
|
|
||||||
let userState1 = DoubanAbstractLoadHandler.getUserState(stateWord);
|
|
||||||
let component = html(html('div#interest_sect_level > div.a_stars > span.color_gray').get(0)).next().next().text().trim();
|
|
||||||
|
|
||||||
|
|
||||||
const userState: UserStateSubject = {
|
|
||||||
tags: tags,
|
|
||||||
rate: rate?Number(rate):null,
|
|
||||||
state: userState1,
|
|
||||||
collectionDate: collectionDateStr?moment(collectionDateStr, 'YYYY-MM-DD').toDate():null,
|
|
||||||
comment: component
|
|
||||||
}
|
|
||||||
return {data: html, userState: userState};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
parseSubjectFromHtml(html: CheerioAPI, context: HandleContext): DoubanNoteSubject {
|
parseSubjectFromHtml(html: CheerioAPI, context: HandleContext): DoubanNoteSubject {
|
||||||
|
|||||||
@ -35,7 +35,7 @@ export default class DoubanPlugin extends Plugin {
|
|||||||
|
|
||||||
|
|
||||||
async putToObsidian(context: HandleContext, extract: DoubanSubject) {
|
async putToObsidian(context: HandleContext, extract: DoubanSubject) {
|
||||||
const {syncStatus} = context.syncStatusHolder;
|
const syncStatus = context.syncStatusHolder && context.syncStatusHolder.syncStatus ? context.syncStatusHolder.syncStatus : null;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (!extract) {
|
if (!extract) {
|
||||||
@ -88,7 +88,7 @@ export default class DoubanPlugin extends Plugin {
|
|||||||
}
|
}
|
||||||
filePath = filePath?filePath:DEFAULT_SETTINGS.dataFilePath;
|
filePath = filePath?filePath:DEFAULT_SETTINGS.dataFilePath;
|
||||||
filePath = FileUtil.join(filePath, result.fileName);
|
filePath = FileUtil.join(filePath, result.fileName);
|
||||||
const {syncStatus} = context.syncStatusHolder;
|
const syncStatus = context.syncStatusHolder && context.syncStatusHolder.syncStatus ? context.syncStatusHolder.syncStatus : null;
|
||||||
const {subject} = result;
|
const {subject} = result;
|
||||||
const {content} = result;
|
const {content} = result;
|
||||||
if (Action.Sync == context.action) {
|
if (Action.Sync == context.action) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user