The InstaTweet
class
Not to be confused with the package, the InstaTweet
class is the main point of interaction for a user of
the package
It uses a fully configured
Profile
to initialize anInstaClient
andTweetClient
, which are used to scrape and tweet posts whenstart()
is called
…
- class InstaTweet.instatweet.InstaTweet(profile)[source]View on GitHub
Bases:
object
Uses the settings from a Profile to do the actual InstaTweeting
You might be wondering, what’s InstaTweeting? According to TDK Dictionary:
InstaTweet (verb):
To load a
Profile
🠖 scrapeposts
from its Instagram users 🠖download_post()
&send_tweet()
for any new content 🠖 update theuser_map
🠖save()
the profile if itexists
Example Sentence
Oh, you lost 700 Twitter followers after you shared your IG post? Well maybe if people actually saw the picture and not just the caption your tweet would’ve been less creepy. You should’ve InstaTweeted it.
- __init__(profile)[source]View on GitHub
Initializes
InstaTweet
using a fully configuredProfile
The
Profile
will be used to initialize anInstaClient
andTweetClient
Note
InstaTweet won’t
validate()
the Profile settings until you callstart()
- classmethod load(profile_name, local=True)[source]View on GitHub
Loads a profile by name
- Parameters
- Return type
- get_proxies()[source]View on GitHub
Retrieve proxies using the loaded Profile’s
proxy_key
- get_insta_client()[source]View on GitHub
Initializes an
InstaClient
using the loadedProfile
settings- Return type
- get_tweet_client()[source]View on GitHub
Initializes an
TweetClient
using the loadedProfile
settings- Return type
- start()[source]View on GitHub
InstaTweets all users that have been added to the loaded
Profile
Each user’s IG page will be scraped and compared to the
scraped
list in theirUSER_MAPPING
. Posts that weren’t previously scraped will be downloaded and tweetedNote
If
InstaTweet
fails todownload_post()
orsend_tweet()
, theUSER_MAPPING
won’t be updatedThis ensures that failed repost attempts are retried in the next call to
start()
If a save file for the Profile already
exists
, successful reposts will trigger a call tosave()
- get_new_posts(username)[source]View on GitHub
Scrapes recent posts from an Instagram user and returns all posts that haven’t been tweeted yet
NOTE: If a user’s
scraped
list is empty, no posts will be returned.- Instead, the user is “initialized” as follows:
Their
scraped
list will be populated with the ID’s from the most recent postsThese IDs are then used in future calls to the method to determine which posts to tweet