Created
March 14, 2017 15:33
-
-
Save dracos/6f80a9395813ce81beb89c2096396762 to your computer and use it in GitHub Desktop.
Sarah & Duck upcoming episodes
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
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 |
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
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