-
-
Save mfrancois3k/f3f25a7a669d8f3d501d93ac5fa8c763 to your computer and use it in GitHub Desktop.
Scrapes the current forbidden/limited list for Yu-Gi-Oh! cards and converts it to JSON.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var _ = require('underscore') | |
| var cheerio = require('cheerio') | |
| var request = require('request') | |
| var println = console.log | |
| request('http://www.yugioh-card.com/en/limited/', function (err, res, body) { | |
| var $ = cheerio.load(body) | |
| var cards = [] | |
| $('#colfull_main table tr').each(function (i, elem) { | |
| var data = $(elem).children('td') | |
| .map(function (ii, e) { | |
| return $(e).text() | |
| }) | |
| .get() | |
| cards.push({ | |
| "type" : data[0], | |
| "name" : data[1].replace(/\s+/g, ' '), | |
| "status" : data[2], | |
| "comment" : data[3] | |
| }) | |
| }) | |
| println(JSON.stringify(cards, null, '\t')) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment