Download data from CNBC!
Project description
Download news data from CNBC! CNBC's API
*** IMPORTANT LEGAL DISCLAIMER ***ycnbc is not affiliated, endorsed, or vetted by CNBC, It's an open source tool that uses Web Scraping and is intended for research and educational purposes. |
ycnbc offers a threaded and Pythonic way to news and market data from CNBC.
Quick Start
Requirements
- Python >=3.5+
- pandas>=0.24.0
- requests>=2.26
- lxml>=4.5.1
Installation
$ pip install ycnbc --upgrade --no-cache-dir
Usage
import ycnbc
# get trending news
trending_ = ycnbc.get_trendingnews() # return DataFrame
# get latest news
latest_ = ycnbc.get_latestnews() # return DataFrame
# get data by categories or urls
data_ = ycnbc.get_datanews('economy') # return DataFrame
or,
categories = [
'world-economy', 'us-economy', 'federal-reserve', 'central-banks', 'jobs', 'banks', 'investing',
'hedge-funds', 'deals-and-ipos', 'insurance',
'venture-capital', 'coronavirus', 'wall-street',
'economy', 'health-and-science', 'media',
'climate', 'wealth', 'life',
'small-business', 'energy', 'finance',
'transportation', 'industrials', 'real-estate',
'retail', 'cybersecurity', 'enterprise',
'internet', 'media', 'mobile',
'white-house', 'china-politics', 'social-media',
'policy', 'defense', 'congress',
'hospitals', 'life-and-health-insurance'
]
for i in categories:
print(ycnbc.get_datanews(i))
note -> The category parameter is a URL.
For example, if you want to retrieve data from the url https://www.cnbc.com/economy/, then you can simply call it ycnbc.get_datanews('economy')
.
Legal Stuff
ycnbc is distributed under the Apache Software License. See the LICENSE.txt file in the release for details.
P.S.
Please drop me an note with any feedback you have.
Asep Saputra
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
ycnbc-1.0.1.tar.gz
(8.7 kB
view hashes)
Built Distribution
ycnbc-1.0.1-py2.py3-none-any.whl
(10.4 kB
view hashes)
Close
Hashes for ycnbc-1.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 785669ae5ee2d8f8f0bf9d71705ac64b22f8988478471b7c2be16688c67718ef |
|
MD5 | e311986d2e129dec5f5ca31dc70f633a |
|
BLAKE2b-256 | eaf694dfc79b4f837d94fede22af3063a76cb303ad6bda03b2fe72fe0a612707 |