Skip to content

feature: Support data-src and data-srcset - #220

Merged
xroche merged 1 commit into
xroche:masterfrom
brianredbeard:data-image-fix
Dec 30, 2022
Merged

xroche merged 1 commit into
xroche:masterfrom
brianredbeard:data-image-fix

Conversation

@brianredbeard

Copy link
Copy Markdown
Contributor

Increasingly HTML5 sites use a number of mechanisms for responsive
image loading. Many of these mechanisms revolve around the use of
data-src and data-srcset attributes within an img tag to provide a
list of valid images to display, along with their relevant sizes (e.g.
https://github.com/aFarkas/lazysizes, https://github.com/malchata/yall.js).

This change adds the two previously mentioned tags to the list in
hts_detect[], resulting in httrack detecting them correctly.

Initially an attempt was made at using hts_detectbeg[] with the
potential of resolving #203. Unfortunately it became apparent that the
implementation of hts_detectbeg[] only supports a suffix of integers
(see src/htstools.h#rech_tageqbegdigits for more information).

Increasingly HTML5 sites use a number of mechanisms for responsive
image loading.  Many of these mechanisms revolve around the use of
`data-src` and `data-srcset` attributes within an img tag to provide a
list of valid images to display, along with their relevant sizes (e.g.
https://github.com/aFarkas/lazysizes, https://github.com/malchata/yall.js
).

This change adds the two previously mentioned tags to the list in
`hts_detect[]`, resulting in httrack detecting them correctly.

Initially an attempt was made at using `hts_detectbeg[]` with the
potential of resolving xroche#203.  Unfortunately it became apparent that the
implementation of `hts_detectbeg[]` only supports a suffix of integers
(see `src/htstools.h#rech_tageqbegdigits` for more information).
@pat

pat commented Jul 24, 2022

Copy link
Copy Markdown

I realise httrack could very well not receive any further updates, but just wanted to say thank you @brianredbeard for this PR. I just checked out the branch locally, compiled, then ran it on a site where I needed to get images referenced via data-src attributes, and it worked exactly as I needed/expected it to! 👏🏻

@xroche
xroche merged commit 8a65d5a into xroche:master Dec 30, 2022
@brianredbeard
brianredbeard deleted the data-image-fix branch May 19, 2023 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants