Skip to content

Instantly share code, notes, and snippets.

@ivantsov
Last active April 2, 2022 17:40
Show Gist options
  • Save ivantsov/c7741ab6be9623049800 to your computer and use it in GitHub Desktop.
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)
let MIN_RATING = 6;
let MIN_VOICES = 7000;
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