Created
May 7, 2016 05:06
-
-
Save amaxwell01/71aa3e1598ccddea697d97bd9aa7ad11 to your computer and use it in GitHub Desktop.
Get an array of objects with tv show name and episodes, in my Google Play movies colletion
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
/* | |
* Return a Array of objects with tv show name and episodes, in my Google Play movies colletion | |
* https://play.google.com/movies | |
* Must be signed in and viewing the page for this to work | |
* Created by: Andrew Maxwell | |
* Created on: May 6th, 2016 | |
*/ | |
var tvShowsList = Array.prototype.slice.call(document.querySelectorAll('#body-content > div > div > div.main-content > div > div:nth-child(2) > div.tvshow-library > div')); | |
var getEpisodes = function(episodes) { | |
episodeNames = episodes.map(function(episode) { | |
var name = episode.children[0].children[2].children[1].innerText; | |
name = name.replace(' ', ''); | |
name = name.replace(' ', ''); | |
return name; | |
}); | |
return episodeNames; | |
}; | |
var tvShows = tvShowsList.map(function(show) { | |
var showObject = { | |
show_title: show.children[0].childNodes[1].innerText.split('\n')[0], | |
episodes: getEpisodes(Array.prototype.slice.call(show.children[0].childNodes[3].children)) | |
}; | |
return showObject; | |
}); | |
copy(tvShows); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment