mirror of
https://github.com/Wanxp/obsidian-douban.git
synced 2026-04-04 16:48:44 +08:00
fix login failed problem
This commit is contained in:
parent
ab86b3450c
commit
9d45746dac
@ -1,14 +1,9 @@
|
|||||||
import SettingsManager from "../setting/SettingsManager";
|
import SettingsManager from "../setting/SettingsManager";
|
||||||
import {DoubanPluginSetting} from "../setting/model/DoubanPluginSetting";
|
import {request, RequestUrlParam} from "obsidian";
|
||||||
import DoubanSearchResultSubject from "../data/model/DoubanSearchResultSubject";
|
|
||||||
import {request, requestUrl, RequestUrlParam, RequestUrlResponse} from "obsidian";
|
|
||||||
import {DEFAULT_SETTINGS} from "../../constant/DefaultSettings";
|
|
||||||
import {CheerioAPI, load} from "cheerio";
|
import {CheerioAPI, load} from "cheerio";
|
||||||
import SearchParserHandler from "../data/search/SearchParser";
|
|
||||||
import {log} from "../../utils/Logutil";
|
import {log} from "../../utils/Logutil";
|
||||||
import {i18nHelper} from "../../lang/helper";
|
import {i18nHelper} from "../../lang/helper";
|
||||||
import User from "./User";
|
import User from "./User";
|
||||||
import DoubanGameSubject from "../data/model/DoubanGameSubject";
|
|
||||||
import StringUtil from "../../utils/StringUtil";
|
import StringUtil from "../../utils/StringUtil";
|
||||||
|
|
||||||
export default class UserComponent {
|
export default class UserComponent {
|
||||||
@ -114,20 +109,19 @@ export default class UserComponent {
|
|||||||
}
|
}
|
||||||
let name = dataHtml(dataHtml("head > title").get(0)).text().trim();
|
let name = dataHtml(dataHtml("head > title").get(0)).text().trim();
|
||||||
let userUrl = dataHtml(elements.get(0)).attr("href");
|
let userUrl = dataHtml(elements.get(0)).attr("href");
|
||||||
let idPattern = /(\d){5,10}/g;
|
if (!name && !userUrl) {
|
||||||
let idP = idPattern.exec(userUrl);
|
|
||||||
let id = idP ? idP[0] : "";
|
|
||||||
if (!id) {
|
|
||||||
return new User();
|
return new User();
|
||||||
}
|
}
|
||||||
const result: User = {
|
let id = '';
|
||||||
|
if (userUrl && userUrl.indexOf('people/') > 0) {
|
||||||
|
id = userUrl.substring(userUrl.lastIndexOf('people/') + 7, userUrl.lastIndexOf('/'));
|
||||||
|
}
|
||||||
|
return {
|
||||||
id: id,
|
id: id,
|
||||||
name: name,
|
name: name,
|
||||||
url: userUrl,
|
url: userUrl,
|
||||||
login: true
|
login: true
|
||||||
}
|
};
|
||||||
return result;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user