The most important Python script I ever wrote

  Рет қаралды 114,461

John Watson Rooney

John Watson Rooney

Күн бұрын

The story of my first and most important automation script, plus an example of what it would look like now.
✅ WORK WITH ME ✅
johnwr.com
➡ COMMUNITY
/ discord
/ johnwatsonrooney
➡ PROXIES
www.scrapingbee.com/?fpr=jhnwr
proxyscrape.com/?ref=jhnwr
➡ HOSTING
m.do.co/c/c7c90f161ff6
If you are new, welcome. I'm John, a self taught Python developer working in the web and data space. I specialize in data extraction and automation. If you like programming and web content as much as I do, you can subscribe for weekly content.
⚠ DISCLAIMER
Some/all of the links above are affiliate links. By clicking on these links I receive a small commission should you chose to purchase any services or items.
➡ TIMESTAMPS
00:00 Story
03:21 Code Start

Пікірлер: 112
@mgaugy
@mgaugy 20 күн бұрын
"Automate Everything": 1. Automate task A 2. Automate task B 3. Automate execution for task automation of A and B 4. Find a way to automate the automation in step 3 5. Keep building the automation tree
@BreetaiZentradi
@BreetaiZentradi 17 күн бұрын
At a job I had, one of the more important clerical staff lost 4 hours a week, comparing Folder A to Folder B, and Folder B to Folder C, and nothing what had changed with what folders were added, or moved. I wrote a script that would daily create a directory listing, DIFF with yesterdays listing, produce a report of ADDs, MOVEs and DELETEs and email it to them daily, then make today's listing "yesterdays listing" for the next run. This saved them 4 wasted work weeks a year. In addition they had the changes daily now instead of weekly. Once that was available it turned out there were 7 or 8 other people who benefited from this information. I just changed the program to email them all. It is amazing how one little script can save so much time.
@martyc5674
@martyc5674 24 күн бұрын
Not Python- but I automated a task using VBA in the first few weeks of my current role that I have no doubt was the reason they couldn’t keep someone in my role for more than a few weeks before they ran for the hills. Still using it most days and it literally saves me 20 hours a week.
@sultown4343
@sultown4343 19 күн бұрын
What was the task?
@martyc5674
@martyc5674 19 күн бұрын
Taking MRP downloads from our ERP system - organizing them by part and creating nice legible worksheets for each part. It also pulls in relevant master data/specific order comments from the network into each sheet that are relevant for each part.
@daves4026
@daves4026 14 күн бұрын
Yep VBA has served me like this for 25 years. Now starting to learn python but within the use cases for excel it’s hard to beat
@alishagrace
@alishagrace 26 күн бұрын
Python is awesome. I automated a task with Python that was repetitive, that took about an hour every time. Now instead of me creating multiple CSV files from one large file with Excel manually (Excel struggles with a lot of data), Python does it with the run of a command in just a second.
@ankushgaur9367
@ankushgaur9367 Ай бұрын
Same story 🙂 Python automation has also helmed me make new friends in every department in the company. Your channel is great. Thank you.
@rollinOnCode
@rollinOnCode Ай бұрын
how does it helm you? what does helm mean?
@ComputersAndLife
@ComputersAndLife 24 күн бұрын
Likely meant helped and not helmed​@rollinOnCode
@MustafaAli-ve1vm
@MustafaAli-ve1vm Ай бұрын
Same experience, I used to work as a Data Entry Officer at an e-commerce company (nothing fancy here) but I can't stress this enough, 60% to 70% even till 80% of my tasks can be automated from changing product price, disabling it, adding promoted price for certain duration, changing its status to in/out of stock, changing product's description with a pre-defined description based on a given google sheet. Imagine doing this manually for 100+ of products, no thanks! I even helped our brand managers by fetching 100+ of production information from other vendors and competitors.
@capability-snob
@capability-snob 15 күн бұрын
input() is a nice alternative to sleep you may like - it waits until you press enter in the shell, so you can wait as little or as much as you like.
@MichaelWyattMDW
@MichaelWyattMDW 23 күн бұрын
I DIDN'T KNOW YOU COULD DO THIS!!! I mean... now that I think about it, I knew there were -programs- that did this... like Q&A testing type packages. This looks relatively simple, though!!! I had no idea! This is great! I also have a weekly thing I have to do for work that is tedious, and I've been thinking it could be scripted... but just assumed that would be way over my head. This will definitely help me get started! Thank you so much for posting this! (So glad it shows up on my feed!)
@ff0x
@ff0x Ай бұрын
Well, that was such a cool and informative video that I had to leave a comment to help your KZfaq algorithm. Well done :)
@JohnWatsonRooney
@JohnWatsonRooney Ай бұрын
Thanks for that!
@dmcf1975
@dmcf1975 Ай бұрын
Great example and helps inspire ideas for me.
@deeperblue77
@deeperblue77 Ай бұрын
Nice one and fascinating. While I was working on a tedious, repetitive task, I started looking into Python. I had a little experience with C#, but it just did not feel right, and Python was simple to adapt. I've never been regretting my Python journey since.
@JohnWatsonRooney
@JohnWatsonRooney Ай бұрын
It really is great for automation tasks
@thomaspetermygind8022
@thomaspetermygind8022 26 күн бұрын
Came for the hope of automating parts of my work. Stayed for the CS talk!
@divyanshugogna6152
@divyanshugogna6152 Ай бұрын
Thank you so much for sharing your experiences and story John. In my case main python use in my life was also webscrapping from Amazon to find deals. I have improved a lot in my code and generally over time with lots of learning sources Would appreciate some content about automation of these python scripts please ? And may be dynamic content too (where one code runs other code, or passes data to other code at a dynamic time)
@saboo480
@saboo480 Күн бұрын
Same story for me too :) well done staying with it!
@Mousoukyou
@Mousoukyou 13 күн бұрын
Very good info, thanks!
@keagankemp6275
@keagankemp6275 2 күн бұрын
Aah once again you have outdone yourself, thanks I was struggling with tho for a while now, didn’t know how to get rid of the second pop up thanks a mil now off to code whoop whoop
@joachimcronquist
@joachimcronquist Ай бұрын
Great tutorial, thanks!
@Ronypls2555
@Ronypls2555 Ай бұрын
Nice, video. I need to start looking into automating more things before I get automated.
@JohnWatsonRooney
@JohnWatsonRooney Ай бұрын
Always be one step ahead hah
@BrownStain_Silver
@BrownStain_Silver 10 күн бұрын
I'm just finishing up Automate the Boring Stuff now. I've been writing some programs for work as well. I'm a few months in and it's a lot of fun. So far i've automated a few work processes. The most meaningful one is reduce a potentially 30+ hour task to hitting run on a program, providing 3 user response, and a 2-5 minute wait.
@markuswierer1755
@markuswierer1755 11 күн бұрын
As a person who doesn't understand much about coding: is having your username and password openly in a script the norm? It kinda... "feels" wrong... I assume you could make those two things an interactive prompt to type in everytime you start the program instead of having it written in the code permanently. But that won't help much if it is scheduled to run automatically at certain times without user interaction... Again, I don't understand much about programming, so I'm curious if that is a security concern in the "real world"?
@JohnWatsonRooney
@JohnWatsonRooney 11 күн бұрын
You’re right, it isn’t. It’s a security risk. But I wanted to keep it as simple as possible here. I would store the user and pass in environment variables or similar. But as I designed this script to only run locally with me there I didn’t worry about it
@markuswierer1755
@markuswierer1755 11 күн бұрын
@@JohnWatsonRooney Thank you very much for your reply! Good to know! Then this is something I have to look further into, should it come to a practical application for me. But at least my "feeling" wasn't wrong. That's something, I guess. Keep up the good work, I enjoyed the video. :)
@alexdnaz
@alexdnaz Күн бұрын
@@JohnWatsonRooneyhow do I save the user name and password and call on it when you need it I.e when u store it in its own environment etc….
@kyron5574
@kyron5574 Ай бұрын
When worlds collide lol nice to see a Prime nugget mentioned. Great video man!
@KyleLanmon
@KyleLanmon Ай бұрын
Love these quick and dirty scripts!
@alexkaspi
@alexkaspi 19 күн бұрын
The CS references really hit home for me. 🤣🤣🤣🤣 great video!
@88onage
@88onage Ай бұрын
Same here 👏 In my case I had to copy-paste social media data into a clunky spreadsheet. I started with some simple Python scripts to automate whatever I could, ended up in love with programming and am currently building large-scale analytics apps for my company. Your channel has been huge help throughout the years! Thank you 🙏
@JohnWatsonRooney
@JohnWatsonRooney Ай бұрын
Thank you for watching your very kind
@shaftymaze
@shaftymaze 18 күн бұрын
You changed my life. Only your videos. No joke.
@shaftymaze
@shaftymaze 18 күн бұрын
I mean there was a lot of grind. Except these videos made it possible.
@eziola
@eziola Ай бұрын
Incredible! Would you consider keep making Playwright videos? I think there's a lot of demand for scraping AI web search (particularly Google Gemini responses).
@JohnWatsonRooney
@JohnWatsonRooney Ай бұрын
Sure, I can
@nmsv1
@nmsv1 Ай бұрын
Been watching your videos for a while. Very informative and easy to understand for a newbie like me. Self taught programmer?
@JohnWatsonRooney
@JohnWatsonRooney Ай бұрын
Hey - thanks for watching, appreciate it! Yes I am self taught!
@nmsv1
@nmsv1 Ай бұрын
@@JohnWatsonRooney great 🙂 background in computer science or something else totally different?
@andreacota2098
@andreacota2098 Ай бұрын
Nice video as always. It would be cool to also see a video about solving captcha!
@MichaKuczma
@MichaKuczma 28 күн бұрын
Hi John, what do you use for such a smooth windows management?
@technicaltrialsandtribulat4574
@technicaltrialsandtribulat4574 25 күн бұрын
looks good / useful, but does this shopping cart software have a python API available, that would be easier to pull data from rather than resort to screen scraping.
@adventurefilms
@adventurefilms 19 күн бұрын
What resource did you come across at 1:03? Apologies, the title and author all ran together.
@tastycles1062
@tastycles1062 23 күн бұрын
Very good!
@joshuadias2468
@joshuadias2468 11 күн бұрын
Fantastic video
@ohokcool
@ohokcool 21 күн бұрын
I did the same thing but with Selenium for python, ultimately I wasn’t allowed to use it departmentally because selenium was not in the approved software for the company but it sure made my job a lot easier
@JohnWatsonRooney
@JohnWatsonRooney 21 күн бұрын
I was fortunate enough that I was allowed to and trusted too I know not everyone will be though
@billwilkin2996
@billwilkin2996 Ай бұрын
Thanks for your video. I'm following along and getting stuck at 8:52 with `page.get_by_role("button", name="Login").click()`. Has this happened for anyone else? Any thoughts on how to troubleshoot this issue? Thanks for any assistance you can provide.
@cchgray
@cchgray 27 күн бұрын
Where / how does original orders - “for order in orders:” get populated before you populate via csv reader?
@dj0men666
@dj0men666 13 күн бұрын
Does the system not have an export or an api? Would be much easier than hacking around the front end. If there was no export then i can see its use - or even running things in the UI - ive used test software to automate things for me before :) Its great seeing the computer do what you woudl be doing normally while you get on with something else more productive.
@ryanrhind5789
@ryanrhind5789 Ай бұрын
Can you do a video on how you decide what selectors you use in playwright - get_by_placeholder? get_by_role? query_selector? xpath?
@divyanshugogna6152
@divyanshugogna6152 Ай бұрын
Yea I had a lot of problems in them too, where like one goes wrong and code then needs to be changed again. I know in selenium we could just put literally all of them inside of a try: except Exception as E: pass Method and that way we can have it try it all in selenium, by xpath, by ID etc. Didn't really know how to do similarly with playwright but I think there might be something similar and that way we can put them all in some sort of try, except blocks ?? Although I don't really know if it works with playwright or not (try, except)
@bokaroid1946
@bokaroid1946 22 күн бұрын
I'm a newbie data entry, I want to automate data processing and I need to start from the last page of the data and then export it to excel. Can I do that using this technique? thank you!
@craiggazimbi
@craiggazimbi Ай бұрын
Hey man thank you so much. So I would love to actually be able to automate stuff as you do without necessarily following tutorials ,could you share your thought process or perhaps make a video on how one can become good as you. I do understand Pythona and coding in general. I am interested in expanding my knowledge within automation scripts. Any pointers?
@drewsepeczi
@drewsepeczi 21 күн бұрын
Read the book “Automate the Boring Stuff with Python” or look into the course “Automate everything with Python”, do not get caught up in watching short tutorials like this, although this video was very informative, you need to learn how to learn yourself. Cheers mate
@donsurlylyte
@donsurlylyte Ай бұрын
that is awesome. filed for ref.
@gamalalejandroabdulsalam904
@gamalalejandroabdulsalam904 Ай бұрын
Helix editor master race
@arcticslay6012
@arcticslay6012 15 күн бұрын
May I ask why you chose this method over the playwright codegen method you used in your past vid?
@JohnWatsonRooney
@JohnWatsonRooney 14 күн бұрын
Sometimes codegen doesn’t pick the best selectors so I often do it myself
@JoshPeterson
@JoshPeterson Ай бұрын
What colorscheme are you using? It's gorgeous.
@JohnWatsonRooney
@JohnWatsonRooney Ай бұрын
It’s kaolin-dark, my new favourite
@JoshPeterson
@JoshPeterson Ай бұрын
@@JohnWatsonRooney cool, thank you. I'm excited to try it out. Right now, I'm using Nord for everything, and I really like it. But it's time to switch things up
@Sam-lj9vj
@Sam-lj9vj Ай бұрын
Might be a silly question, but in this particular example you selected the particular "Orders", e.g. 3000, 3001, 3001. Now imagine it starts at 3000, however it keeps on going and you don't know when it stops. What would you write in the code?
@fxhp1
@fxhp1 23 күн бұрын
that's called a while loop with a variable incrementing until an error is reached
@karthikb.s.k.4486
@karthikb.s.k.4486 Ай бұрын
Nice . Is there any tutorial on Installtion of neovim and Installtion of python libraries please let me know
@lauriran
@lauriran Ай бұрын
sudo apt install neovim
@patrickharilantoraherinjat2994
@patrickharilantoraherinjat2994 26 күн бұрын
How do you manage captcha ?
@ea3gug
@ea3gug Ай бұрын
Superb, wouldn't be even better if you start with "playwright codegen" and tune it afterwards?
@JohnWatsonRooney
@JohnWatsonRooney Ай бұрын
Yes that does help - i did that in my other automation video but in this I wanted to build it up myself and show it that way
@polestarpilatestrainingcou1892
@polestarpilatestrainingcou1892 Ай бұрын
Love playwright codegen!! Only limitation..... I want to use a Chrome Extension and have playwright activate buttons within the extension..... Unfortunately playwright uses Incognito, for which you cannot use extensions.... UNLESS SOMEONE OUT THERE HAS THE ANSWER TO THIS?? 😱
@HumanityAsCode
@HumanityAsCode 13 күн бұрын
This is awesome but if you have access to APIs rather than UIs it's a lot more efficient to do it without any UI involved at all. Ideally software developers would be involved in helping eliminate so much busy work in the first place. I try to be helpful to other departments in that way where some small changes to a tool someone uses every day can make all the difference.
@bryce3851
@bryce3851 Ай бұрын
Dude ngl i immediately click on your videos it has help me learning programs that help me with work thank you i appreciate your videos
@JohnWatsonRooney
@JohnWatsonRooney Ай бұрын
Thanks that’s very kind
@buzzdev
@buzzdev 2 күн бұрын
Python is great, and we also use opencart. However, if you obviously have access to OC admin, why wouldn’t you write that whole stuff in PHP, directly accessing the OC classes and functions and read that stuff and much more from the database?
@lucaskellerlive
@lucaskellerlive Ай бұрын
Would you be available to meet on a call via Zoom at your hourly rate for a period of time you'd be available. I have a question regarding scraping Python API and I've watched all your videos that gave me an excellent overview I just have a few specific questions and would greatly appreciate your time helping me solve these couple of issues. Thank you!
@dfcastro
@dfcastro 19 күн бұрын
I do some automations of some activities that are repetitive and boring. On my case I used a bash script.
@_Pymander
@_Pymander 24 күн бұрын
Subd 🤙🏻
@DavidLee-jd5ot
@DavidLee-jd5ot Ай бұрын
Quick question, dose opencart allow for these scraping activities in their policy or they can band the IP, i know we are using playwrite with sleep time to mimic human but good to know if they anti-scrape bot or not
@deeneyugn4824
@deeneyugn4824 22 күн бұрын
All my scripts are in bash employing mostly awk, grep, sed, wc, find, expect, xargs, psql or sqlplus,
@Mrcaffinebean
@Mrcaffinebean 19 күн бұрын
Really funny the company I work for uses the exact same angular admin theme. I think it’s called Color Admin. The only thing to note is that they might have an API that you can access that make your automation more stable by taking the UI out of it.
@christcombiccombichrist2651
@christcombiccombichrist2651 Ай бұрын
hello, I have watch several of your webscraping videos. those demo was straight foward. I dable a bit in python, nothing really to talk about on that. but could you just give a demo on: lets say I wanted to scrape a header and the associated images of that header. the headers by using some keyword from the website that has this as their headline : 'samsung new galaxy (some fancy name ) is a market hit says CEO. and the image have some text that is attatched to it that states: source getty images or somthing like that. to get those header and images returned. Can I just give all the header and image text as a keyword so beautiful soup could parse and ger the url for the image and assiciated header or header with assiciated image url then return the valueof the image and header. why I ask this?. because I don't want to be looking for those element manually (google inspect tool) I just need to add keywords and hit run then the code automatically find those and return them.
@jpsl5281
@jpsl5281 20 күн бұрын
why 20 minutes ?
@StormWolf01
@StormWolf01 27 күн бұрын
The video was pleasant, but the title didn't give any info on what the video was about.
@diego750
@diego750 18 күн бұрын
You appear to have reading comprehension issues. Seek help
@njl1282
@njl1282 16 күн бұрын
I did just this and now work remotely making six figures at the same company
@moloxiao
@moloxiao Ай бұрын
if you do this, all the difficult part is about cloudflare
@Jisamaniac
@Jisamaniac 7 сағат бұрын
I understand code. But I can't code for crap. The power Chat GPT and Claude AI, I can get by with the basics to tm do the basics.
@FireFly969
@FireFly969 Ай бұрын
Yes its something great, and feels like you are so developed 😂😂, when you see someone do something that takes like hours while you can automate it, and let computer do it, while you are saving your energy and time to important things
@paladine4life
@paladine4life 6 күн бұрын
Hey John, why you are never at your computer? Because scripts! Ok, here is more work then.
@mcdinkysgarage4514
@mcdinkysgarage4514 3 күн бұрын
The answer to "why aren't you ever at your desk" is always just one word: bowels.
@satishm5260
@satishm5260 Ай бұрын
1st like
@JohnWatsonRooney
@JohnWatsonRooney Ай бұрын
🎉
@bryce3851
@bryce3851 Ай бұрын
Beat me to it .
@bakasenpaidesu
@bakasenpaidesu Ай бұрын
6th 😂
@DominicFlynn
@DominicFlynn Ай бұрын
Try it again with Puppeteer
@bakasenpaidesu
@bakasenpaidesu Ай бұрын
Nande?
@illyloko
@illyloko 28 күн бұрын
Thanks this really gives a great outline to pull and analyze more efficiently. Exactly the type of thing I needed to see to get me back on the keys 🫡
How I Scrape 7k Products with Python (code along)
27:26
John Watson Rooney
Рет қаралды 3,5 М.
host ALL your AI locally
24:20
NetworkChuck
Рет қаралды 703 М.
Which one is the best? #katebrush #shorts
00:12
Kate Brush
Рет қаралды 16 МЛН
Универ. 13 лет спустя - ВСЕ СЕРИИ ПОДРЯД
9:07:11
Комедии 2023
Рет қаралды 2,6 МЛН
God-Tier Developer Roadmap
16:42
Fireship
Рет қаралды 6 МЛН
WHY did this C++ code FAIL?
38:10
The Cherno
Рет қаралды 146 М.
I've Read Over 100 Books on Python. Here are the Top 3
9:26
Python Programmer
Рет қаралды 286 М.
Sunflowers are my BEST Python-Automated Crop
34:57
Olexa
Рет қаралды 19 М.
Zed “kills” VSCode
12:10
Alex Ziskind
Рет қаралды 570 М.
Stop Wasting Time on Simple Excel Tasks, Use Python
17:56
John Watson Rooney
Рет қаралды 9 М.
I tried 10 code editors
10:28
Fireship
Рет қаралды 2,9 МЛН
КОПИМ НА АЙФОН В ТГК АРСЕНИЙ СЭДГАПП🛒
0:59
Интереснее чем Apple Store - шоурум BigGeek
0:42
Настоящий детектор , который нужен каждому!
0:16
Самый топовый ПК без RGB подсветки
1:00
CompShop Shorts
Рет қаралды 162 М.