A look at the Perl Events Instagram account automation
Sawyer and I started this last year at the Perl Toolchain Summit
Lee Johnson (LEEJO / leejo / lee@humanstate.com)
(Hit "P" if you're viewing this presentation on the web)
A look at the Perl Events Instagram account automation
Sawyer and I started this last year at the Perl Toolchain Summit
I'm posting images from various Perl events I attend and also from others I don't attend
This is a photo from The Perl Conference in Salt Lake City earlier this year, taken by Wendy
I think this is a great photo.
The Perl Conference in Amsterdam last year.
In the off season I'm posting Perl related photos, here's some Perl poetry on my fridge by a couple of friends (who aren't programmers)
I'm trying to keep the content as photographic as possible - no memes, no jokes, just "photos" in the traditional sense.
So everything is uploaded manually and it's curated, and I'm not taking a machine gun approach to uploads. A couple a day during an event and then maybe one or two a month in the off season.
It would be nice to get followers, but this is the kind of content that gets posted to Instagram within the particular target market.
It's not photographic, and I have absolutely no interest in looking at it. So I don't want to wade through a mass of shit.
And of course Instagram is now full of adverts, which I don't want to look at either.
So much blockchain...
Instagram started off as a platform for photography, now it seems to be a marketing platform. We can take advantage of that, right?
InstaPy is an automation Script for “farming” Likes, Comments and Followers on Instagram
from instapy import InstaPysession = InstaPy( username=insta_username, password=insta_password, headless_browser=True)session.login()# follow everyone we likesession.set_do_follow( enabled=True, percentage=100, times=2)# like all photos with these tagssession.like_by_tags( [ 'perl5', 'perl6' ], skip_top_posts=False, amount=25)# end the bot sessionsession.end()
The library is very simple to use and well documented...
from instapy import InstaPysession = InstaPy( username=insta_username, password=insta_password, headless_browser=True)session.login()# follow everyone we likesession.set_do_follow( enabled=True, percentage=100, times=2)# like all photos with these tagssession.like_by_tags( [ 'perl5', 'perl6' ], skip_top_posts=False, amount=25)# end the bot sessionsession.end()
You login...
from instapy import InstaPysession = InstaPy( username=insta_username, password=insta_password, headless_browser=True)session.login()# follow everyone we likesession.set_do_follow( enabled=True, percentage=100, times=2)# like all photos with these tagssession.like_by_tags( [ 'perl5', 'perl6' ], skip_top_posts=False, amount=25)# end the bot sessionsession.end()
Configure the bot, in this case "follow everyone's images that we like"
from instapy import InstaPysession = InstaPy( username=insta_username, password=insta_password, headless_browser=True)session.login()# follow everyone we likesession.set_do_follow( enabled=True, percentage=100, times=2)# like all photos with these tagssession.like_by_tags( [ 'perl5', 'perl6' ], skip_top_posts=False, amount=25)# end the bot sessionsession.end()
Then tell it how to find the images to like, here it will find images tagged with "perl5" or "perl6"
[ # perl! 'perl5', 'perl6', # the rest 'coding', 'codingbootcamp', 'codingisfun', 'codinglife', 'computerengineering', 'computerprogramming', 'computing', 'cprogramming', 'creativecoding', 'development', 'erlang', 'girlswhocode', 'github', 'golang', 'hack', 'hacker', 'java', 'javascript', 'linux', 'opensource', 'php', 'programmer', 'programming', 'programmingisfun', 'programminglanguage', 'programminglanguages', 'programminglife', 'programmingstudents', 'python', 'rubyprogramming', 'software', 'softwaredeveloper', 'softwaredevelopers', 'softwaredevelopment', 'softwareengineer', 'softwareengineering', 'softwareengineers', 'softwares', 'startup', 'tech', 'webdevelopment', 'webprogramming', 'womenintech', 'womenwhocode', ]
Of course we look for more images than just those tagged with "perl5" or "perl6"
The script takes a few hours to run due to the number of tags, and it throttles itself to prevent it hitting the API limits.
commit 9e40abd6c539e971443834bac9eba2b288a72da2Author: Lee Johnson <lee@givengain.ch>Date: Fri Apr 20 21:22:58 2018 +0200 be more specific with the #perl hashtag use #perl5 instead so we don't end up following a load of non-programming related accounts
diff --git a/bin/instagram_bot.py b/bin/instagram_bot.pyindex 7a831ce..8e01564 100644--- a/bin/instagram_bot.py+++ b/bin/instagram_bot.py@@ -47,7 +47,7 @@ try: # like all photos with these tags session.like_by_tags( [- 'perl',+ 'perl5', 'perl6', 'c', 'code',
Following #perl lead to a mass of jewellery/makeup related accounts
And of course we end up following lots of not-actually-programming-related accounts due to other tags anyway
Python...
But the hit rate is reasonable, and the return isn't bad either.
The library has functions to unfollow users depending on particular settings so we don't hit limits on those.
And those accounts that we do get right can be pretty interesting and help us to get out of the echo chamber maybe?
A coder in Mexico
An aspiring developer
Liverpool Girl Geeks
Founders of coding related groups
Maybe they're now aware of Perl thanks to the bot?
We're up to about 2,000 followers after running the script once a day for about four months. If even 5% of them are now a little bit more aware of Perl then it's probably a good return on the investment of the hour or so it took me to put it together.
The Perl Events Instagram bot is casting a very wide net, it's possible to be much more specific with the InstaPy library (read the docs, it's very configurable and even has options to try to detect other bot based accounts - a bit of a contradiction, but whatever)
This account is for the gallery I'm involved with in the village back home
session.like_by_locations( [ # actual places '216921418/villars/', '241218410/villars-vaud-switzerland/', '670455/villars-sur-ollon/', '261044104/sur-les-pistes-villars/', '293286136/bretaye/', '256352451/gryon-switzerland/', '259527434/bex-vaud/', ... ], amount=25, skip_top_posts=False)
It has a small selection of hash tags to follow, but concentrates more on those images that are geo-tagged in the local area.
The idea is that any visitors to the village who post to Instagram, and geo-tag their images, will be made aware of the gallery within a few hours of posting. This tends to happen quite a lot during the ski season.
Has it worked? We've had a couple of visitors tell us that they heard about us through Instagram, so yes
Instagram is now a marketing platform
This is an image I posted to my own account about eighteen months ago. I geo-tagged and hash-tagged it and got the occasional like from businesses in the area for several months after I uploaded it (It's not an interesting image, but anyway). The tags as generic as they come, and nobody is scrolling through the millions of images just to like yet another images of a sunset from an airplane window. Just the bots.
If your account is public, and you're tagging your images, then I'm willing to bet that at least 50% of the likes are automated and maybe even some of the comments.
Likes are meaningless in a social media context, it seems like a conditioned reflex for many users. It's why I've never liked an update, post, photo, comment, or anything else on social media, nor will I ever "like" them. If I really like something I'll tell you directly.
One last thing - if you're interested in photography I'm giving a talk at this year's Swiss Perl Workshop, in Bern, about using this camera, plus a little Perl code, to move mountains.
InstaPy:
Perl Events:
Me:
Instagram and Bots:
If you're interested in more here are the links to the various accounts and scripts on github
Sawyer and I started this last year at the Perl Toolchain Summit
Keyboard shortcuts
↑, ←, Pg Up, k | Go to previous slide |
↓, →, Pg Dn, Space, j | Go to next slide |
Home | Go to first slide |
End | Go to last slide |
Number + Return | Go to specific slide |
b / m / f | Toggle blackout / mirrored / fullscreen mode |
c | Clone slideshow |
p | Toggle presenter mode |
t | Restart the presentation timer |
?, h | Toggle this help |
Esc | Back to slideshow |