Last active
October 26, 2024 14:31
-
-
Save ivantsov/c7741ab6be9623049800 to your computer and use it in GitHub Desktop.
Filter movies premier by rating and voices count on the kinopoisk.ru (https://www.kinopoisk.ru/comingsoon/digital/?year=2021&month=12)
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
let MIN_RATING = 6.7; | |
let MIN_VOICES = 20000; | |
let movies = document.querySelectorAll('.premier_item'); | |
[...movies].forEach((movie, index) => { | |
const ratingBlock = movie.querySelector('.ajax_rating'); | |
const ratingElem = ratingBlock.querySelector('u'); | |
const voicesElem = ratingBlock.querySelector('b'); | |
rating = ratingElem ? parseFloat(ratingElem.innerHTML) : 0; | |
voices = voicesElem ? parseInt(voicesElem.innerHTML.replace(' ', ''), 10) : 0; | |
if (rating < MIN_RATING || voices < MIN_VOICES){ | |
movie.style.display = 'none'; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment