Jasch1
Jasch1

Reputation: 573

Node.js Returning Null when Scraping HTML

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 retun any value besides null, depsite 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)
  } 
});

Upvotes: 0

Views: 473

Answers (1)

user6147192
user6147192

Reputation:

The main KickAssTorrents site, kat.cr, encrypts the data that is returned. Instead, you could use http://kickasstorrentseu.com, which doesn't encrypt what is returned

Upvotes: 1

Related Questions