Skip to content

Instantly share code, notes, and snippets.

@srob650
Last active January 22, 2017 01:45
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 srob650/745f6a074d69974106c20d50000350ac to your computer and use it in GitHub Desktop.
Save srob650/745f6a074d69974106c20d50000350ac to your computer and use it in GitHub Desktop.
[pytvmaze] Get all episodes for show for next 7 days
import datetime
import pytvmaze
today = datetime.datetime.now()
week = today + datetime.timedelta(days=7)
tvm = pytvmaze.TVMaze()
# Edit maze_id for desired show
s = tvm.get_show(maze_id=279)
eps = [episode for episode in s.episodes
if datetime.datetime.strptime(episode.airdate, '%Y-%M-%d') >= today
and datetime.datetime.strptime(episode.airdate, '%Y-%M-%d') <= week]
print(eps)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment