Instagram Bot: Making a #Tag Slideshow Using Simple JaveScript

Instagram Bot to create slideshow. 

If you have an TV or a screen and an old computer lying around and you want to automatize the process of looking into hashtags without having to physically click the buttons, then you are in the right place. There's a simple way of creating a web bot which can help you create a slideshow. This is especially useful when you have guests at home and you want something to run on the background with the music. Or simply check what people are up to.

The system I use is windows and I have implemented this code on Chrome using their Java Console which can be accessed with Ctrl + Shift + J. I am thinking if you have Chrome installed on your Raspbian (Chromium) or Mac, then the code should run on it too.

The manual thing you have to do is:

1) Visit www.instagram.com
2) Log in
3) Search a hashtag. E.g. #craftbeer or #momos. Then click on a picture so that it come to the fore. 
4) Press Crtl+Shift+J in chrome to launch Java Console.
4) In the console paste the code below and change parameters (note 5000 is 5s which is interval between each slides. Additionally, you can change how many slides you want to view when you change the number in slideCount < 5, 5 being the number)

[For some reason I can't seem to change the HTML format at which the code is being printed on the screen. Will look into it later]

var slideCount = 0;
var nextTime = 5000;
var nextElement = document.querySelector('.coreSpriteRightPaginationArrow');
function executeSlide() {
nextElement.click();
slideCount++
console.log ('Slide' + slideCount);
if (slideCount < 5) {
setTimeout(executeSlide, nextTime);
} else {
console.log ('End of Slide');
}
}

5) To run the show, you have to type in the excuteSlide (); and then press Enter.

executeSlide();

6) Press F11 for full screen and F12 to hide the console.
7) Pop open a bottle of good stout.

As you will realize, the possibilities of such code could extend to whatever you want the bot to do. But for now, let's keep things ethical and simple. 

Have fun!


Comments

Popular Posts