Last active
March 6, 2016 14:44
-
-
Save justlaputa/50b9c23980e6efcc0876 to your computer and use it in GitHub Desktop.
run this script in chrome console in imdb's oscar awards page, you can get a list of all oscar movies
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
| var movies = {} | |
| var order = 0 | |
| function getLink(link) { | |
| link = link.substring(0, link.lastIndexOf('?')) | |
| return 'http://www.imdb.com' + link | |
| } | |
| function addMovie(category, title, link) { | |
| if (!movies[title]) { | |
| movies[title] = {} | |
| movies[title].nominees = [] | |
| movies[title].order = order++ | |
| } | |
| movies[title].link = link | |
| movies[title].nominees.push(category) | |
| } | |
| $('.nominationsCategory').each(function() { | |
| var $category = $(this) | |
| var categoryDescription = $category.find('.nominatedFor').text() | |
| $category.find('.nominee').each(function(){ | |
| var $item = $(this) | |
| var link = $item.find('.list_item>a').attr('href') | |
| var title = null | |
| if (link.startsWith('/title/')) { | |
| title = $item.find('img').attr('title') | |
| } else if ($item.find('.details > .forTitleDesktop').length > 0) { | |
| title = $item.find('.details > .forTitleDesktop > a').text().trim() | |
| } else { | |
| return true | |
| } | |
| addMovie(categoryDescription, title, link) | |
| }) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment