Skip to content

Instantly share code, notes, and snippets.

@5225225
Created January 10, 2015 16:22
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 5225225/828b9ac12cffa1cec632 to your computer and use it in GitHub Desktop.
Save 5225225/828b9ac12cffa1cec632 to your computer and use it in GitHub Desktop.
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