A simple Python 3 module to get crypto or news articles and their content from various RSS feeds.
- Clone the repo locally.
- Use the package manager pip to install the requirements.
pip install -r requirements.txt
import NewsScraper
all_data = NewsScraper.fetch_all()
news_data = NewsScraper.fetch_news_data()
crypto_data = NewsScraper.fetch_crypto_data()
fetch_all()
Returns a set of NewsScraper.Result
containing fetched results from all available RSS feeds
Can include categories: GLOBAL
, US
, EU
, CRYPTO
, BLOCKCHAIN
, BTC
, ETH
, LTC
.
fetch_news_data()
Returns a set of NewsScraper.Result
containing fetched results from CNN, ABC News, Yahoo News, Fox News RSS feeds
Can include categories: GLOBAL
, US
, EU
.
fetch_crypto_data()
Returns a set of NewsScraper.Result
containing fetched results from CoinJournal, Crypto Currency News RSS feeds.
Can include categories: CRYPTO
, BLOCKCHAIN
, BTC
, ETH
, LTC
.
A class used to represent a returned article.
Attributes
-
A string describing the category of the article.
ex.
"GLOBAL"
,"US"
,"BLOCKCHAIN"
,"BTC"
. -
A string containing the name of the article.
-
A string containing the summary of the article.
NOTE: sometimes it can have the value of
""
, because the RSS feed didn't provide a summary. -
A string containing the content of the article.
Methods
-
Returns a dictionary with the attributes of the class formatted in JSON.
ex.
{
"context": "global",
"title": "title of the article",
"summary": "summary of the article",
"content": "content of the article"
}
All of these functions return a set of NewsScraper.Result
containing fetched results of the described RSS feeds.
fetch_abc()
fetch_cnn()
fetch_yahoo()
fetch_fox_news()
Can include categories: GLOBAL
, US
, EU
.
Alternatively, you can use fetch_news_data()
to receive results from all of them.
All of these functions return a set of NewsScraper.Result
containing fetched results of the described RSS feeds.
fetch_coinjournal()
fetch_cryptocurrencynews()
Can include categories: CRYPTO
, BLOCKCHAIN
, BTC
, ETH
, LTC
.
Alternatively, you can use fetch_news_data()
to receive results from all of them.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT license.