Designing a Twitter Data Extractor Tool Using Python — Part 2 (Models)
User and Tweet models
2 min readApr 13, 2023
In the previous post, I mentioned the general structure of the call mechanism. In this post, I will show the main data holder classes.
There are two classes implemented as dataclass
which are User
and Tweet
.
User
Fields to extract for user data
- User ID
- Username
- Name
- Account creation date
- Bio
- URLs, Hashtags, Mentions
- Location
- Pinned Tweet ID
- Pinned Tweet
- Profile image URL
- Account protected flag
- Public metrics (followers/following/tweet/listed counts)
- External URL
- Verified flag
A data dictionary is prepared in the __post_init__
method for reporters to use later.