Skip to main content

A modern interface to the BBC Sounds radio catalogue

Project description

beeb

A modern interface to the BBC Sounds radio catalogue.

Usage

beeb centres around the ChannelSchedule, which stores a single day's listings, for a single channel.

  • National, local, regional channels can be selected by ID or short name
  • The schedule with today's date is loaded by default

To load today's schedule for BBC R4:

from beeb.nav import ChannelSchedule
ChannelSchedule.from_channel_name("r4")

ChannelSchedule for BBC Radio 4 on 2021-03-16

These ChannelSchedule objects can be used to find programmes:

>>> from beeb.nav import ChannelSchedule
>>> s = ChannelSchedule.from_channel_name("r4")
>>> s.get_broadcast_by_title("Today", pid_only=True)
'm000t476'
>>> s.get_broadcast_by_title("Midnight News")
00:00 on 17/03/2021  Midnight News
>>> for b in s.get_broadcast_by_title("Shipping Forecast", multi=True): b
00:48 on 17/03/2021  Shipping Forecast
05:20 on 17/03/2021  Shipping Forecast
12:03 on 17/03/2021  Shipping Forecast
Click here for more complex examples

>>> for b in s.get_broadcast_by_title(r".*\bNews\b", regex=True, multi=True): b
... 
00:00 on 17/03/2021  Midnight News
05:30 on 17/03/2021  News Briefing
12:00 on 17/03/2021  News Summary
18:00 on 17/03/2021  Six O'Clock News
>>> for b in s.get_broadcast_by_title(r".*\bnews\b", multi=True,
... case_insensitive=True, regex=True, synopsis=True): print(b)
... 
00:00 on 17/03/2021  Midnight News
05:30 on 17/03/2021  News Briefing
06:00 on 17/03/2021  Today
12:00 on 17/03/2021  News Summary
13:00 on 17/03/2021  World at One
17:00 on 17/03/2021  PM
18:00 on 17/03/2021  Six O'Clock News
20:00 on 17/03/2021  Moral Maze
22:00 on 17/03/2021  The World Tonight
23:30 on 17/03/2021  Today in Parliament
>>> for b in s.get_broadcast_by_title(
... r".*\b(pandemic|virus|coronavirus|Covid|vaccines?|vaccinations?|health|healthcare|NHS)\b",
... multi=True, case_insensitive=True, regex=True, synopsis=True): print(b)
... 
10:00 on 17/03/2021  Woman's Hour
15:00 on 17/03/2021  Money Box
15:30 on 17/03/2021  Inside Health

As well as schedules for a single day, beeb has ChannelListings, a collection of ChannelSchedule objects over a given time period (from up to 30 days ago).

>>> from beeb.nav import ChannelListings
>>> ChannelListings.from_channel_name("r4")
ChannelListings for BBC Radio 4 from 2021-02-17 to 2021-03-18 (30 days)

The schedules are stored as a chronological list in the ChannelListings.schedules attribute

>>> from beeb.nav import ChannelListings
>>> l = ChannelListings.from_channel_name("r4")
ChannelListings for BBC Radio 4 from 2021-02-17 to 2021-03-18 (30 days)
>>> l.schedules[0]
ChannelSchedule for BBC Radio 4 on 2021-02-17

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

beeb-1.1.1.tar.gz (6.0 MB view hashes)

Uploaded Source

Built Distribution

beeb-1.1.1-py3-none-any.whl (15.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page