go-shiori / obelisk

Go package and CLI tool for saving web page as single HTML file
MIT License
247 stars 17 forks source link

Can not resolve the lazy load image [2] #48

Open Katarn opened 1 year ago

Katarn commented 1 year ago

Continuation of the bug from issue #2.

Most often, links to stubs are written in src. I think these lines are redundant:

https://github.com/go-shiori/obelisk/blob/23c015a8fad738f183b98f04416c8c6075640ba9/process-html.go#L366-L368

But I would not bypass all the attributes in a row, but read only the values ​​​​from data-src and data-original. For example, Yandex search engine supports it:

Images are downloaded using links from the src attribute of the img tag, as well as the data-src and data-original attributes (in this case, the presence of a link to the image in the src attribute is not necessary).

github-actions[bot] commented 9 months ago

This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 5 days

Monirzadeh commented 6 months ago

@Katarn can you share a webpage this problem happen.

<img src="https://ik.imagekit.io/demo/img/image1.jpeg?tr=w-400,h-300" loading="lazy" />
<img src="https://ik.imagekit.io/demo/img/image2.jpeg?tr=w-400,h-300" />
<img src="https://ik.imagekit.io/demo/img/image3.jpg?tr=w-400,h-300" />

work fine for me.

Katarn commented 5 months ago

It’s strange, but I can’t reproduce it myself now. Looks like I made a mistake somewhere. I'm sorry.

Katarn commented 4 months ago

Please, try it: https://habr.com/ru/companies/tuturu/articles/781224/

<img src="https://habrastorage.org/r/w780q1/webt/js/gh/h2/jsghh2fhr6xz7zoolf2i2pwxl5u.jpeg"
     data-src="https://habrastorage.org/webt/js/gh/h2/jsghh2fhr6xz7zoolf2i2pwxl5u.jpeg"
     data-blurred="true"
     />