・ Because I wanted to keep the image of the tweet I liked. ・ To look back at tweets that you liked in the past.
The purpose of writing this program was because I wanted to eliminate the inconvenience I felt.
When I tried to look at the tweets I liked in the past, I felt that it was very difficult to use because the current Twitter specifications had no choice but to scroll down the screen to find it.
I wondered if I could solve this problem, and found out that the company that manages Twitter offers api. I thought I could make it myself this way, so I made this program in python language.
There are two commitments to this program.
One is that we aimed for highly readable code. This is so that the person reading the code and the future self can understand it in as little time as possible.
I used a function to make the main processing part refreshing, and devised a function name so that it is easy to understand what kind of processing is being performed inside.
The second is that it is easy to customize.
By changing the value of the variable at the beginning of the code, you can change the number of users' accounts and images to get.
Also, you can set the maximum number of images that can be saved in the image save folder.
Python …… I wrote the skeleton code in this language. Pandas …… A library that allows you to handle data frames within python. request …… Used to check if data exists at the end of the url path from python. json …… A library that allows you to handle json format data in python. csv …… Used to enable output from python in csv file format. os …… I used python so that the directory path to the save folder can be used. re …… Used to perform regular expression operations in python. This removes the characters and symbols that are not available in the windows environment. Twitter API …… The official API provided by Twitter. Use this to get a tweet. Tweepy …… A library that makes it easy to use the Twitter API in python. Jupyter Notebook …… Used as the main editor. Trial and error of the code was done in this. VScode …… Editor. Finally, I used it for a clean copy of the code and a test execution of the program. Sourcetree …… Used for version control and code backup with git.
Source code ... https://gist.github.com/takutakumi/999a8e76fe725f4e38002bf39c5657d7
Recommended Posts