From 4569db9a1390770e4ec25ff4c068e4a40c9633a9 Mon Sep 17 00:00:00 2001 From: Kuppuraj Date: Sun, 14 Feb 2016 19:39:34 +0530 Subject: [PATCH] Update server.js This is the new format for getting name , date and rating --- server.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server.js b/server.js index 2b31d23..1bd92b6 100644 --- a/server.js +++ b/server.js @@ -15,26 +15,26 @@ app.get('/scrape', function(req, res){ var title, release, rating; var json = { title : "", release : "", rating : ""}; - $('.header').filter(function(){ + $('.title_wrapper').filter(function(){ var data = $(this); title = data.children().first().text(); - release = data.children().last().children().text(); + release = data.children().last().children().last().text(); json.title = title; json.release = release; }) - $('.star-box-giga-star').filter(function(){ + $('.ratingValue').filter(function(){ var data = $(this); rating = data.text(); json.rating = rating; }) - } - fs.writeFile('output.json', JSON.stringify(json, null, 4), function(err){ console.log('File successfully written! - Check your project directory for the output.json file'); }) + } + res.send('Check your console!') }) @@ -42,4 +42,4 @@ app.get('/scrape', function(req, res){ app.listen('8081') console.log('Magic happens on port 8081'); -exports = module.exports = app; \ No newline at end of file +exports = module.exports = app;