Search the Community
Showing results for tags 'instagram'.
-
Table of Contents How Instagram Bots Work How to Automate a Browser How to Use the Page Object Pattern How to Build an Instagram Bot With InstaPy Essential Features Additional Features in InstaPy 5. Conclusion 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. 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. 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: from time import sleep from selenium import webdriver browser = webdriver.Firefox() browser.get('https://www.instagram.com/') sleep(5) browser.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 and webdriver. 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: from time import sleep from selenium import webdriver browser = webdriver.Firefox() browser.implicitly_wait(5) browser.get('https://www.instagram.com/') login_link = browser.find_element_by_xpath("//a[text()='Log in']") login_link.click() sleep(5) browser.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 to Log 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: from time import sleep from selenium import webdriver browser = webdriver.Firefox() browser.implicitly_wait(5) browser.get('https://www.instagram.com/') login_link = browser.find_element_by_xpath("//a[text()='Log in']") login_link.click() sleep(2) 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() sleep(5) browser.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. 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. 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. 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(): from instapy import InstaPy session = InstaPy(username="<your_username>", password="<your_password>") session.login() session.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' 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. 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. If there’s anything you’d like to ask or share, then please reach out in the comments below. Source: realpython.com
-
https://www.digi24.ro/stiri/sci-tech/whatsapp-facebook-si-instagram-au-picat-la-nivel-mondial-1689813 🤔🙄
-
Salutare, Vând un cont instagram 33k + followers personal, Urmăritorii sunt mix undeva la 70romani 30rest of world îl vând pentru ca nu prea m ai am timp de el. 900lei negociabil.
-
Salutare. Am doua conturi deinstagram de vanzare ! 1.Cont instagram cu peste 4300 followers. -Toti adaugati manual. -100% romani. -primeste in jur de 400-1500 likeuri pe post. -Nisa este comedie. -Il puteti transforma in contul vostru personal. -Pret: 40 euro. Nu negociez,acesta este pretul pe piata + am muncit o luna la el...si lucrul cel mai important sunt adaugati manual 2.Cont cu peste 2500 followers. -Adaugati manual -50%romani - 50 straini. -Strange pe post in jur de 300 likeuri. -Nisa fan Inna. Pret:15 euro. Daca le cumparati pe amandoua,le las la 50 euro. Link in pm
-
Se intampla o chestie ciudata la mine in oras. De aproximativ 4 zile cineva a facut un cont de instagram numit "gossipsimleu" unde oricine ii spune o barfa el/ea o posteaza . Cred ca e gen luata din seriarul GossipGirl. Toata lumea cauta deja sa demascheze contul. Ceva idei?
-
As vrea sa vorbesc cu cineva care a facut bani cu ajutorul paginilor de socializare pe diferite site-uri(facebook, instagram) sau cineva care si-a facut publicitate cu ajutorul lor si are mai multe experienta . Tin sa precizez ca am citit mai multe lucruri pe forum, am cautat inainte sa deschid un nou topic dar nu am gasit ce cautam.
-
NU MAI ESTE VALABIL Vand urmatoarele: Facebook - Page Likes WW 20$/1000 Facebook - Photo/Post Likes 6$/1000 Instagram - Followers 7$/1000 Instagram - Followers reali si activi ww 15$/1000 Instagram - Likes 7$/1000 Instagram - Likes reale de la useri activi 18$/1000 YouTube - HR Views 1.5$/1000 Voturi in concursuri bazate pe aplicatii facebook plecand de la 7$/100 (in functie de cat de greu se voteaza) Voturi pe baza de ip plecand de la 7$/100 (in functie de cat de greu se voteaza) Comanda minima este de 100 de unitati, mai putin la like-uri pentru o pagina de facebook,vizualizari YT,vizitatori site, unde este de 500 like-uri respectiv 1000 vizualizari si 1000 vizitatori. Plata se face prin Paypal sau Bitcoin. La cantitati mai mari de 5000 putem negocia. Daca aveti intrebari legate de alte servicii decat cele de mai sus va stau la dispozitie.
-
Dupa cum zice si titlul, cumpar pagina facebook si/sau instagram Italia, minim 20.000 like/pagina. Pentru mai multe detalii P.M.
-
A security researcher says there is a bug in the Instagram API that could enable an attacker to post a message with a link to a page he controls that hosts a malicious file, but when the user downloads the file it will appear to come from a legitimate Instagram domain, leading the victim to trust the source. The issue, a reflected filename download bug, lies in the public API for the Instagram service, which is owned by Facebook. Researcher David Sopas of WebSegura in Portugal found that by using the access token from any user’s account, pasting some code into the bio field in a user’s account and using some other little tricks, he could produce a file download link that seems to be hosted on a legitimate Instagram domain. “This time I found a RFD on Instagram API. No need to add any command on the URL because we will use a persistent reflected field to do that. Like “Bio” field on the user account. What we need? A token. No worries we just need to register a new user to get one,” Sopas wrote in a post explaining the bug and exploitation technique. “Next step: Insert the batch command we want to use in the user account Bio field [and maybe others]. I’ll try to open a Chrome new window with a malicious page disabling most the protections from this browser.” Sopas found that the technique works on Chrome, Opera, Chrome for Android, the Android stock browser and Firefox in some circumstances. In order to make it work, he also constructed a specific filename, and when a victim clicks on a link in the attacker’s Instagram message, she will be taken to an attacker-controlled page with a file that appears to be on an Instagram domain. The video above demonstrates the technique. The attacker could host any malicious file he chooses at the target location, including malware. Sopas said he has been unable to convince Facebook security engineers that RFD issues are security vulnerabilities. He said they told him the issue was not a priority. “Many companies still don’t understand that RFD is very dangerous and combined with other attacks like phishing or spam it could lead to massive damage,” Sopas said via email. “[imagine] a phishing campaign where the link of the email is really from Instagram?” Source