📜 ⬆️ ⬇️

Laziness worked instagram



Foreword


Now many people use instagram (further insta): someone collects albums there, someone sells, someone buys, and I'm lazy there. I was always wondering how my friends, classmates, colleagues and insta were doing there to help. I wanted to find out what was new there - I went in, I looked through the tape, I saw everything that interested I had left ... BUT! For some reason I always had to like every post (I can not explain why, but such are the cases). And imagine, I didn’t go there for a week, you sit, you like a weekly pool, and when you have 200+ subscriptions, it’s all hell.

Active activities


As a result, like any normal person, I was too lazy to like everything and I scored. It seems that everything was fine, I stopped spending a lot of time on useless huskies, but my conscience ate me. I understood that subscribers are bad without my royal husky, they feel sad and blah blah ... In general, it was decided that you need to write something simple and easy that can solve the problem of resentment, and maybe help someone else. From friends I have heard a lot about python and how to test applications using selenium or use it as a certain crawler. It was decided to use python and selenium in conjunction with phantom js, it was all new to me, because Before that, I was not familiar with these technologies at all.

Why Selenium and phantom?


It's all very simple. The instagram client part is written on react, therefore, any data can be pulled there only after the page is srenderen. Since selenium just serves to automate actions in the browser, and phantom js helps to do it all without any display, it was decided to use them. Looking ahead to say that I decided to give up phantom js due to the fact that it is quite slow, and chrome had a headless option, which allowed it to be used as a “headless” browser.
')

Why python?


I heard and read a lot about the fact that this language is great for working with big data, from here I concluded that it is convenient to work with any data at all (to parse, sort, compare, format, etc.), I also read somewhere that it’s convenient and quick to write my own mini-library (and this is what is needed for the bot to make it as versatile as possible). After weighing everything, I decided to stop on python3 (before this, part of the project was already written with the ability to run on python2 and python3).


Library development for the bot


It’s stupid to describe the whole process, so let’s focus on the most interesting points:


Conclusion


There is still a lot to do, optimize, rewrite. You can always effectively use the tool for other purposes. Laziness is precisely the engine of progress. I hope someone my bot will help or in work, or a hobby. A repository with a pypi-package can help a beginner automator. A repository with examples may be useful for SMM users. Thank you all for your attention.

Links


Source: https://habr.com/ru/post/347774/


All Articles