A python package to get news, weather, and sports from BBC
Project description
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
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
Built Distribution
File details
Details for the file bbc-feeds-2.1.tar.gz
.
File metadata
- Download URL: bbc-feeds-2.1.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 847761bd7660e1cf0040f5022ca7f8c52ce6f51054cfb45b2ecbaf9b72e41b5d |
|
MD5 | cdee12d84b3a27aa0f1481376aac6fd6 |
|
BLAKE2b-256 | ef89ac7ada9c32082e132d19c177c78baa89b09d6455f64c77abd0c9234683c2 |
File details
Details for the file bbc_feeds-2.1-py3-none-any.whl
.
File metadata
- Download URL: bbc_feeds-2.1-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0183b7206bf5a255c8ad45f1170bc8b01293ed62ae04696082648ff8863b6c99 |
|
MD5 | b1e8ac74234a66193029b0cd23713f31 |
|
BLAKE2b-256 | 7d3cfd31812b703c635bd1599c1789bfc0276a90a46b017b27a730c01d6f60d7 |