Monday 29 February 2016

Node Returning Null when Web Scraping

I'm currently trying out some code which is meant to look for a specific torrent of Kickass Torrents as a proof of concept, but for some reason my simple code is failing to return any value besides null, despite the fact that I have confirmed that a torrent exists with the ID that I have in the program. searchTerm = "photoshop" var request = require("request"), cheerio = require("cheerio"), url = "https://kat.cr/usearch/" + searchTerm + "/"; request(url, function (error, response, body) { if (!error) { var $ = cheerio.load(body), magnet = $("[data-id='233B2C174D5FEF9D6AFAA61D150EC0B6F821D6A9'] href").html(); console.log(magnet) } });

Submitted March 01, 2016 at 01:51AM by jasch16

No comments:

Post a Comment