Reputation: 1153
I'm using website-scraper to make some static templates of a node app I'm working on. I cant seem to be able to get images which have srcset values, website-scraper will update the src value, but not the srcset value. Do I need to pass another value in the sources?
Upvotes: 0
Views: 368
Reputation: 98
As answered in github issue your sources
option should contain { selector: 'img', attr: 'srcset' }
rule if your html contains tags like
<img srcset="/2x.jpg 2x, /1x.jpg 1x" src="/fallback.jpg" >
For example:
const options = {
urls: 'http://example.com',
directory: '/path/to/save/',
sources: [
{ selector: 'img', attr: 'srcset' }
]
};
Upvotes: 1