Created
January 22, 2015 20:59
-
-
Save shershen08/edab3da7a932f6f94741 to your computer and use it in GitHub Desktop.
console parsing of page Книжный топ–лист D3
This file contains 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
//for page https://library.d3.ru/comments/613787/ | |
var allNodes = document.querySelectorAll('.c_body b'), result = []; | |
function getBooksWithRating(item,i) { | |
var newItem = {}, rate; | |
newItem.text = item.innerHTML; | |
rate = item.parentNode.parentNode.querySelectorAll('.vote_result')[0] ? item.parentNode.parentNode.querySelectorAll('.vote_result')[0].innerHTML : 0; | |
newItem.rating = rate; | |
if(rate > 30){ | |
result.push(newItem); | |
} | |
} | |
Array.prototype.forEach.call(allNodes, getBooksWithRating); | |
console.info(result.length); | |
copy(result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment