Hey everyone, thanks for coming and welcome to Automated Instagram with Python and Selenium And I hope you're a little bit excited because we'll be talking about some great stuff Including why you should use automation? What Selenium is we'll Actually do some Instagram automation right here and talk about a page object design pattern and after that we'll quickly take a look at my tool Instapy and Last but not least we will go into why open source is important and how you can level up your own open source Pro a portfolio and projects Like has been said I am Tim and I'm currently a CS student in Germany and the creator of Instapy And if you have any questions feel free to contact me on any of the social medias or directly we are Gmail I'll be happy to chat and if you have any questions Later today or tomorrow and you can't remember my face I got this white dot on the back of my head and It's really kind of to remember me Also make sure to follow me on Twitter because I'll be posting a slide still later But now without wasting any further time, let's get right into it. So why should you do automation? I'm pretty sure every single one in this room has at least one task here could and actually should automate but they don't do it a instead just do it by hand and I Interestingly got some emails through Instapy from social marketing companies that told me that asked me to automate their Instagram growth process because they have like One or two people sitting there and log into clients accounts Liking pictures commenting stuff and following people and they do it all by hand eight hours a day And I think this is really ridiculous Especially since automating stuff is most of the time one-time effort You don't have to do it every time you might have to make some slight adjustments But the big part is done and it will save you time The more the more often you have to do it especially since a lot of tasks are Easier law Automatable, then you actually think they are I Just recently had to send an email to every single contact on a CSV file And I could have gone in there and do this by hand But instead I just wrote a script to go through CSV file and send out an email to everything so I had time for more important stuff and Speaking of Instagram or Twitter Facebook. You could actually do something like this but as Things gets more complex. This will really explode in complexity and Has some disadvantages. That's why we will use a software only solution and We will use selenium here, and I don't know how many of you have here to selenium Could you bring hand sign? Oh? Okay, that's quite a lot for those who don't know Selenium is actually a testing tool for front ends, especially web front ends but you can also do it with Java front ends and Yeah, it's actually for testing your web apps For example, you could test the flask web app with it But it's also very good for automating boring tasks, which of course liking stuff on Instagram is if you want to do it efficiently and Who has he already here of react VHS or Angular probably everyone and you can't crawl websites which are dynamically rendered like Facebook Twitter Instagram with with simple requests. That's why selenium is also very interesting And since we're using Python here Installing it is as easy as pip install selenium, and we're now ready to do some real Instagram automation So let's just take a look at what we have to do. We have to start a new browser We have to navigate to Instagram once we're on Instagram We can log us in and once we're logged in we can then start to click these little hearty icons to actually like pictures and Since we're using selenium here, this is really easy and We have to simply import the web driver element from from selenium and once we've done that we can instantiate on a new browser and In our case, we will just use the chrome browser here, but you can use Firefox or check out the documentation which browsers are also supported and In the praises here you can pass the path to the chrome driver. This is not necessary, but gives you some nice security on different platforms and once we've got our browser object ready, we can then use the get method to navigate to any page in our case, of course, this is Instagram and once we're on Instagram we can then Get to our next step and Well, the sleep is just here to make sure the browser doesn't close instantly and we can see something and the browser that closes here for Clean exit, which is recommended by selenium Let's take a look at what happens so if we enter If we start the script, we will see that it opens a new browser and navigates to Instagram and if you're now on Instagram we can we see that there is There is no login form. It's simply the sign-up form and we have to make sure we get to the login form here You see there and in this case there is this little login link on the bottom of the page with which we can switch from the sign-up form to the login form and This is really good point to introduce a new concept here from selenium and this is finding and clicking elements So so we in order to have find an element on a page We can take a look at a page source and we have to find a nice signature of the element And in this case, it's just an a tag with the class of underscore FC and so on and the text of login so we use that knowledge to get the element we are a browser element and For chrome you can simply use the death tools as well as safari. They all have very nice death tools where you can search elements pretty efficiently If we translate this into code now We can use our browser object to find element by XPath and for those who don't know XPath is just query language for XML documents as HTML in this example and the XPath here is just like I said we will use the a-link as an anchor and We've searched for the a-link which hasn't had a name of login and text of login in this case And since we now have the login element we can simply do trigger a click on it Which will Actually trigger a click on the login element here and you can see this little flickering and This is just selenium clicking on the link login link to get us to the login form here Perfect, so we now in the login form and can log us in we now have only have to send our username and password to the Login form and once we've done that we are logged in to Instagram, so let's check that out. We first have to again Check the page source for our elements and we'll also introduce a new concept here Which is called action chains and it does what it is called after it simply Chains actions together and In this case, we will just look for the form element and the login button and If we yet and translate this into code again we will get something like this and again we will use the browser element to find stuff by XPath and For the inputs, it's just for slash forum slash div slash input Which is of course XPath for our input form and Then we can instantiate a new action chain element which will pass the browser and we then have in access to some method here, which are move to element click send keys and perform which will trigger the whole action chain to execute and If we take a look at the code from bottom to from the top to the bottom We first move to the first input element, which is the username. We then collect the input element And this will really have a more nature natural feeling and a more human feeling than just triggering clicks by JavaScript and After we clicked into this user element, we can then send our username to it in this case It's contacting John though and once we've done that we can move to the second form element, of course and send our password in there After we entered our password in username. We can then simply create a new action chain and of course click the element and I just added a second action chain here because You have to see that you can also use it for one element only. You don't have to have like ten elements or two or three So again, let's take a look at what this code snippet does And in this case, it will just go in and and to use name and password and click the login element here And of course this will trigger our Instagram to load the feet feet page and we are actually now locked in successfully This is where it gets interesting because once we're locked in we can't instantly start clicking on these hearty icons because we When we take a closer look at Instagram and Twitter of course and Facebook all have this feature There is this little circle loading but loading circle on the bottom of the page Which will only get new content once we reach the bottom of the page So there's not and too big of an overhead here and this will just dynamically load new content into our page and Depending on how many images how many stuff we want we have to first get get hold of that and Make sure that We have enough elements on the page if we want to do 20 It's not a problem, but if we want to do 100 or 200 elements on our front page we will have to tackle this and Again, we will introduce new concept which are special keys and with the normal Send send keys method we can simply send text like our username and password But we have to use special keys for stuff like delete enter spacebar and in our case home the home and the end key which will trigger the page to go to the top of the page and The end key will trigger it to be a go to the bottom And let's translate this into code again This will lead to something like this We have to import the keys the special keys from selenium again and from then on we can simply use the keys and Here's a special special element which we have to define before the is the body element because we need an anchor to send our Commands to we need an anchor to send these keys to and we can't just use maybe The Instagram logo or something like that But we have to have really a solid solid element which will stay the same in this case it's the body element because it's of course the element you click in and you operate in when you're using the browser yourself and Then we can simply do a for loop and In this case, we will do it three times We will go to the bottom of the page to the top again to the bottom of the page And we'll sleep two seconds in between each to make sure that the loading actually succeeds and we will get new content So if we take another look at how this code gets executed You will see that it moves to the bottom of the page and it moves up again And it's it's all it does it just executes this three times in a row to make sure we got like 50 elements here to later like so there is only one step left here, which is Finding all the hard elements and clicking them and you should now be able to do this all by yourself because it's We introduced all the concepts here, which are finding elements and clicking elements, of course and If we take another look at the page source here We just have to find these hard icons and find another signature here Make sure that the signature is unique to make sure that we don't get a another element on the page but exactly the one we need we want to and In this case we Will use the class we will use several classes to make really make sure that we will get only these elements and We'll just loop over it and we will do some printing to make sure that We keep track of how many elements we already liked and If we enumerate through it, we will of course add another sleep to make sure we don't don't get banned here We will get something like this where We start up our script from the start and we will see everything we done right now So it starts a new browser. It navigates to Instagram once we're on Instagram. It will log us in and Once we're logged in it will then as we saw before start to move to the bottom of the page to the top again And once it's loaded enough images it can finally start to like some pictures We'll just wait a few seconds here until it's done and you can we'll then see that the page is Really like jumping a little bit. There you go. And you see that the hard icons turn red And this is really just a very simple Automation of the liking for your newsfeed and you can enter you can add your own Automation right now you can do filtering for friends. You can for example make sure you don't like your own pictures You can add commenting and you can add following for the people you actually see on the front page or maybe even Copy the pictures and posting yourself or something like that depends on what you really depends on what you want to do with it but as you see as you've seen right now we heavily rely on the page structure and this leads to some problems here because Instagram Facebook and all these big pages where it would be interesting to do some automation on they change their page layout pretty recently and pretty often and this really leads to breaks in the code and and make sure that the code is not working very long and This is really annoying to fix, but it's pretty quick actually and we'll look into some Ideas on how to make this more maintainable and get make sure that our code is solid more solid The second thing is different languages We saw that we rely on the log in text for searching for elements here and this is really Bad for different countries where we have for example here in Italy Of course would be Italian on in France with the French and so on so we can't we shouldn't rely on the page on the page language but Selenium offers a really nice feature here which we with which we can simply Forced the browser to use a specific language and we can just enforce it to use English in this case and the most annoying problem is AB testing and all of these big companies of course do AB testing for those who don't know AB testing is just Rolling out features to a small group in a specific area like for example, all right We have a new feature we will test it in only in Rimini and if the people in Rimini think this feature is good And like this feature and there are no problems with this feature They will roll it out incrementally to more and more people to make sure that every person on the planet if for these big companies gets a new feature and Testing this is really annoying because you have to make sure you get all the informations from the users. All right Where are they located? What's the what's the language of their system what system are they using and all of these small little details which will or Which can lead to a failure that is really unique to this to that person but Selenium Recommends pay a things an object design pattern for this page It's called page object design pattern and it of course is what it tells It's an object for every page So we would have an object for our login page would have an object for our news for page and so on And this really gets us more maintainable code because we only have One place to make our changes around the UI So in order to make changes right now We would have to go through all the whole code and make all the changes to the X path And this is really really annoying and we don't want to do that It also reduces a duplicated code because it has a Nice layer of abstraction here, which will move all the code to one one big bulb and in this Code and in this place there will be the only logic Third thing is it adds through this abstract abstraction layer It adds adds a nice API layer which we can then use in our actual code base to kind of get some readable code and and if we add some comments and Little hints what we did here. We can really get nice contributors and make sure that the contributors understand our code and can it contribute as well and Since we're all real programmers here We will look at an uml diagram of this page up to this design pattern here and it looks something like this well, no, yeah, just talking it looks more like this and As you can see here, this is an example of the Google search page where every Attribute is an element and in this case for example URL is an attribute the search box is an attribute and so on and Every method wraps an action for example navigation searching and clicking the field lucky button, for example and of course it is actually Test pattern, so we haven't actual test last year for each page object. We need a test object here and Don't know don't matter if you got this right now We will look at an example with Instagram here and we'll use the Instagram login form for this We'll we won't focus on on the app store buttons or the login The sign up a link here. We'll just focus on the username input the password input input and the login button here And if you again translate this into code We will get something like this where we have a class for install login page and we in within the constructor constructor we will define every attribute every element as we said recently In this case it will be the user box the password box in the login button and once we found all these elements We can then use it in the complete in the full class right now so in our case we will implement the login method and It will get past the username and password and here in in the login method We can then instantiate a new action chain and go through all the methods here And to move the element like we did before and One interesting thing about the page object design pattern is That it returns a new page object for the next page We will move to so in our case as you saw when we log in we will move to the insta Into the feed page where our news feed is located So we will return a new instance of the insta feed page object in our case so that not right now we will switch over to Instapy because you don't want to implement this all yourself and Think about how you can implement this and Break your head about what what changes instant from a sense something like that and I'm really Amazed and I'm really excited to talk about this here today because this is actually what led to this talk and I'm really excited how big this got and what the open source community made out of this and it is called Instapy of course and Right now we have around 2k stars on github, which is I think pretty nice for something like this Especially since there are a lot of services out there Which got token down by Instagram itself, but they were in so there were our services out there And this is really completely open source. Everyone can contribute and look at it and Even copy it if they want to I have 32 contributors which are from which four are into the core developer team right now and We got over 420 forks of this project and I Hope there is a lot more to come because I want to keep this alive and make sure that people can actually use it and This many contributors this many interested people leads them to some very interesting stuff like An active community means there is quick help for everyone. So if someone submits an issue there's an if if I can't Help him with this issue. They're like 100 200 people that maybe have have the same problem who can also comment on his stuff and And help me fix all the problems and make sure that the people actually can use this And to give you kind of an impression what Instapy can do Here's a little list of features Of course you can do following liking unfollowing commenting You can like by tag and you can target your users specifically by location for example if you have a Pizzeria or Any kind of shop you can make sure that only people in your location will be notified Of course it works on a server so you can use digital ocean or any kind of virtual server to run it It's has Docker support. You can write it. You can post emojis and One interesting thing is Clarify. I don't know how many of you know Clarify, but it's an image Smart image recognition API and with it you can make sure that you don't like any not-safe-work stuff or Inappropriate stuff or maybe you're you're from some country and you don't want to like New stuff or it depends on your preferences and you can really make sure that the comment pictures you comment on and your people You follow are not some kind of weirdos here and I think the API is pretty interesting too. So this is what it looks like you just have to import insta-pi from insta-pi and In the insta-pi constructor you can then just pass your username and password and after the look in you can do some settings in this case we will just make sure that we don't interact with any account that has more than two and a half thousand followers and We want to do commenting on ten percent as well as following on ten percent We want to use the comments cool awesome and nice And we want to make sure that this this bot don't interact with our real friends So we can make sure that our real friends are not included here And of course we can do some text search where not safe from work and naked are Excluded and what if some of these don't include words are included in the text It will skip the page the picture and not like it and then we can finally do some liking by tags For example in this case we will just like a hundred pictures for nature and cat And let's talk about open source in general and why it's important and I'm Pretty sure a lot of people in here already do open source and this is awesome, but those who don't know those who don't do it You really have to think think about it if you have any project on your on your hard drive that could be open source Why not do it? I mean all of all in here already use open source for their projects But why not give something back to the community if you have something laying around it doesn't matter if you Contribute it to GitHub or GitLab and make it open source for people to use it And I think this is really the most important thing to think about It's also good for new developers to build a portfolio because people will find you on the Internet and if you got great stuff They may might contact you might want to work with you and even companies get interested in you and This is where you get opportunities from and if you if you really look interesting they'll contact you so you didn't have to send out any Any papers or something like that to make sure to apply applicator companies To make it Nice for you and give you a little bit of motivation Here is what open source did for me by now I got 12 job offers and nine internship Internship offers sorry from around the world as well as a ton of new contacts that contacted me through Instapy And I think this really speaks for itself if you got something that's that's interesting and maybe a little bit controversial it's really Just a matter of time until until people think about it and and talk about it and really Give you feedback on it and want to help out and these job offers and contacts are from around the world including Sweden, Sydney, Argentina, Brazil, the UK USA even from Ireland and Singapore or Shanghai and I think this really speaks for itself and of course I got this talk from it, which is Nice for me as well to close this off here are some tips I think are really important for you open source portfolio if you're interested in doing in doing some open source Stuff make sure to include or to keep this information and keep make sure to improve these tips here The first one is at documentation. I've seen so many projects out there who has not Have have no real documentation and this is this is really crucial I know it's annoying for people to write documentation But if people don't understand your project or don't even know what the features of your project are this is It's just insane it how should they use should they look take a look into the peg code. I don't think so Really a few people actually do that The second it's spread the word you can use channels like hack and use reddit or dev post something like this to make sure that people actually see your Pro of your portfolio and your projects to make sure that you get feedback and and people to Get people to talk about your tool And if nobody since nobody if nobody hears about your project, of course, nobody will use it The last one is supported users and this is really time-consuming, but it's really worth it It's a lot of work, but it's worth it and If somebody uses your tool and it he stops using your tool Because if they don't get it to work, they will never come back and you'll you lost a chance to get a new user So what what's next for for Instapy and this project? we want you to Take a look at it. Maybe contribute it use it give us feedback and maybe add some issues or something like that We will we want to add new features like a GUI smarter following and then more human automation and like I said if you have any questions or Recommendations offers anything just make sure to contact me on any of the social medias or Gmail and I'll be happy to chat later or through one of these channels. Thank you for your attention You


Hey everyone and welcome to a welcome back to Norris Cove on Yoshida And if today is your first time here here at the Cove We do budgeting cash stuffing sometimes and I like to just kind of plan my life out a little bit So I do a little bit of minimal or functional planning So if that sounds like something something that you are interested in I hope that you would consider subscribing and sticking around for more content for myself But today we're going to be doing my weekly budget. I am a little bit Behind I've been working on Etsy orders and regular shop orders Pretty much all budget items that you see here If you are new here, they are in my shop Most of the them are linked below the paycheck to paycheck or paycheck budget, which we're going to do today so let's see This was last week. I didn't put my totals and let's see. I Think we came out with 1209 I'm gonna do a flip of my new a5 yard and jump into a5 and I love it Let's see Yeah, oh we did 1000 This is the week of the fifth. Yes, let me get a pen here. I call myself being prepared So I don't have to take it long today, but we ended up doing in here one thousand one hundred ninety four dollars and 35 a cent for last week and we have down here Etsy a hundred Norse code for 48 and yeah, so And I've guesstimated four hundred so yeah, we're doing good and looking at this week I think we're gonna do about maybe nine. We've already done About three hundred so Let's Skip on over to this week Um, but yeah, let's review this real quick. So sorry So we did a state farm. I paid out like nine hundred dollars within a whole week to them But last week's payment was four forty three Cloth and paper got paid Amazon. All these are checkmen my booth and I got paid Community be sure your secrets Walmart credit one blueprint after pay Etsy another after pay and T-mobile. I need to fill this in Here I bought some Products for the shop. That's what's down here blank out. I'm glad I remember to blank that out So we're just gonna hop on into this week. So for this week, we're gonna put down our Main source which is here. I said nine hundred Norris co Which is my Shopify station or if you're new here I Got some money this week from there. I'm gonna put 150 I think it was like 130 and then I'm doing nails this week That reminds me to text client back. I'm just gonna put 40 and Then we'll do that later. So bills do this week. You guys filled out my monthly with me So we should be able to jump here and see what we've got Let's see This is the six through the 12th My goodness We I'm moving Okay, so first thing I know I have this can where that came out and That was 13 77 That has come out. Oh, I did give T-mobile a hundred on Monday the six What else we got? Yeah, I paid a lot of stuff this week. I got products for the budget box for the shop I Spent I gotta go down here to let me jump down here to expenses because I spent about 70 on hair products for the salon This put that in there. So I don't forget Yes, I keep doing something stupid I keep calling myself trying to get to Sam So I can get the cheap gas but it's far from me So I'll put $20 and hoping I can get to the gas I never do. So when I finally make it to a gas station I got to pay just way too much. So $80 already and guess so that just doesn't make sense. So I need to figure that out Let's see and then we have Chase on the 11th And I think they're I put down 98 in my budget, but I think they're about a hundred and then on the 11th as well we have those friends Now here's what's going on you guys. I Have to have surgery next Friday And I just realized see and I looked at my Planner what I was making this appointment. It's just the in-and-out surgery, but I can't work Saturday or Sunday, but the surgeon said I should maybe go back on Monday. Well, this is when subs go out. So I'm hopefully I'm gonna be able to send out subs on Monday Let me see Use the brown so I'm gonna try to steal the packing stuff They get the subs out, but I Just happen to think about that. So that's gonna kind of mess with my income a little bit Because I have to be on Friday for the surgery and then Saturday I normally work and You know, I'm not that busy, but still I Need my coins. So I'm gonna extend my shipping time That was perfect. I'm gonna extend my shipping time to Monday and hopefully I can work Saturday That is really gonna mess up my budget, but I can't prolong it anymore. It's just an in-and-out surgery So I need to really save this week because I have my car note due next week, which is actually Wednesday Then I have uplift so I'm gonna try to take care of uplift out of this week as well And I think this is my last payment is 38 57 okay, so let's do a little toadling of What I'm gonna make I've already spent through too many like I got a oil change today matter of fact, let me write that down in the notes and That and got a tile rotation so that was $138 so if I'm going looking like where's my money like to make a little note Because I don't always make it to my spending tracker. So Let's see what we have We have 1090 I may get some money from Etsy not sure I think I make money from Etsy this week too. So let me put down here miss. Let me put Etsy Because I'm like this money don't make no sense later. So plus a hundred From Etsy, that's 1190 I'm gonna put that down here and the total income and let's add up our bills 502 dollars and 34 cents That don't even Make any sense like I Feel like I owe More so we're gonna subtract that from the one thousand one hundred and ninety So to leave six eighty seven sixty six like that would be perfect For my car 234 and then I'm gonna subtract a hundred and fifty which is The total of my hair products in gas so at least five thirty seven Sixty-six total expenses 150 We're not doing any sinking funds. I kind of wanted to I actually need to send some money to my high-yield savings I read watched the video I did and I said I'd give about $10 a month I try to do $10 a week not $10 a month. So I got to send my little regular $10 payment to my high-yield savings So Let me put that over here And I budget 10, but I'm thinking about sending 20 so we'll see so we're gonna subtract 10 from that So that means 527 66 Yes, so my dad And that's this week's budget y'all. That's what we got. This is the slow week That's why I wanted to take care of Some deals this week and get some stuff for the budget box for like March and April really we're kind of getting stuff for April For those that have been asking that to pays are coming back they should be back next week And yeah, also if you're new here We have the budget box, which is a monthly subscription box curated with all the budget items that you need and some extras and We have openings for the budget box for February and we do three months You can pay I think it's $94 for three months or 91 and then one time payment is 45 and a monthly fee If you just subscribe monthly is 35 the prices will be going up Towards the end of the year if not the summer so now's the time to get on board because those who have been with me They will get that price for right now and new people will be paying more So I highly suggest the budget box You can take a look at some of our reels and see some of the past boxes all that great stuff or check out our website So you guys thank you all so much for watching. I hope that you enjoyed today's video and again If this is your first time watching Please do my favorite hit that subscribe button also hit that notification bail Leave me a message in the comment section and let me know that you're new here and so that can welcome you to the code All right, you all have a great day. Bye


Forest is a large area of land covered with twist, but a forest is much more than a twist. It also includes smaller plants such as mosses, shrubs, and wildflowers. In addition, many kinds of birds, insects, and other animals may be home in the forest. Millions, even millions of living things that can only be seen under microscope also live in the forest. Climate, soil, and water remain the kinds of plants and animals that can live in the forest. The living things and the environment together make up the forest ecosystem, and the ecosystem produces some over-living and non-living things in a particular area and relationships among them. The forest ecosystem is highly created. The twist and other green plants use sunlight to make their own food from the air and from water and minerals in the soil. The plants themselves serve as food for certain animals. These animals, in turn, are eaten by other animals. After plants and animals die, their remains are broken down by bacteria and other organisms, such as pathogens and fungi. This process returns minerals to the soil where they can again be used by plants to make food. All the individual members of the ecosystem die, the forest itself lives. When the forest is wisely managed, it provides us with a continuous source of root and mineral products. Before people began to clear the forest for farms and series, great stretches of forest land covered about 60% of the Earth's land area. Today, forests occupy about 30% of the land. The forest lives greatly from one part of the world to another. So why forest is important? They help us live. Home for many living and non-living things. People live there too. They keep us cool and the Earth as well. They make it real. They fight flooding.