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 following pip command:
pip install tweepy
- MongoClient: The class MongoClient enables one to make successful MongoDB server connections with your code. Install it using following pip command:
pip install pymongo
- Pyshorteners: Pyshorteners is 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:
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
- Open this link https://apps.twitter.com/ and click the button: ‘Create New App’
- Fill 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