Created
January 10, 2015 16:22
-
-
Save 5225225/828b9ac12cffa1cec632 to your computer and use it in GitHub Desktop.
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
import time | |
import random | |
import xml.etree.ElementTree as ET | |
import requests | |
output = [] | |
sys.stderr.write("Enter season number: ") | |
seasonnum = input() | |
sys.stderr.write("Enter total amount of episodes: ") | |
episodes = input() | |
# Yes, this can be easily gotten. But I already know this, and I don't really | |
# want to write code to find it out. | |
APIKEY = <INSERT API KEY HERE> | |
SERIESNUM = "76703" | |
for item in range(1, int(episodes)+1): | |
# Use 1 based indexing | |
epdata = requests.get("http://thetvdb.com/api/{}/series/{}/default/{}/{}/7.xml".format( | |
APIKEY, | |
SERIESNUM, | |
str(seasonnum), | |
str(item), | |
) | |
).content | |
epname = ET.fromstring(epdata)[0][3].text | |
output.append("Pokémon SE{} EP{} - {}.avi".format( | |
str(seasonnum), | |
str("00" + str(item))[-2:], | |
epname, | |
)) | |
sys.stderr.write("On episode {}\n".format(item)) | |
for index, item in enumerate(output): | |
print("{}\t./{}".format(str(str(index + 1)), item)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment