The InstaPost class

class InstaTweet.instapost.InstaPost(data, client=None)[source]View on GitHub

Bases: object

Minimalistic API response wrapper for an Instagram post

__init__(data, client=None)[source]View on GitHub

Initialize an InstaPost

Parameters

data (dict) – the JSON response data of a single Instagram post, found within the user_data

json

Source data from API response

id

The post id

filepath: str

Path of downloaded media, set by download_post()

tweet_data: dict

Limited data from a successful tweet based off this post, set by send_tweet()

property children: List[InstaPost]

If the post is a carousel, returns a list of child InstaPost’s

property shortcode: str
property caption: str
property likes: Optional[int]
property media_url: str

The direct URL to the actual post content

Returns

the video_url if the post is a video, otherwise the thumbnail_url

property thumbnail_url: str
property is_downloaded: bool

Checks the filepath to see if the post has been downloaded yet

property filename: str

Concatenates id + filetype to create the default filename, for use when saving the post

For Example:

>> print(post.filename)
"2868062811604347946.mp4"
property filetype: str

Filetype of the post, based on the value of is_video

property owner: Dict
property timestamp: Union[datetime, str]
add_tweet_data(tweet)[source]View on GitHub

Used by TweetClient to add minimal tweet data after the post has been tweeted

Parameters

tweet (Status) – a Status object from a successfully sent tweet

Return type

bool