Running a Profile
Once a Profile
is configured, it can be used to initialize and
start()
an InstaTweet
object
from InstaTweet import InstaTweet, Profile
# Load an existing saved or unsaved profile into InstaTweet
>>> profile = Profile.load("myProfile")
>>> insta_tweet = InstaTweet(profile)
# Or directly InstaTweet.load() the settings in by Profile name
>>> insta_tweet = InstaTweet.load(profile_name="myProfile")
# Then run InstaTweet by calling start()
>>> insta_tweet.start()
From the Docs…
- InstaTweet.start(max_posts=12)[source]View on GitHub
InstaTweets all pages that have been added to the loaded
Profile
The most recent posts from each page will be scraped, then compared to the
scraped
list in thePAGE_MAPPING
to determine which are new.Up to
max_posts
new posts from each page will then be downloaded and tweetedNote
If
InstaTweet
fails todownload_post()
orsend_tweet()
, thePAGE_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()
- Parameters
max_posts (int) – the maximum number of new posts to download and tweet per page
As InstaTweet
runs, its progress will be logged to console:
Starting InstaTweet for Profile: myProfile
Checking posts from @the.dailykitten
...
Checking posts from #thedailykitten
...
Finished insta-tweeting for #thedailykitten
All pages have been insta-tweeted