How to code instagram
How to Make an App Like Instagram?
A photo and video-sharing app like Instagram takes social mobile networks to the next level. This simple but distinctive Burbn (Instagram’s former name) app idea seeded funding worth $500K, which allowed for the building of a product on iOS, Android, and Windows phone platforms. Furthermore, after two more funding rounds, the project collected $57.5M in total and ten investors.
Instagram’s founders - Kevin Systrom and Mike Krieger - sold their startup to Facebook in 2012 for $1 billion ($300 million in cash, the rest in Facebook stock). Currently, Instagram is a free app with a net worth of more than $100 billion US.
Many businesses were inspired by the success of Instagram. This success resulted in the appearance of other well-known photo-sharing apps: Swipe, Snapchat, Vine, Camera, Flickr. All of these apps utilize photo and video content, but vary in their core value and functionality. Specifically, there is potential in a photo-sharing app business once this uniqueness is found. Simply making a clone of Instagram won’t give good results. Besides, it takes years and millions of dollars to copy the platform.
According to Statista, the number of smartphone users will reach almost 3 billion by the end of 2020. Since every smartphone has a camera, their owners take a lot of shots and gladly share them with the help of apps.
Therefore, at MLSDev we find it useful to explain what it takes to create a photo-sharing app like Instagram. We will cover the evolution of the product, its functionality, and elements that allow apps similar to Instagram to be built.
Evolution of Instagram Mobile App
Evolution of Instagram on Mobile Screens
These days, Instagram, the leading social photo-sharing app, is well known all over the world. According to official statistical information, 95 million pictures are posted on Instagram daily. In 2018, the number of monthly active Instagram users reached 1 billion - almost one-eighth of the world’s population.
Who would expect such great achievement? The story of Instagram started with a simple but unique feature - adhering a photo in a square with a few filters. This functionality can be considered the MVP of Instagram, which further allowed the company to receive greater investments and develop a solid project for major mobile platforms (iOS, Android, and Windows phone).
It is worth mentioning that when Instagram was released, photo-sharing and editing tools existed separately on the market. The combination of both elements became the Unique Selling Proposition. Within the next 2 months the platform gained 1 million active users.
Currently, Instagram is a free photo-sharing app for Android and iOS smartphones, and there is also a web-based Instagram version for uploading and sharing photos. It is no longer a simple photo app, but rather a social platform offering wide functionality for business owners and marketing specialists.
Let's now check out Instagram through the lens of photo-editing app, e-commerce portal, and messenger.
Instagram as a Photo-editing App
The Instagram app has lots of colorful filters and elements with which to adjust photos. Users can change a photo’s size, adjust its brightness, contrast, structure, warmth, and use markers, texts, and other elements.Instagram as an E-commerce Platform
Social Commerce is a new technology reshaping the future of e-commerce. Photo-sharing apps are known to be the most engaging platforms with which brands and companies can benefit by showcasing their products. Instagram is earning commission from each transaction made via its platform.
- Instagram as a Messenger “Direct,” a messenger within Instagram, is an integral part of the platform and any other social network these days. The feature allows users to share highlights, exchange ideas, and connect more deeply with other users.
The Instagram project never stands still. The most recent version of Instagram experienced a design update as well as some new features, namely:
Instagram Updates 2018
- IGTV - Instagram TV for vertical video sharing up to one-hour in length; it is now possible to create a personal channel.
- Stories - a section to share your highlights as a photo or short 15-second video.
- Shoppable posts - shopping tags connected to the posts allows users to make purchases directly from the app. This makes Instagram a significant sales channel.
- Nametags - a tool utilizing QR code principle. Allows for the creation of personalized “nametags” to be scanned by other individuals, who are then given the option to follow you. This makes it easier for users to connect and is a great asset for brands.
- New quick replies in Direct - the feature which will be used to save and customize generic responses, especially useful for business profiles.
- Explore page - redesigned app screen
Having covered the core information about Instagram and its evolution, it is valuable to understand how to actually start your own Instagram-like app.
How to Create an App Like Instagram Successfully
In this section, we cover things to consider while building an Instagram-like mobile app.
For starters, development of any mobile app demands a lot of planning and preparatory work. The process of building a social photo-sharing app includes:
- Conduct market research to define your target audience and its preferences
- Evaluate competitive photo-sharing apps
- Finalize your unique and outstanding app concept
- Define your further strategy in terms of your goals with the project, budget, timeline, and technologies
- Prepare your marketing and PR strategy and start promoting the app from the early stages
- Build communication channels with your users to gain quick and up-to-date client feedback
- Select a capable offshore software development company to design, develop, test, and launch your social photo-sharing app.
- Keep up with the competitors and evolve the project further with additional functionality, design elements, and reach out to new user groups
Understandably, photo-sharing application development requires significant investments. Of course, when creating an app you want to not only implement your idea, but also make money. Instagram’s revenue model consists of in-app advertising, sponsorship, and an online shopping platform.
The most widely used and appropriate ways to monetize the type of app being discussed:
- Sponsorship and advertisements (In photo-sharing apps, businesses can create their own profiles, advertise themselves by posting images, and gain followers)
- In-app purchases (here you have a wide range of things you can put up for sale, from custom filters and effects, to enabling users to sell their photos so that you receive a commission)
- Offering special deals to active users
Once all the project’s preparatory materials are ready, you can start building your own social media app like Instagram starting from the first version of the product.
This first version can be a basic photo-sharing app with the core functionality. Only the unique feature, app concept, design, and app branding makes a major difference at this point. It all helps to reach out to the target audience and create a strong brand mindset. Keep the following in mind:
- Intuitive user-navigation
- Clear designs (UX/UI)
- Eye-catching graphics and visual element (e.g logo)
- Personalized feed
- Well-functioning application
To finalize this part, here is a list of tips and recommendations for developing a photo-sharing app. These are things you may want to consider to succeed in creating an app similar to Instagram:
- Come up with a new and unique photo-editing tool inside the app. Create new filters, objects, textures, effects, and editing possibilities.
- Create the photo-sharing for a specific user group or themed app (e.g. designers, food or animal lovers, event-app etc). You may define this unique feature in a way that provides some value to this user group. In the end, you can create a great community.
- Offer functionality to create themed photo albums and set the photo or post privacy to send invitations only to selected users.
- Add functionality to share photos between phones and other devices easily without signing up.
- Assist your users with some photo-editing lessons, or provide them with tips to create top-notch user profiles.
How to Build Your Instagram Project
Have you ever wondered how much it costs to build an app like Instagram?
In this article, we will estimate the potential expenses and explain how to develop a photo-sharing app.
Let’s imagine that you have decided to build a photo-sharing app like Instagram. The first thing you should do is to analyze the key features to decide in which direction you should start moving.
As well, take a look at the Instagram interface, as it is the best example of photo and short video sharing application with a simple, user-friendly, and stylish design. The app is so easy and intuitive that new users should not have any difficulties figuring out how it works.
Therefore, it is important not only to plan how the app will work but also its appearance.
Instagram Technology Stack
In order to begin your own digital project, it is necessary to know the basics of the technologies used in your project.
Instagram Tech Stack
Instagram uses a vast number of different technologies, some of which may also be applicable in your startup. Instagram’s user app (front-end) is written in React Native, a cross-functional language compatible with both iOS and Android operating systems. For the back-end (server-side), Instagram uses Python (Django framework) and HTML5.
To sum it up, Instagram coding languages and frameworks include:
- JavaScript
- Python
- React
- React Native
- Java
Instagram also uses other tools for server management and compilers, and monitoring services making a great project infrastructure. In order to maintain such a loaded service, the company uses cloud computing services like Amazon S3, Amazon, EBS, and Amazon EC2. As well, PostgreSQL is a great solution for storing such a massive amount of data.
There is an even better way to develop a social photo-sharing app - natively. Native app development uses Swift for iOS and Kotlin for Android to provide the best app performance and user experience.
Basic Functionality of Instagram-like App
Once all the preparatory materials are ready: project mind map, functional specification, WBS (work breakdown structure), etc., it is possible to start with actual custom mobile app development. All these pieces are required to build your own custom social media app.
Below are the features that the core version of an image sharing app should have. Let’s examine these basics of an Instagram-like app:
1. Authorization
- creating a new account
- signing in into the existing account via social networks (there is an option to develop login via e-mail, but we do not recommend implementing this feature in the first app version since it is rather time-consuming)
2. Editing profile
- adding personal data
- editing personal data
- removing personal data
3. Post creation
- uploading pictures taken in the app or existing images from the gallery
- mentioning people, adding tags
4. Feed
- subscribing (one-way following)
- liking
- commenting
5. Social features
- sharing
- inviting friends from Facebook
6. Image customization
Standard options like:
- cropping
- rotating
- image adjustments
- applying filters
7. Geolocation features
- determining the geolocation of the existing image
- determining current geolocation and adding it to the post
8. Messaging
- text and photo messaging
9. Notifications
- push notifications
10. Search
- by username or full name
- by tags
- by post description
For more extended information and other specifics in social networking projects, read the article: How to Create a Social Media App.
How Much Does It Cost to Make an App Like Instagram?
In the table below, you can see the approximate time estimate for the software development services for the first basic version of a photo-sharing app:
Cost to Make an App Like Instagram
As for the design of a social photo-sharing app:
- UX will take approximately 64-96 hours
- UI takes around 48-64 hours
Additional design features can take as many as 16 hours and will depend on the complexity of the tasks. Keeping things simple and unintrusive is the best you can do here. All the icons, images, and fonts should be easy to perceive and inviting to the eye. As well, don’t forget to develop a great logo for your app; one that will distinguish it in the market, attract users, and pass along its message.
Given all of this data, let’s consider the approximate development cost for this kind of app. For calculation, we use a rate of $40 per hour (an average rate in Ukraine).
Total App Development Cost = (Development Time iOS/Android + Development Time Back End + Design (UX/UI) + Business Analysis + Project Management + Quality Assurance) x Hourly Rate
Based on this data, in total, the development of the first version of a basic, custom social networking app will cost around $60,000 for one platform. For more complex and feature-rich application, the price may reach $300,000 per platform.
On the other hand, it is hard to specify the cost to develop a social networking app without project specifications, especially considering we highlighted the importance of having a unique functionality. Thus, the presented information is just an example of the simplest social networking app. It is worth mentioning that the development cost will depend greatly on such factors as:
- Project priorities & constraints
- Business goals & context
- Budget constraints & timeline
- Developing vendor
- Technology preference
- Complexity of project functionality & design
In order for you to understand the estimation of a digital project in regards to a process and timeline, you can read the following article: How Much Does It Cost To Make An App?
KPIs to Follow for an App Like Instagram
You will need to measure the performance of your app; therefore, its Key Performance Indicators should be considered when developing your product.
1. Users
The first indicator to pay attention to is the number of active users. You can grow the audience engaged in your app, with the help of social media marketing, invitations to top users, and referral programs.
Regarding social media marketing, it is advisable to start your campaign at least half a year before the intended product launch date. It is a good idea to create pages for your app on social networks to reach out to your target audience. Rewarding users with features when they invite their friends to use your app is a thoughtful step that can quickly increase the overall number of users.
Like any application, social platform has its influencers, you can invite relevant celebrities to your app by giving them unlimited access and possibilities to promote themselves. In return, numerous fans of the influencer will join the app to keep in touch with updates from their favorite celebrity.
2. Engagement
The quantity of users who sign up for your app does not determine success on its own. There are other significant factors like the average amount of time people spend in the app, frequency of daily logins, number of files they upload, and likes they leave. All these indicators show how dedicated the users are and how likely they are to continue using the app.
3. Retention
You should remind users about your app occasionally, when it is convenient for them. Push notifications serve this purpose. However, before sending any, you should study your audience and schedule your pushes when the users are more likely to be available and willing to spend some time in the app. There are other ways to keep them in the application like organizing various competitions for the best-themed pictures, quizzes, and giveaways.
Being original is a must here. Do not cling to the illusion that you can make a fortune developing an Instagram clone. Since there is a successful original app out there, its users are not likely to switch to an unknown social media app unless it offers something very special that Instagram lacks.
For a startup, consider developing a unique product that will boast exclusive, attractive features. You might think of making a private photo-sharing application where pictures will be available to certain groups of people only. Chances are, you can create a successful photo-sharing app for events.
One more option would be to let users put a price on their pictures, so that businesses or bloggers could buy them or invent something else unique. No matter what killer feature you settle on, double-check whether or not it has already been done.
The Bottom Line
All in all, the development of a photo-sharing app like Instagram is all about picture processing, transferring, and storing. Pay attention to the fact that setting standards for the images that users want to upload is a must to ensure good looks in the profile gallery and feed. Instagram solved this issue by squaring. You can come up with any other idea for aligning and optimizing the images in your app.
Now you know how to make an app like Instagram and what is necessary in order to get the best outcome. If you deliver the highest quality product to people and do your best to enable them to fulfill their needs in an easy and convenient way, success will find you. Do not forget to keep up with the latest trends and remember that the largest amount of room you will ever have is the room for improvement.
Yummi App
Our team has experience in creating social photo-sharing apps. Yummi app is a platform to help track and share your eating adventures. The project keeps evolving and adding new functionalities.
Frequently Asked Questions:
How much money was invested in Instagram?
The Instagram app idea seeded funding worth $500,000, which allowed for the building of a product on iOS, Android, and Windows phone platforms. Furthermore, after two more funding rounds, the project collected $57.5M in total from ten investors.
What technology stack is used in the Instagram app?
Instagram’s user app (front-end) is written in React Native, a cross-functional language compatible with both iOS and Android operating systems. For the back-end (server-side), Instagram uses Python (Django framework) and HTML5. Amazon cloud computing services are used to maintain such a loaded service. As well, PostgreSQL is a great solution for storing such a massive amount of data.
How does Instagram make money?
Instagram earns profit with the help of the advertisement placed in the user feed or stories. To mention, these days, the application resembles an eCommerce platform or a marketplace, which promoted different products and services, rather than a social network.
How much does it cost to develop a simple version on Instagram?
The cost to make the first version of a custom social networking app like Instagram ranges anywhere from $50,000 to $80,000 (taking the average rate in Ukraine, $40 per hour). This includes services like UX/UI design, quality assurance, front-end and back-end development. To note, it is hard to specify the cost to develop a social networking app without project specifications and the presented information is just an example of the simplest social networking app.
How to Make an Instagram Bot With Python and InstaPy – Real Python
What do SocialCaptain, Kicksta, Instavast, and many other companies have in common? They all help you reach a greater audience, gain more followers, and get more likes on Instagram while you hardly lift a finger. They do it all through automation, and people pay them a good deal of money for it. But you can do the same thing—for free—using InstaPy!
In this tutorial, you’ll learn how to build a bot with Python and InstaPy, a library by Tim Großmann which automates your Instagram activities so that you gain more followers and likes with minimal manual input. Along the way, you’ll learn about browser automation with Selenium and the Page Object Pattern, which together serve as the basis for InstaPy.
In this tutorial, you’ll learn:
- How Instagram bots work
- How to automate a browser with Selenium
- How to use the Page Object Pattern for better readability and testability
- How to build an Instagram bot with InstaPy
You’ll begin by learning how Instagram bots work before you build one.
Important: Make sure you check Instagram’s Terms of Use before implementing any kind of automation or scraping techniques.
Free Bonus: 5 Thoughts On Python Mastery, a free course for Python developers that shows you the roadmap and the mindset you’ll need to take your Python skills to the next level.
How Instagram Bots Work
How can an automation script gain you more followers and likes? Before answering this question, think about how an actual person gains more followers and likes.
They do it by being consistently active on the platform. They post often, follow other people, and like and leave comments on other people’s posts. Bots work exactly the same way: They follow, like, and comment on a consistent basis according to the criteria you set.
The better the criteria you set, the better your results will be. You want to make sure you’re targeting the right groups because the people your bot interacts with on Instagram will be more likely to interact with your content.
For example, if you’re selling women’s clothing on Instagram, then you can instruct your bot to like, comment on, and follow mostly women or profiles whose posts include hashtags such as #beauty
, #fashion
, or #clothes
. This makes it more likely that your target audience will notice your profile, follow you back, and start interacting with your posts.
How does it work on the technical side, though? You can’t use the Instagram Developer API since it is fairly limited for this purpose. Enter browser automation. It works in the following way:
- You serve it your credentials.
- You set the criteria for who to follow, what comments to leave, and which type of posts to like.
- Your bot opens a browser, types in
https://instagram.com
on the address bar, logs in with your credentials, and starts doing the things you instructed it to do.
Next, you’ll build the initial version of your Instagram bot, which will automatically log in to your profile. Note that you won’t use InstaPy just yet.
Remove ads
How to Automate a Browser
For this version of your Instagram bot, you’ll be using Selenium, which is the tool that InstaPy uses under the hood.
First, install Selenium. During installation, make sure you also install the Firefox WebDriver since the latest version of InstaPy dropped support for Chrome. This also means that you need the Firefox browser installed on your computer.
Now, create a Python file and write the following code in it:
1from time import sleep 2from selenium import webdriver 3 4browser = webdriver.Firefox() 5 6browser.get('https://www.instagram.com/') 7 8sleep(5) 9 10browser.close()
Run the code and you’ll see that a Firefox browser opens and directs you to the Instagram login page. Here’s a line-by-line breakdown of the code:
- Lines 1 and 2 import
sleep
andwebdriver
. - Line 4 initializes the Firefox driver and sets it to
browser
. - Line 6 types
https://www.instagram.com/
on the address bar and hits Enter. - Line 8 waits for five seconds so you can see the result. Otherwise, it would close the browser instantly.
- Line 10 closes the browser.
This is the Selenium version of Hello, World
. Now you’re ready to add the code that logs in to your Instagram profile. But first, think about how you would log in to your profile manually. You would do the following:
- Go to
https://www.instagram.com/
. - Click the login link.
- Enter your credentials.
- Hit the login button.
The first step is already done by the code above. Now change it so that it clicks on the login link on the Instagram home page:
1from time import sleep 2from selenium import webdriver 3 4browser = webdriver.Firefox() 5browser.implicitly_wait(5) 6 7browser.get('https://www.instagram.com/') 8 9login_link = browser.find_element_by_xpath("//a[text()='Log in']") 10login_link.click() 11 12sleep(5) 13 14browser.close()
Note the highlighted lines:
- Line 5 sets five seconds of waiting time. If Selenium can’t find an element, then it waits for five seconds to allow everything to load and tries again.
- Line 9 finds the element
<a>
whose text is equal toLog in
. It does this using XPath, but there are a few other methods you could use. - Line 10 clicks on the found element
<a>
for the login link.
Run the script and you’ll see your script in action. It will open the browser, go to Instagram, and click on the login link to go to the login page.
On the login page, there are three important elements:
- The username input
- The password input
- The login button
Next, change the script so that it finds those elements, enters your credentials, and clicks on the login button:
1from time import sleep 2from selenium import webdriver 3 4browser = webdriver.Firefox() 5browser.implicitly_wait(5) 6 7browser.get('https://www.instagram.com/') 8 9login_link = browser.find_element_by_xpath("//a[text()='Log in']") 10login_link.click() 11 12sleep(2) 13 14username_input = browser.find_element_by_css_selector("input[name='username']") 15password_input = browser.find_element_by_css_selector("input[name='password']") 16 17username_input.send_keys("<your username>") 18password_input.send_keys("<your password>") 19 20login_button = browser.find_element_by_xpath("//button[@type='submit']") 21login_button.click() 22 23sleep(5) 24 25browser.close()
Here’s a breakdown of the changes:
- Line 12 sleeps for two seconds to allow the page to load.
- Lines 14 and 15 find username and password inputs by CSS. You could use any other method that you prefer.
- Lines 17 and 18 type your username and password in their respective inputs. Don’t forget to fill in
<your username>
and<your password>
! - Line 20 finds the login button by XPath.
- Line 21 clicks on the login button.
Run the script and you’ll be automatically logged in to to your Instagram profile.
You’re off to a good start with your Instagram bot. If you were to continue writing this script, then the rest would look very similar. You would find the posts that you like by scrolling down your feed, find the like button by CSS, click on it, find the comments section, leave a comment, and continue.
The good news is that all of those steps can be handled by InstaPy. But before you jump into using Instapy, there is one other thing that you should know about to better understand how InstaPy works: the Page Object Pattern.
Remove ads
How to Use the Page Object Pattern
Now that you’ve written the login code, how would you write a test for it? It would look something like the following:
def test_login_page(browser): browser.get('https://www.instagram.com/accounts/login/') username_input = browser.find_element_by_css_selector("input[name='username']") password_input = browser.find_element_by_css_selector("input[name='password']") username_input.send_keys("<your username>") password_input.send_keys("<your password>") login_button = browser.find_element_by_xpath("//button[@type='submit']") login_button.click() errors = browser.find_elements_by_css_selector('#error_message') assert len(errors) == 0
Can you see what’s wrong with this code? It doesn’t follow the DRY principle. That is, the code is duplicated in both the application and the test code.
Duplicating code is especially bad in this context because Selenium code is dependent on UI elements, and UI elements tend to change. When they do change, you want to update your code in one place. That’s where the Page Object Pattern comes in.
With this pattern, you create page object classes for the most important pages or fragments that provide interfaces that are straightforward to program to and that hide the underlying widgetry in the window. With this in mind, you can rewrite the code above and create a
HomePage
class and a LoginPage
class:
from time import sleep class LoginPage: def __init__(self, browser): self.browser = browser def login(self, username, password): username_input = self.browser.find_element_by_css_selector("input[name='username']") password_input = self.browser.find_element_by_css_selector("input[name='password']") username_input.send_keys(username) password_input.send_keys(password) login_button = browser.find_element_by_xpath("//button[@type='submit']") login_button.click() sleep(5) class HomePage: def __init__(self, browser): self.browser = browser self.browser.get('https://www.instagram.com/') def go_to_login_page(self): self.browser.find_element_by_xpath("//a[text()='Log in']").click() sleep(2) return LoginPage(self.browser)
The code is the same except that the home page and the login page are represented as classes. The classes encapsulate the mechanics required to find and manipulate the data in the UI. That is, there are methods and accessors that allow the software to do anything a human can.
One other thing to note is that when you navigate to another page using a page object, it returns a page object for the new page. Note the returned value of go_to_log_in_page()
. If you had another class called FeedPage
, then login()
of the LoginPage
class would return an instance of that: return FeedPage()
.
Here’s how you can put the Page Object Pattern to use:
from selenium import webdriver browser = webdriver.Firefox() browser.implicitly_wait(5) home_page = HomePage(browser) login_page = home_page.go_to_login_page() login_page.login("<your username>", "<your password>") browser.close()
It looks much better, and the test above can now be rewritten to look like this:
def test_login_page(browser): home_page = HomePage(browser) login_page = home_page.go_to_login_page() login_page.login("<your username>", "<your password>") errors = browser.find_elements_by_css_selector('#error_message') assert len(errors) == 0
With these changes, you won’t have to touch your tests if something changes in the UI.
For more information on the Page Object Pattern, refer to the official documentation and to Martin Fowler’s article.
Now that you’re familiar with both Selenium and the Page Object Pattern, you’ll feel right at home with InstaPy. You’ll build a basic bot with it next.
Note: Both Selenium and the Page Object Pattern are widely used for other websites, not just for Instagram.
How to Build an Instagram Bot With InstaPy
In this section, you’ll use InstaPy to build an Instagram bot that will automatically like, follow, and comment on different posts. First, you’ll need to install InstaPy:
$ python3 -m pip install instapy
This will install instapy
in your system.
Note: The best practice is to use virtual environments for every project so that the dependencies are isolated.
Remove ads
Essential Features
Now you can rewrite the code above with InstaPy so that you can compare the two options. First, create another Python file and put the following code in it:
from instapy import InstaPy InstaPy(username="<your_username>", password="<your_password>").login()
Replace the username and password with yours, run the script, and voilà! With just one line of code, you achieved the same result.
Even though your results are the same, you can see that the behavior isn’t exactly the same. In addition to simply logging in to your profile, InstaPy does some other things, such as checking your internet connection and the status of the Instagram servers. This can be observed directly on the browser or in the logs:
INFO [2019-12-17 22:03:19] [username] -- Connection Checklist [1/3] (Internet Connection Status) INFO [2019-12-17 22:03:20] [username] - Internet Connection Status: ok INFO [2019-12-17 22:03:20] [username] - Current IP is "17.283.46.379" and it's from "Germany/DE" INFO [2019-12-17 22:03:20] [username] -- Connection Checklist [2/3] (Instagram Server Status) INFO [2019-12-17 22:03:26] [username] - Instagram WebSite Status: Currently Up
Pretty good for one line of code, isn’t it? Now it’s time to make the script do more interesting things than just logging in.
For the purpose of this example, assume that your profile is all about cars, and that your bot is intended to interact with the profiles of people who are also interested in cars.
First, you can like some posts that are tagged #bmw
or #mercedes
using like_by_tags()
:
1from instapy import InstaPy 2 3session = InstaPy(username="<your_username>", password="<your_password>") 4session.login() 5session.like_by_tags(["bmw", "mercedes"], amount=5)
Here, you gave the method a list of tags to like and the number of posts to like for each given tag. In this case, you instructed it to like ten posts, five for each of the two tags. But take a look at what happens after you run the script:
INFO [2019-12-17 22:15:58] [username] Tag [1/2] INFO [2019-12-17 22:15:58] [username] --> b'bmw' INFO [2019-12-17 22:16:07] [username] desired amount: 14 | top posts [disabled]: 9 | possible posts: 43726739 INFO [2019-12-17 22:16:13] [username] Like# [1/14] INFO [2019-12-17 22:16:13] [username] https://www.instagram.com/p/B6MCcGcC3tU/ INFO [2019-12-17 22:16:15] [username] Image from: b'mattyproduction' INFO [2019-12-17 22:16:15] [username] Link: b'https://www.instagram.com/p/B6MCcGcC3tU/' INFO [2019-12-17 22:16:15] [username] Description: b'Mal etwas anderes \xf0\x9f\x91\x80\xe2\x98\xba\xef\xb8\x8f Bald ist das komplette Video auf YouTube zu finden (n\xc3\xa4here Infos werden folgen). Vielen Dank an @patrick_jwki @thehuthlife und @christic_ f\xc3\xbcr das bereitstellen der Autos \xf0\x9f\x94\xa5\xf0\x9f\x98\x8d#carporn#cars#tuning#bagged#bmw#m2#m2competition#focusrs#ford#mk3#e92#m3#panasonic#cinematic#gh5s#dji#roninm#adobe#videography#music#bimmer#fordperformance#night#shooting#' INFO [2019-12-17 22:16:15] [username] Location: b'K\xc3\xb6ln, Germany' INFO [2019-12-17 22:16:51] [username] --> Image Liked! INFO [2019-12-17 22:16:56] [username] --> Not commented INFO [2019-12-17 22:16:57] [username] --> Not following INFO [2019-12-17 22:16:58] [username] Like# [2/14] INFO [2019-12-17 22:16:58] [username] https://www.instagram.com/p/B6MDK1wJ-Kb/ INFO [2019-12-17 22:17:01] [username] Image from: b'davs0' INFO [2019-12-17 22:17:01] [username] Link: b'https://www.instagram.com/p/B6MDK1wJ-Kb/' INFO [2019-12-17 22:17:01] [username] Description: b'Someone said cloud? \xf0\x9f\xa4\x94\xf0\x9f\xa4\xad\xf0\x9f\x98\x88 \xe2\x80\xa2\n\xe2\x80\xa2\n\xe2\x80\xa2\n\xe2\x80\xa2\n#bmw #bmwrepost #bmwm4 #bmwm4gts #f82 #bmwmrepost #bmwmsport #bmwmperformance #bmwmpower #bmwm4cs #austinyellow #davs0 #mpower_official #bmw_world_ua #bimmerworld #bmwfans #bmwfamily #bimmers #bmwpost #ultimatedrivingmachine #bmwgang #m3f80 #m5f90 #m4f82 #bmwmafia #bmwcrew #bmwlifestyle' INFO [2019-12-17 22:17:34] [username] --> Image Liked! INFO [2019-12-17 22:17:37] [username] --> Not commented INFO [2019-12-17 22:17:38] [username] --> Not following
By default, InstaPy will like the first nine top posts in addition to your amount
value. In this case, that brings the total number of likes per tag to fourteen (nine top posts plus the five you specified in amount
).
Also note that InstaPy logs every action it takes. As you can see above, it mentions which post it liked as well as its link, description, location, and whether the bot commented on the post or followed the author.
You may have noticed that there are delays after almost every action. That’s by design. It prevents your profile from getting banned on Instagram.
Now, you probably don’t want your bot liking inappropriate posts. To prevent that from happening, you can use set_dont_like()
:
from instapy import InstaPy session = InstaPy(username="<your_username>", password="<your_password>") session.login() session.like_by_tags(["bmw", "mercedes"], amount=5) session.set_dont_like(["naked", "nsfw"])
With this change, posts that have the words naked
or nsfw
in their descriptions won’t be liked. You can flag any other words that you want your bot to avoid.
Next, you can tell the bot to not only like the posts but also to follow some of the authors of those posts. You can do that with
set_do_follow()
:
from instapy import InstaPy session = InstaPy(username="<your_username>", password="<your_password>") session.login() session.like_by_tags(["bmw", "mercedes"], amount=5) session.set_dont_like(["naked", "nsfw"]) session.set_do_follow(True, percentage=50)
If you run the script now, then the bot will follow fifty percent of the users whose posts it liked. As usual, every action will be logged.
You can also leave some comments on the posts. There are two things that you need to do. First, enable commenting with set_do_comment()
:
from instapy import InstaPy session = InstaPy(username="<your_username>", password="<your_password>") session.login() session.like_by_tags(["bmw", "mercedes"], amount=5) session.set_dont_like(["naked", "nsfw"]) session.set_do_follow(True, percentage=50) session.set_do_comment(True, percentage=50)
Next, tell the bot what comments to leave with set_comments()
:
from instapy import InstaPy session = InstaPy(username="<your_username>", password="<your_password>") session.login() session.like_by_tags(["bmw", "mercedes"], amount=5) session.set_dont_like(["naked", "nsfw"]) session.set_do_follow(True, percentage=50) session.set_do_comment(True, percentage=50) session.set_comments(["Nice!", "Sweet!", "Beautiful :heart_eyes:"])
Run the script and the bot will leave one of those three comments on half the posts that it interacts with.
Now that you’re done with the basic settings, it’s a good idea to end the session with end()
:
from instapy import InstaPy session = InstaPy(username="<your_username>", password="<your_password>") session.login() session.like_by_tags(["bmw", "mercedes"], amount=5) session.set_dont_like(["naked", "nsfw"]) session.set_do_follow(True, percentage=50) session.set_do_comment(True, percentage=50) session.set_comments(["Nice!", "Sweet!", "Beautiful :heart_eyes:"]) session.end()
This will close the browser, save the logs, and prepare a report that you can see in the console output.
Remove ads
Additional Features in InstaPy
InstaPy is a sizable project that has a lot of thoroughly documented features. The good news is that if you’re feeling comfortable with the features you used above, then the rest should feel pretty similar. This section will outline some of the more useful features of InstaPy.
Quota Supervisor
You can’t scrape Instagram all day, every day. The service will quickly notice that you’re running a bot and will ban some of its actions. That’s why it’s a good idea to set quotas on some of your bot’s actions. Take the following for example:
session.set_quota_supervisor(enabled=True, peak_comments_daily=240, peak_comments_hourly=21)
The bot will keep commenting until it reaches its hourly and daily limits. It will resume commenting after the quota period has passed.
Headless Browser
This feature allows you to run your bot without the GUI of the browser. This is super useful if you want to deploy your bot to a server where you may not have or need the graphical interface. It’s also less CPU intensive, so it improves performance. You can use it like so:
session = InstaPy(username='test', password='test', headless_browser=True)
Note that you set this flag when you initialize the InstaPy
object.
Using AI to Analyze Posts
Earlier you saw how to ignore posts that contain inappropriate words in their descriptions. What if the description is good but the image itself is inappropriate? You can integrate your InstaPy bot with ClarifAI, which offers image and video recognition services:
session.set_use_clarifai(enabled=True, api_key='<your_api_key>') session.clarifai_check_img_for(['nsfw'])
Now your bot won’t like or comment on any image that ClarifAI considers NSFW. You get 5,000 free API-calls per month.
Relationship Bounds
It’s often a waste of time to interact with posts by people who have a lot of followers. In such cases, it’s a good idea to set some relationship bounds so that your bot doesn’t waste your precious computing resources:
session.set_relationship_bounds(enabled=True, max_followers=8500)
With this, your bot won’t interact with posts by users who have more than 8,500 followers.
For many more features and configurations in InstaPy, check out the documentation.
Conclusion
InstaPy allows you to automate your Instagram activities with minimal fuss and effort. It’s a very flexible tool with a lot of useful features.
In this tutorial, you learned:
- How Instagram bots work
- How to automate a browser with Selenium
- How to use the Page Object Pattern to make your code more maintainable and testable
- How to use InstaPy to build a basic Instagram bot
Read the InstaPy documentation and experiment with your bot a little bit. Soon you’ll start getting new followers and likes with a minimal amount of effort. I gained a few new followers myself while writing this tutorial. If you prefer video tutorials, there is also a Udemy course by the creator of InstaPy Tim Großmann.
You can also explore the possibilities of ChatterBot, Tweepy, Discord, and Alexa Skills to learn more about how you can make bots for different platforms using Python.
If there’s anything you’d like to ask or share, then please reach out in the comments below.
How to put a password on an application on Android (VKontakte, Viber, Skype and others)
Let me teach you how to put a password on an application on an Android phone or tablet so that an outsider cannot open it. Most often, this is done on instant messengers (Viber, Skype, Instagram, VKontakte and others) so that others cannot access your correspondence.
This article is suitable for all brands that produce phones on Android 11/10/9/8: Samsung, HTC, Lenovo, LG, Sony, ZTE, Huawei, Meizu, Fly, Alcatel, Xiaomi, Nokia and others. We are not responsible for your actions.
Without installing third-party programs, most gadgets do not provide additional protection for applications. But there is a standard Android security system with which you can effectively block the device. This is done according to the following instructions:
- Go to the settings, select the "Security" item. Enlarge
- We use a graphic or numeric password. Some gadgets have a fingerprint scanner.
You can also pay attention to the built-in ability to block some programs, for example, as in Kate Mobile.
EnlargeThere is a blocking option in the settings, which is disabled by default. It should be enabled, then set a password to activate protection at startup. Now we go to the settings of the program of interest, perhaps there is also a similar function there.
Need help?
Don't know how to solve a problem with your gadget and need expert advice? Alexey, a smartphone and tablet repairman at the service center, answers questions. Write to me »
Built-in protection
Some models of tablets and smartphones provide users with the ability to restrict access to certain programs without installing additional utilities. Here you need to carefully study the menu with the settings, suddenly the gadget already has a similar option. Let's look at the function using some popular firmware as an example.
Flyme
Meizu mobile gadgets are equipped with Flyme firmware. There you need to go to the "Security" menu, where the user can select applications for which password protection should be set.
EnlargeRead How to check Android for spyware
MIUI
Xiaomi installs MIUI firmware on its gadgets. Owners of tablets and smartphones from this manufacturer need to go to the "Settings" section, where select "App Lock". There is a search function that allows you to quickly find the application you need.
EnlargeZen UI
By installing the Zen UI firmware, Asus was able to expand the stock Android system. The firmware has a program blocking function. Developers offer two protection options for users.
Extended protection includes a graphical password, as well as the identification of an intruder using a photo. In the basic version, there is only the option to set a digital PIN code.
EnlargeThere are many more different firmwares. The blocking function is almost everywhere implemented in the same way, you just need to carefully study the settings menu. This method shows what can be achieved if only the built-in system tools are used.
AppLock
AppLock is one of the best free utilities that are used to lock other applications with a password. Its benefits include:
- Wide range of functions.
- Interface in Russian.
- There are no requirements for a large number of permissions.
Even for a novice Android user, using the utility should not be difficult:
- During the first launch of AppLock, you need to create a PIN code that will be used to access various settings made in the program.
- Immediately after entering and confirming the PIN code, the Applications tab will be launched in AppLock. There you need to click on the "plus" button to mark all those programs that you want to block without the possibility of opening by strangers. If you block the "Package Installer" and "Settings" applications, then no one else will be able to access the installation of programs from the Play Market, the apk file and the settings. Enlarge
- After selecting applications for the first time and clicking on the "plus" (adding to the list of protected), it is required to set permission to access data. Click "Apply", and then turn on the permission for AppLock.
- The selected applications will then be displayed in the blocked list. Now, without entering a PIN code, they cannot be launched. Enlarge
- Two icons next to programs allow you to block notifications from these programs or display a fake startup error message instead of blocking. If you hold down the "Apply" button in the error message, a PIN code entry window will be displayed, after which the program will start.
- To use a text password for programs (and a graphic one), rather than a PIN code, go to AppLock in the “Settings” section, then select “Lock Method” in the “Security Settings” menu, and then set the required type of password. Under the “Combination” item, an arbitrary text password is indicated.
Additional AppLock settings:
- Uninstall protection.
- Hides the AppLock utility from the list of programs.
- Connection protection. A password can be set for calls, Wi-Fi or mobile network connections.
- Multi-password mode. Each program has a separate password.
- On two separate tabs "Rotate" and "Screen" you can add programs for which screen turning off, its rotation will be blocked. This is done in the same way as setting a password for the program.
- Block profiles. You can create separate profiles in which various programs will be blocked.
The application is simple and works well. The disadvantages include not quite an accurate translation into Russian of interface elements.
Read How to set up a VPN on Android
CM Locker Data protection
This free app is also popular with Android users who want to put a password on the program. In the "Lock screen and applications" menu, you can set a digital or graphic password that is set to launch applications.
EnlargeIn the "Select items to block" tab, you can set specific programs that should be blocked.
EnlargeEnabling the "Intruder Photo" function will allow you to take a photo of someone who has made a certain number of incorrect password attempts. His photo will be saved on the gadget and sent to your e-mail. CM Locker has additional features, for example, protection against theft of a gadget or blocking notifications.
EnlargeIn CM Locker, you can easily set a password for the program, the function of sending a photo is a great thing, as it allows you to see who wants to use your gadget. The application has the following disadvantages:
- A large number of permissions requested at once.
- Requirement during the first launch to "Fix" the found "Threats" to the security of the device. There is no option to skip this step. Some of these "threats" are purposefully made user settings in the work of programs and the Android system.
Despite the disadvantages, this program is one of the most famous password protection applications for Android. There are many good reviews about her work.
AuthorMaster Nikolay
Engineer for the repair of mobile and computer equipment in a specialized service center, Moscow. Continuous experience since 2010.
Any questions? Ask in the comments to the article. I try to answer your email as soon as possible. Each case is individual and therefore it is very important that you describe your problem as much as possible and what model of device you have.
How to put a password on an application in iPhone or iPad
If you have a child who often asks your iPhone or iPad to play, check out Screen Time . With it, you can allow your child to use some applications and features and restrict access to others with a password.
Apple in Telegram and YouTube. Subscribe! |
♥ RELATED: How to automatically change wallpaper on iPhone or iPad based on time, location, etc.
Video:
Starting with iOS 12, iPhone and iPad have the ability to set a time limit on the use of the device so that your child does not sit on the phone all day.
You can also use this method for your own purposes, for example if your phone is sometimes used by strangers.
In this article, we'll show you how to limit your child's access to apps on your iOS device.
♥ BY TOPIC: How to hide (password-protect) correspondence with anyone in Viber on iPhone.
![]()
How to restrict access to apps and activities on iPhone and iPad
1. From the Home screen, open the Settings app ;
2. Go to Screen Time and press Enable Screen Time.
3. On the screen that appears, press the 9 button0146 Continue to and on the next select one of the options This is my iPhone or This is my child's iPhone (for the most part, it doesn't matter which item you select).
4. On the main screen of Screen Time , press the link button Use passcode .
Create a passcode that will be required to allow viewing the application.
Enter your Apple ID, which you may need in case you forget your passcode.
4. Return to the main page of section Screen Time and select item Content and Privacy ;
5. Move the switch opposite Content & Privacy to position Enabled ;
6. Select the desired section to create restrictions: iTunes Store and App Store Purchases , Allowed Programs or Content Restrictions ;
7. Disable required applications or activities.
8. Disabled applications will no longer be displayed on the home screen. In order to reactivate access to them, repeat all the above steps and move the switches in the opposite direction.
♥ RELATED: How to add a voice alert when your iPhone or iPad is charging.
How to set a password to launch selective games and apps on iPhone and iPad
Starting with iOS 12, it became possible to set time limits for the use of applications. You can unlock locked apps by entering a passcode.
1. From the home screen, open the application "Settings" ;
2. Go to Screen Time and press Enable Screen Time.
0146 This is my iPhone or This is my child's iPhone (it doesn't really matter which item you choose).
4. On the main screen of Screen Time , press the link button Use passcode .
Create a passcode that will be required to allow viewing the application.
Enter your Apple ID, which will be needed in case you forget your passcode.
5. Return to the main page of section Screen Time and select item Application Limits ;
6. Set switch "Application limits" to position Enabled and press "Add limit" ;
7. Select the necessary software that will be limited by limits and click the button "Next" ;
8. Set the switch "Block at the end of the limit" to position "Enabled" .
9. Set a time limit after which the selected applications will stop opening. Here you can also specify the required days.
Note: If you want to set a permanent password to run a certain application, set the limit to 1 minute.
When you launch a blocked application (after the limit is reached), the system will display a screen with a notification that the limit has been reached, and the icons of blocked applications will dim and an hourglass icon will appear next to them.
To continue working with a blocked application, press the button "Ask for more time" and then on "Enter passcode" .
After successfully entering the passcode, the user will be offered 3 options to unlock the application:
- Approve for 15 minutes;
- Approve for an hour;
- Approve for the day.
10. To control limits on all devices synced with the same Apple ID, select switch "Accept on all devices" on the main page of section "Screen Time" to position "On" .
Related videos:
See also:
- How to teach iPhone to turn on Power Save Mode automatically.