The Ultimate Guide to Selenium Bots - Automating Twitter
Python Simplified
@pythonsimplifiedAbout
Hi everyone! My name is Mariya and I'm a software developer from Sofia, Bulgaria. I film programming tutorials about Computer Science Concepts, GUI Applications, Machine Learning and Artificial Intelligence, Automation and Web Scraping, Data Science and even Math! π€ I'm here to help you with your programming journey (in particular - your Python programming journey π) and show you how many beautiful and powerful things we can do with code! πͺπͺπͺ
Video Description
In this video we will explore the art of bot making for the purpose of understanding how it's being used against us π€π€π€ We will create a simple retweeting bot that searches for posts that contain a certain keyword like: "cat" or "dog" and then retweets selected posts with a quoted message. The code and the lesson-flow I will demonstrate does not contain any unethical practices: we use a single account and we automate it for harmless purposes. However the techniques you will learn can be applied on different use cases β’οΈβ’οΈ so PLEASE use this information responsibly!!! β’οΈβ’οΈ ----------------------------------------------------------------- β THANK YOU TO THE SPONSORS β ----------------------------------------------------------------- This video is brought to you by Bright Data, an innovative web platform that collects and structured web data so that you don't have to! βββ Check them out right now: https://brightdata.grsm.io/pythonsimplified ----------------------------------------------------------------- π¬ RELATED TUTORIALS OF MINE π¬ ----------------------------------------------------------------- β Anaconda Beginners Guide (Install Python): https://youtu.be/MUZtVEDKXsk β Simple Web App with Flask (HTML introduction): https://youtu.be/6plVs_ytIH8 β Advanced Web App with Flask (HTML introduction): https://youtu.be/v3CSQkPJtAc β Python For Loops for Beginners: https://youtu.be/dHANJ4l6fwA ----------------------------------------------------------------- β° TIME STAMPS β° ----------------------------------------------------------------- 00:00 - intro 00:52 - what is a bot? 02:25 - dummy account 03:25 - web driver set up 04:37 - Selenium set up 05:25 - Jupyter Notebook set up 06:17 - initialize web driver object 07:38 - fix Session Not Created Exception 09:24 - quick introduction to HTML (1 sentence) 09:47 - find element by tag name 11:04 - Developer Tools and how to use it 12:46 - find elements by XPATH 14:12 - why Jupyter Notebook is the best editor for automation 14:30 - continue log in automation 16:26 - search keyword shortcut 17:46 - retweet automation 19:23 - quote tweet automation 20:44 - find elements that contain certain data 24:24 - pause code execution with time.sleep() 25:22 - combine all notebook cells and review code 28:13 - BrightData 29:30 - retweet multiple tweets at once 30:50 - scroll to the bottom of the page (to fetch a new batch of tweets) 32:03 - randomly select a quote message from a pre-defined list 33:52 - fix Element Click Intercepted Exception 35:36 - run bot with full automation 36:14 - your thoughts on the ethics of bot making 37:07 - thanks for watching! :) ----------------------------------------------------------------- π€ COMPLETE CODE ON GITHUB π€ ----------------------------------------------------------------- https://github.com/MariyaSha/TwitterBot ----------------------------------------------------------------- π» IMPORT COMMANDS π» ----------------------------------------------------------------- from selenium import webdriver from selenium.webdriver.common.by import By --------------------------------------------------------------------------------- πΈοΈ WEB DRIVERS FOR DIFFERENT BROWSERS πΈοΈ --------------------------------------------------------------------------------- β Chrome: https://chromedriver.chromium.org/downloads β Firefox: https://github.com/mozilla/geckodriver/releases β Edge: https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ -------------------------------------- π€ Connect with me π€ -------------------------------------- π Github: https://github.com/mariyasha π Discord: https://discord.com/invite/wgTTmsWmXA π LinkedIn: https://ca.linkedin.com/in/mariyasha888 π Twitter: https://twitter.com/mariyasha888 π Blog: https://www.pythonsimplified.org -------------------------------------------- π³ Credits π³ -------------------------------------------- β Beautiful animated graphics by: mixkit.co β Beautiful icons by: flaticon.com β Beautiful images by: https://www.freepik.com/
Essential Travel Photography Gear
AI-recommended products based on this video

eazpower for Magsafe Power Bank 10000mAh, Magnetic Battery Pack Wireless, 20W PD Fast Charging, Compact Portable Charger with Built-in Cables and Stand for iPhone 16/15/14/13/12/ Apple Watch/Airpods

SanDisk 64GB Extreme PRO SDXC UHS-I Memory Card - C10, U3, V30, 4K UHD, SD Card - SDSDXXU-064G-GN4IN

SanDisk 128GB Extreme PRO SDXC UHS-I Memory Card - C10, U3, V30, 4K UHD, SD Card - SDSDXXD-128G-GN4IN

Anker Nano USB C Wall Charger,45W Fast Charging Smart Display Charger,with 180Β°Foldable Plug,Smart Recognition,Built-in Care Mode,for iPhone17/16/15 (Non-Battery,One USB-C Port,No Cable Included) ClimatePartner certified

NEEWER Advanced 18 inch LED Ring Light for Phone, LCD Touch Screen, 2.4G Remote Lights Control, 3200-5600K, Tripod Light for iPhone Action Camera, for Studio Makeup TikTok YouTube Video Salon (Black)

COLORCORAL Car Cleaning Gel Universal Dust Cleaner Vehicle Auto Detailing Car Vent Keyboard Cleaning Putty Cars Interior Cleaner Dashboard Dust Remover Putty Duster Wipes Swaps Cleaning Kit 160G

KLONA Handheld Steam Cleaner, Steam Cleaner for Home with 10 Accessory Kit, Multipurpose Portable Upholstery Steamer Cleaning with Safety Lock to Remove Grime, Grease.

KLONA Handheld Steam Cleaner, Steam Cleaner for Home with 10 Accessory Kit, Multipurpose Portable Upholstery Steamer Cleaning with Safety Lock to Remove Grime, Grease, and More




















