PSP ISO Scraper

theGrayFox

New member
Jun 22, 2014
2
0
0
My first post: despite the fact that this isn't dealing with SEO, this helped me learn the basics of writing bots and automation. This is really designed to help you receive the top rated PSP ISO games available via emuparadise.me. I'm hoping to start a node.js warchest on here very soon.

[high=coffeescript]
request = require('request')
cheerio = require('cheerio')
json2csv = require('json2csv')
fs = require('fs')
url = 'http://goo.gl/cc4HRc'
pspISOs = []

request url, (error, response, html) ->
if not error and response.statusCode is 200
$ = cheerio.load(html)
$('.gamelist').each ->
titles = $(this).text()
ratings = +parseFloat($(this)
.parents("tr").find("td")
.last().text()).toFixed(2)

pspISOs.push
title: titles
rating: ratings

topISOs = pspISOs.filter((iso) ->
iso.rating >= 4.81
)
columns = Object.keys(topISOs[0])
json2csv
data: topISOs
fields: columns
, (err, csv) ->
console.log err if err
fs.writeFile "psp_iso.csv", csv, (err) ->
throw err if err
console.log 'Saved.'
[/high]
 


Thanks! For some reason, WikedFire wouldn't let me post it natively in JavaScript. Also, I apologize for this not being properly formatted. It appears it doesn't read CoffeeScript. Any idea how to format this?
 
My first post: despite the fact that this isn't dealing with SEO, this helped me learn the basics of writing bots and automation. This is really designed to help you receive the top rated PSP ISO games available via emuparadise.me. I'm hoping to start a node.js warchest on here very soon.

[high=coffeescript]
request = require('request')
cheerio = require('cheerio')
json2csv = require('json2csv')
fs = require('fs')
url = 'http://goo.gl/cc4HRc'
pspISOs = []

request url, (error, response, html) ->
if not error and response.statusCode is 200
$ = cheerio.load(html)
$('.gamelist').each ->
titles = $(this).text()
ratings = +parseFloat($(this)
.parents("tr").find("td")
.last().text()).toFixed(2)

pspISOs.push
title: titles
rating: ratings

topISOs = pspISOs.filter((iso) ->
iso.rating >= 4.81
)
columns = Object.keys(topISOs[0])
json2csv
data: topISOs
fields: columns
, (err, csv) ->
console.log err if err
fs.writeFile "psp_iso.csv", csv, (err) ->
throw err if err
console.log 'Saved.'
[/high]


great share, thanks. :)