Last active
January 2, 2022 17:37
-
-
Save codotronix/f01d28eba61f56f4f5dc3fc258422844 to your computer and use it in GitHub Desktop.
scraping imdb top 100 list data
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
| /** | |
| * Script to Scrape and Create the list of JSON Objects | |
| */ | |
| let movies = [] | |
| $('.lister-list .lister-item').each(function(){ | |
| let movie = { | |
| title: $(this).find('.lister-item-header a').text().trim(), | |
| released: $(this).find('.lister-item-year').text().replace(/[()]/gi, '').trim(), | |
| certificate: $(this).find('.certificate').text().trim(), | |
| runtime_min: $(this).find('.runtime').text().replace('min','').trim(), | |
| genre: $(this).find('.genre').text().trim(), | |
| rating_imdb: $(this).find('.ratings-imdb-rating strong').text().trim(), | |
| metascore: $(this).find('.ratings-metascore .metascore').text().trim(), | |
| description: $(this).find('p.text-muted').eq(1).text().trim(), | |
| votes: $(this).find('.sort-num_votes-visible [name="nv"]').eq(0).text().replace(/[,]/gi,'').trim(), | |
| gross_million_dollar: $(this).find('.sort-num_votes-visible [name="nv"]').eq(1).text().replace(/[$M]/gi,'').trim(), | |
| link: $(this).find('.lister-item-header a').attr('href').trim(), | |
| } | |
| movies.push(movie) | |
| return null | |
| }) | |
| console.log(movies[0]) // see 1 data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment