diff --git a/src/google/scraper.js b/src/google/scraper.js index 4514c76..8f04422 100644 --- a/src/google/scraper.js +++ b/src/google/scraper.js @@ -197,9 +197,11 @@ class GoogleScraper { $('#islrg div[jsaction][data-tbnid]').each(function (_i, containerElement) { const containerElement_ = $(containerElement); - const linkElementHref = containerElement_.find("a[href^='/imgres']").attr('href'); - if (linkElementHref) { - // linkElementHref could be undefined + const linkElementHrefExpectedSelectors = ["a[href^='/imgres']", "a[jsaction]"]; + const linkElementHref = linkElementHrefExpectedSelectors + .map(s => containerElement_.find(s).attr('href')) + .find(e => e); + if (linkElementHref) { // linkElementHref could be undefined const imageElementAlt = containerElement_.find('img').attr('alt'); const parsedLink = url.parse(linkElementHref, { parseQueryString: true }); const imageurl = parsedLink.query.imgurl;