Skip to content

Instantly share code, notes, and snippets.

@dracos
Created Mar 14, 2017
Embed
What would you like to do?
Sarah & Duck upcoming episodes
PID = 'b04drklx'
for date in arrow.Arrow.range('day', arrow.now(), arrow.now().replace(weeks=1)):
soup = BeautifulSoup(get_contents('http://www.bbc.co.uk/cbeebies/programmes/schedules/%s' % date.format('YYYY/MM/DD')))
for series in soup.findAll('span', resource=re.compile(PID)):
root = series.findParents(typeof="BroadcastEvent")[0]
season = root.find(typeof='TVSeason')
start_time = root.find(property='startDate')['content']
title = season.nextSibling.string
series_num = season.find(property='name').string
episode_num = root.find('abbr').find(property='position').string
synopsis = root.find(property='description').string
PID = 'b04drklx'
j = json.loads(get_contents('http://www.bbc.co.uk/programmes/%s/episodes/upcoming.json' % PID))
for broadcast in j['broadcasts']:
start_time = arrow.get(broadcast['start'])
title = broadcast['programme']['title']
series_num = broadcast['programme']['programme']['position']
episode_num = broadcast['programme']['position']
synopsis = broadcast['programme']['short_synopsis']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment