Create a PS5 Restock Bot - PART 1

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

This shit doesnt work

👍︎︎ 1 👤︎︎ u/yungsavageyutsh 📅︎︎ Jun 26 2021 🗫︎ replies
Captions
hello everybody today we will use python to check when playstation 5 is back in stock we're going to build a scraping bot with selenium and run it on a daily basis with waste script in the end of this process we're gonna get our hands on that console with nearly zero efforts on our side so what exactly are we waiting for let's do this first we will navigate to wastegrip.com and we will click on this plus button in order to start a brand new script in my case i'm going to call my script ps5 checker once we're happy with the name we're just going to click on create and inside our script we will add a new function by clicking on the add function button and in order to access a web page we will need to add an http trigger we can do this by clicking on add trigger and then typing http we will select the option and because we are planning to extract some elements off that web page we will also need to add an http response we will click on add step and we will type http again and again we will select the option and before we move on we will turn on our trigger make sure this is green very important and in order to start coding we will add a python step so inside our main function we will click on add step and we will type python we will select it and we can go ahead and access our code by clicking on view code we can get rid of this demo code we don't need it instead we will import selenium and the efficient way to do this is to navigate to the link in the description straight into the wayscript docs i already have it open right over here and we will copy all these lines of code and paste them back inside our script and just a quick walkthrough with this command we are importing our web driver with these commands we are setting a few basic options to this web driver with this command we are initializing the web driver and assigning it to a variable called browser right underneath we are setting a timeout to this webpage meaning that if this web page doesn't load within 30 seconds our browser object terminates i'm gonna actually boost it up to 60 seconds because i have a feeling best buy is going to be slow and that's the website i'll be targeting and in the line below as you guys can probably guess we are requesting a url address and even though wayscript is a really really nice website we will actually access a different website so we'll delete it and we can delete the next lines of code because this will print the entire source code of the page and we don't really want that so let's delete it next we will navigate to the webpage of the product we're looking to check in my case i already have it opened i am looking for the playstation 5 online console and we can see right away that it is not in stock just by reading these two beautiful coming soon words so let's have a quick look at the source code of this element and we can do this with a right click anywhere on a page and we will open our developer tools by clicking on inspect next we will click on this arrow button in the top left of the menu and we will click on our coming soon text right away we can see that our text is actually a span element with the text of coming soon and since we know exactly which element we're looking to target we can safely copy the url of this webpage and we will paste it inside our get command next we are going to fetch all the span elements off the page we will focus only on their text attribute and we will check whether our coming soon span is among them we will do this by typing browser dot find underscore elements by tag name and inside the round brackets as you can guess our tag name which is span and lastly we will assign it to a variable called all underscore span and this will return a very long list of spam tags however we're not really interested in the entire spam tag we only need its text attribute therefore we will use list comprehension to get rid of the rest we will type in the next line all underscore span equals square brackets i dot text for i in all span so instead of getting the entire span we are only getting the text off that span and since this time we're getting a list of strings in return we can easily check whether our coming soon string is inside this list we'll do this by typing if coming soon with a capital c very important in all underscore span which is our list then print item not in stock else print item is in stock and once our if statement is complete we can go ahead and run our code by clicking on run and we can see that our item is indeed not in stock perfect so in this tutorial we'll learn how to extract elements off a web page in the next one i will show you how to run this script on a daily basis and how to store the results inside a csv file also we will learn how to send ourselves notifications as soon as playstation 5 becomes available again so before you forget make sure to hit that subscribe button because you don't want to miss that now thank you so much for watching you guys and i will see you very very soon
Info
Channel: WayScript
Views: 18,059
Rating: 4.8375635 out of 5
Keywords: WayScript, Software, Programming, ps5 pre order restock, walmart ps5 restock, ps5 restock, bestbuy ps5 restock, ps5 next restock, automate, automatic, automatic ps5, automatic ps5 bot, notifications, notification, alert, alerts, ps5 alerts, ps5 restock alerts, python, python programming, python automation, python web scraping, selenium, python selenium, ps5 bot, playstation 5, python simplified, ps5 bot buying, scalping, ps5 pre order bestbuy
Id: 4rHqekQeIn0
Channel Id: undefined
Length: 6min 7sec (367 seconds)
Published: Fri Apr 02 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.