Created
September 7, 2018 09:21
-
-
Save bit2shift/7d066b2dfe6e5650c8b654f0c6ee56a6 to your computer and use it in GitHub Desktop.
Generates a list of filenames for each episode of a season from a series on IMDB
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
'use strict'; | |
{ | |
let _2digits = n => ('0' + n).slice(-2); | |
let name = document.querySelector('[itemprop=url]').text; | |
let season = document.querySelector('#bySeason').value; | |
let titles = []; | |
document.querySelectorAll('meta[itemprop=episodeNumber], a[itemprop=name]').forEach | |
( | |
function(e, i) | |
{ | |
switch(e.tagName) | |
{ | |
case 'META': | |
titles[i >> 1] = `${name} S${_2digits(season)}E${_2digits(e.content)} - `; | |
break; | |
case 'A': | |
titles[i >> 1] += `${e.title}.mkv`; | |
break; | |
} | |
} | |
); | |
console.log(titles.join('\n')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment