Skip to content

Commit c20a7a3

Browse files
committed
修复知乎未登录时没获取到图片
1 parent 3cd5ebb commit c20a7a3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/markdown.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ const extract = async (markdownBody, selectors, options, exec) => {
131131
downloadUrl
132132
}
133133
}
134-
const src = item.getAttribute(options.lazyKey) || item.src
134+
const src = item.getAttribute([].concat(options.lazyKey || []).find(key => item.getAttribute(key)) || 'src')
135135
const url = src.replace(/\?$/, '')
136136
const ext = getExt(url)
137137
const name = realName + '/' + md5(url) + (ext ? '.' + ext : '')

src/websites/zhihu.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const options = {
66
link: false,
77
br: true,
88
code: false,
9-
lazyKey: 'data-original',
9+
lazyKey: ['data-original', 'data-actualsrc'],
1010
selectors: {
1111
title: '.Post-Title',
1212
body: '.Post-RichText',

0 commit comments

Comments
 (0)