IonicaBizau / scrape-it

🔮 A Node.js scraper for humans.

Home Page:http://ionicabizau.net/blog/30-how-to-write-a-web-scraper-in-node-js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't get long urls

mehrancodes opened this issue · comments

I'm trying to get an image url from the img tag but it returns nothing because it's a little long.

scrapeIt("https://www.ccn.com/what-is-bitcoin-ranked-among-top-google-searches-in-2018/", {
    image: {
      selector: '.wp-post-image',
      attr: "src"
    }
})

Please help how to make it possible

With a little debugging the scrape-it line 158 $elm, I found that the attributes of the selected img tag coinain data-cfsrc instead of src. so I used it instead.

let $elm = cOpt.selector ? $(cOpt.selector, $cContext) : $cContext

$elm Object
screenshot from 2018-12-13 15-53-08