用多个方法尝试下载favicon

This commit is contained in:
luchenqun 2017-03-09 20:29:25 +08:00
parent 4bb164dafe
commit 5e07109055
1 changed files with 11 additions and 11 deletions

View File

@ -959,13 +959,13 @@ api.getFaviconByTimer = function() {
busy = false
});
} else {
// 尝试用http试一下手动抓取成功后会被缓存起来,直接使用[http]即可访问.请勿批量使用[https]
// http://www.cnblogs.com/zhangwei595806165/p/4984912.html 各种方法都试一遍
var faviconUrl = "http://g.soz.im/" + url; // 默认地址
if (faviconState == 1) {
if (url.startsWith("https")) {
url = "http" + url.substring(5);
faviconUrl = "http://www.google.com/s2/favicons?domain=" + url;
} else if (faviconState == 2) {
faviconUrl = "http://favicon.byi.pw/?url=" + url;
}
}
var faviconUrl = "http://g.soz.im/" + url;
download(faviconUrl).then(data => {
fs.writeFileSync(faviconPath, data);
db.updateBookmarkFaviconState(id, -1)