mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader.git
synced 2025-08-19 04:55:54 +08:00
fix: img with srcset only
This commit is contained in:
parent
6fa8ce309e
commit
1f4620deef
@ -230,6 +230,10 @@ export class SnapshotFormatter extends AsyncService {
|
||||
return alt ? `(Image ${++imgIdx}: ${alt})` : '';
|
||||
}
|
||||
let linkPreferredSrc = (node.getAttribute('src') || '').trim();
|
||||
const maybeSrcSet: string = (node.getAttribute('srcset') || '').trim();
|
||||
if (!linkPreferredSrc && maybeSrcSet) {
|
||||
linkPreferredSrc = maybeSrcSet.split(',').map((x) => x.trim()).filter(Boolean)[0];
|
||||
}
|
||||
if (!linkPreferredSrc || linkPreferredSrc.startsWith('data:')) {
|
||||
const dataSrc = (node.getAttribute('data-src') || '').trim();
|
||||
if (dataSrc && !dataSrc.startsWith('data:')) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user