Skip to content

Instantly share code, notes, and snippets.

@amaxwell01
Created May 7, 2016 05:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amaxwell01/71aa3e1598ccddea697d97bd9aa7ad11 to your computer and use it in GitHub Desktop.
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
/*
* 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