def __init__(self, user: User): self.created_at: str = preprocess_date( user.__getattribute__("created_at")) self.default_profile: bool = user.__getattribute__("default_profile") self.default_profile_image: bool = user.__getattribute__( "default_profile_image") self.favourites_count: int = user.__getattribute__("favourites_count") self.followers_count: int = user.__getattribute__("followers_count") self.friends_count: int = user.__getattribute__("friends_count") self.geo_enabled: bool = user.__getattribute__("geo_enabled") self.id: int = user.__getattribute__("id") self.lang: str = self.get_language( text=user.__getattribute__("description")) self.location: str = "N/A" if user.__getattribute__( "location") is None or user.__getattribute__( "location") == "" else user.__getattribute__("location") self.statuses_count: int = user.__getattribute__("statuses_count") self.profile_background_image_url: str = user.__getattribute__( "profile_background_image_url") self.profile_image_url: str = user.__getattribute__( "profile_image_url") self.screen_name: str = user.__getattribute__("screen_name") self.verified: bool = user.__getattribute__("verified") self.average_tweets_per_day: float = get_average_tweets_per_day( statuses_count=self.statuses_count, created_at=user.__getattribute__("created_at")) self.account_age_days: int = get_account_age_in_days( created_at=user.__getattribute__("created_at")) self.botometer_analysis: dict = {} self.uuid: str = self.get_128_uuid(data_str=str(self.id))
def __init__(self, user: TwintUser): self.created_at: str = preprocess_date( user.__getattribute__("created_at")) self.default_profile: bool = user.__getattribute__("default_profile") self.default_profile_image: bool = user.__getattribute__( "default_profile_image") self.description: str = user.__getattribute__("bio") self.favourites_count: int = user.__getattribute__("likes") self.followers_count: int = user.__getattribute__("followers") self.friends_count: int = user.__getattribute__("following") self.geo_enabled: bool = user.__getattribute__("geo_enabled") self.id: int = user.__getattribute__("id") self.lang: str = self.get_language(text=user.__getattribute__( "lang")) if user.__getattribute__("lang") is not None else \ self.get_language(text=user.__getattribute__("bio")) self.location: str = "N/A" if user.__getattribute__( "location") is None or user.__getattribute__( "location") == "" else user.__getattribute__("location") self.profile_background_image_url: str = user.__getattribute__( "background_image") self.profile_image_url: str = user.__getattribute__("avatar") self.screen_name: str = user.__getattribute__("username") self.statuses_count: int = user.__getattribute__("tweets") self.verified: bool = user.__getattribute__("is_verified") self.average_tweets_per_day: float = get_average_tweets_per_day( statuses_count=self.statuses_count, created_at=user.__getattribute__("created_at")) self.account_age_days: int = get_account_age_in_days( created_at=user.__getattribute__("created_at")) self.name: str = user.__getattribute__("name") self.url: str = user.__getattribute__("url") try: self.profile_banner_url: str = user.__getattribute__( "profile_banner_url") except Exception as e: self.profile_banner_url: str = \ "https://i.picsum.photos/id/1021/2048/1206.jpg?hmac=fqT2NWHx783Pily1V_39ug_GFH1A4GlbmOMu8NWB3Ts" self.profile_url: str = "https://twitter.com/" + self.screen_name.replace( "@", "") self.listed_count: int = user.__getattribute__("media_count ") self.botometer_analysis: dict = {}