bbc-feeds
A python package to get news, weather, and sports from BBC.
Installation
pip3 install bbc-feeds
Usage
- Import the library:
import bbc_feeds - Call a class and then a function with
bbc_feeds.news().all(). In this example news is the class and the function is all. This will return a list of news stories as a dictionary.
Example
The below example gets the first three stories from the homepage (all) and prints out the story name and summary.
import bbc_feeds
stories = bbc_feeds.news().all(limit=3)
for story in stories:
print(story.title)
print(story.summary)
To get a list of the dictionary keys available use the keys() function.
Functions
News
| Function Name | Category | RSS Feed | Optional Parameters |
|---|---|---|---|
news().all() |
Home | http://feeds.bbci.co.uk/news/rss.xml | limit |
news().world() |
World | http://feeds.bbci.co.uk/news/world/rss.xml | limit |
news().uk() |
UK | http://feeds.bbci.co.uk/news/uk/rss.xml | limit |
news().north_america() |
America and Canada | http://feeds.bbci.co.uk/news/world/us_and_canada/rss.xml | limit |
news().entertainment() |
Entertainment & Arts | http://feeds.bbci.co.uk/news/entertainment_and_arts/rss.xml | limit |
news().business() |
Business | http://feeds.bbci.co.uk/news/business/rss.xml | limit |
news().tech() |
Technology | http://feeds.bbci.co.uk/news/technology/rss.xml | limit |
news().science() |
Science and Environment | http://feeds.bbci.co.uk/news/science_and_environment/rss.xml | limit |
news().top_stories() |
Home | http://feeds.bbci.co.uk/news/rss.xml?edition=int | limit edition |
top_stories() has the optional parameter edition which is used to set the edition to use when getting the top stories. You can set edition to the following:
- uk - UK Top stories
- us - US Top stories
- int - International Top stories
Sports
| Function Name | Category | RSS Feed | Optional Parameters |
|---|---|---|---|
sports().all() |
Home | https://feeds.bbci.co.uk/sport/rss.xml | limit |
sports().cricket() |
Cricket | https://feeds.bbci.co.uk/sport/cricket/rss.xml | limit |
sports().soccer() |
Soccer | https://feeds.bbci.co.uk/sport/football/rss.xml | limit |
sports().tennis() |
Tennis | https://feeds.bbci.co.uk/sport/tennis/rss.xml | limit |
sports().athletics() |
Athletics | https://feeds.bbci.co.uk/sport/athletics/rss.xml | limit |
sports().golf() |
Golf | https://feeds.bbci.co.uk/sport/golf/rss.xml | limit |
sports().boxing() |
Boxing | https://feeds.bbci.co.uk/sport/boxing/rss.xml | limit |
sports().swimming() |
Swimming | https://feeds.bbci.co.uk/sport/swimming/rss.xml | limit |
sports().cycling() |
Cycling | https://feeds.bbci.co.uk/sport/cycling/rss.xml | limit |
sports().formula1() |
Formula1 | https://feeds.bbci.co.uk/sport/formula1/rss.xml | limit |
Weather
weather().forecast(city_id)(To get your city ID, search for it on the BBC Weather's Website).
All functions have an optional parameter limit, where you can limit the number of entries.
CLI
Usage: bbc [OPTIONS] COMMAND [ARGS]...
Get BBC feeds of several categories
Options:
--help Show this message and exit.
Commands:
news
sports
weather
Release files for bbc-feeds 2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bbc-feeds-2.1.tar.gz | 3.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bbc_feeds-2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.2 kB
Release files / bbc-feeds-2.1.tar.gz
| Download URL | bbc-feeds-2.1.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
847761bd7660e1cf0040f5022ca7f8c52ce6f51054cfb45b2ecbaf9b72e41b5d
|
|
BLAKE2b-256 checksum How to use checksums |
ef89ac7ada9c32082e132d19c177c78baa89b09d6455f64c77abd0c9234683c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.4
|
Release files / bbc_feeds-2.1-py3-none-any.whl
| Download URL | bbc_feeds-2.1-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0183b7206bf5a255c8ad45f1170bc8b01293ed62ae04696082648ff8863b6c99
|
|
BLAKE2b-256 checksum How to use checksums |
7d3cfd31812b703c635bd1599c1789bfc0276a90a46b017b27a730c01d6f60d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.4
|