Scrape most reviewed news and tweet using Python
Many websites will be providing trendy news in any technology and the article can be rated by means of its review count. Suppose the news is for cryptocurrencies and news articles are scraped from cointelegraph.com, we can get each news item reviewer to count easily and placed in MongoDB collection.
- Tweepy: Tweepy is the Python client for the official Twitter API. Install it using the following pip command:
pip install tweepy
- MongoClient: The class MongoClient enables one to make successful MongoDB server connections with your code. Install it using the following pip command:
pip install pymongo
- Pyshorteners: Pyshorteners are used to shorten, brand, share, or retrieve data from links programmatically. Install it in the below ways
pip install pyshorteners
In order to fetch tweets through Twitter API, one needs to register an App through their Twitter account. Follow these steps for the same:
- Open this link https://apps.twitter.com/ and click the button: ‘Create New App’
- Fill in the application details. You can leave the callback URL field empty.
- Once the app is created, you will be redirected to the app page.
- Open the ‘Keys and Access Tokens tab.
- Copy ‘Consumer Key’, ‘Consumer Secret’, ‘Access token’, and ‘Access Token Secret’ and paste them in the below code.
Below is the implementation.
Impactful News of the Day
Veteran Investor Says….https://bit.ly/2X1x51V
Bitcoin Hashrate Drops….https://bit.ly/2T83xyS
The VC Who….https://bit.ly/3czxVKb
#bitcoin #cryptocurrency #blockchain #investor #altcoins #fintech #investment