Segunda parte proyecto base de datos 2.
- python
- pip
- flask(?)
- snscrape
We need snscrape.
sudo apt-get update
pip install --upgrade git+https://github.com/JustAnotherArchivist/snscrape
python data/tweets.py
Enter a topic or keyword, please: covid 19
Enter the number of max tweets: 200
Then this will get all 200 first tweets with the word "covid 19" until 30-06-21.
In the line 11 in data/tweets.py, is the specific query in the search in twitter, if you want to change the parameters of the search, like the language or if you want only the retweets, got to that line. An example is:
If I want to only search in a range of dates:
for i,tweet in enumerate(sntwitter.TwitterSearchScraper(keyword + ' lang:es since:2021-06-25 until:2021-06-30 -filter:links -filter:replies').get_items()) :
This will get the tweets with the keyword, between 2021-06-25 and 2021-06-30.
How to use snscrape.
Use of snscrape