Crawler to collect user timelines and favorites of any users.
- can retrieve user timelines and favorites of any users as JSON files.
- can wait for a reasonable amount of time until the API limits are lifted.
Just clone this and start using it.
git clone [email protected]:kazumasa-kusaba/TwitterCrawler.git
Just do:
pip install requests requests_oauthlib
Write your access token information to config.json
located in this project's parent directory.
Replace each preset values with your own informations.
{
"twitter_api": {
"access_token": "ACCESS_TOKEN",
"access_token_secret": "ACCESS_TOKEN_SECRET",
"consumer_key": "CONSUMER_KEY",
"consumer_secret": "CONSUMER_SECRET"
}
}
usage twittercrawler.py [-h] [-q] command [target_screen_name [target_screen_name ...]]
positional arguments:
command the command you want to run
target_screen_name screen name of the target name
optional arguments:
-h, --help show this help message and exit
-q, --quiet do not output log
command name | description |
---|---|
retrieve_user_timelines | retrieve and save the user timelines of any user specified by the arguments |
retrieve_favorites | retrieve and save the favorites of any user specified by the arguments |
If you want to retrieve @Cristiano (Cristiano Ronaldo) and @BarackObama (Barack Obama) timelines...
python twittercrawler.py retrieve_user_timelines Cristiano BarackObama
The retrieved timelines are in the directories (results/user_timelines/
)
If you want to retrieve their favorites...
python twittercrawler.py retrieve_favorites Cristiano BarackObama
The retrieved favorites are in the directories (results/favorites/
)
MIT License
Copyright (c) 2021 Kazumasa Kusaba
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.