Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* getranks.js
- *
- * Copyright (c) 2016 xBlau <daniel@blaudev.es>
- * Distributed under the terms of the MIT License.
- *
- * phantomjs[.exe] getranks.js {link} >> ranks.csv
- *
- */
- var system = require( 'system' );
- var page = require( 'webpage' ).create();
- function main() {
- var RankData = page.evaluate( function() {
- var Result = '';
- var TabRows = document.getElementsByClassName( 'table select' )[0].rows;
- var Position, Name, Page, Points;
- var StartIndex = 1;
- if( TabRows[1].className == 'paginate' ) {
- StartIndex = 2;
- }
- for( i = StartIndex; i < TabRows.length - 1; i++ ) {
- if( i != StartIndex ) { Result += "\n"; }
- Position = TabRows[i].cells[0].innerText;
- Name = TabRows[i].cells[1].innerText;
- Page = TabRows[i].cells[1].firstChild.href;
- Points = TabRows[i].cells[2].innerText.replace( ' ' , '' );
- Result += Position + ',' + Name + ',' + Page + ',' + Points;
- }
- return Result;
- });
- console.log( RankData );
- phantom.exit();
- }
- page.open( system.args[1], main );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement