Created
May 26, 2016 13:04
-
-
Save MrMamen/8a46e1567cf37c54b2f8279ba2641732 to your computer and use it in GitHub Desktop.
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
ItemParser.parse = function parse(callback) { | |
var item; | |
var type = document.querySelector("meta[name=type]").getAttribute("content") == 'episode' ? 'show' : 'movie'; | |
var mainTitle = document.querySelector("meta[name=title]").getAttribute("content"); | |
if (type === 'show') { | |
var uri = document.querySelector("li.episode-item.active a").getAttribute("href"); | |
if (uri.split("/")[4].substring(0, 6) !== "sesong") { | |
return; | |
} | |
var season = uri.split("/")[4].slice(7); | |
var number = document.querySelector("meta[name=episodenumber]").getAttribute("content"); | |
var title = document.querySelector("meta[name=seriestitle]").getAttribute("content"); | |
item = new Item({ | |
epTitle: mainTitle, | |
title: title, | |
season: season, | |
episode: number, | |
type: type | |
}); | |
} else { | |
item = new Item({ title: mainTitle, type: type }); | |
} | |
callback.call(this, item); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment