Skip to main content

UNSUBSCRIBE T-SERIES & SUBSCRIBE TO PEWDIEPIE AUTOMATICALLY - BOT USING PYTHON

UNSUBSCRIBE T-SERIES & SUBSCRIBE TO PEWDIEPIE AUTOMATICALLY - BOT USING PYTHON

 

Hello world , I m back with a new automation  bot, but this time, its time to support Felix aka PewDiePie, so I decide to make a bot that automatically unsubscribes from T-series YouTube Channel. Now, obviously this isn't going to hack into servers and all ,but you can use this in your friend's PC to make him unsub from T-Series or just do it for fun.

Before Starting the Requirements will be the same as my previous post -

Requirements :

  1. Selenium WebDriver (Link is given below)
  2. Python3
  3. Any Text Editor
First we'll see the code then the main explanation : 

#import statements

from time import sleep

from selenium import webdriver

#We will use this Options class to use user data of google-chrome to access 

#login of the user, that is nothing but stay signed in for the automated web driver
from selenium.webdriver.chrome.options import Options
#Keys to use arrow keys here (but you can use any keys)
from selenium.webdriver.common.keys import Keys


#This part is where your user data of the google-chrome is stored, we need the user 
#to first login normally in chrome and then using the cookies, session, and all that
#data which is stored in our PC (File path is mentioned below)
options = Options()
options.add_argument("user-data-dir=~/.config/google-chrome")
browser = webdriver.Chrome('./chromedriver', chrome_options=options)

#Pass the url of T-series youtube channel
browser.get('https://www.youtube.com/user/tseries/about')
#sleep(1) is used to wait for 1 second, usually done to make sure the site has been loaded properly
sleep(1)

#Now we'll click on unsubscribe button (if you want to see what id it has check below)
unSub = browser.find_element_by_id('subscribe-button')
unSub.click()
sleep(2)

#Then after clicking on the unsubscribe button, we see a dialog box saying 'Are you sure?' so ,we'll #click on ok button
confirm = browser.find_element_by_id('confirm-button')
confirm.click()
sleep(5)

#Now we'll visit pewdiepie's channel and click on subscribe
browser.get('https://www.youtube.com/channel/UC-lHJZR3Gqxm24_Vd_AJ5Yw')
Sub = browser.find_element_by_id(
    'subscribe-button')
Sub.click()
browser.close()

IMPORTANT :
For options.add_argument() see this ,

Windows 7, 8.1, and 10:
C:\Users\<username>\AppData\Local\Google\Chrome\User Data\Default

Mac OS X El Capitan:
Users/<username>/Library/Application Support/Google/Chrome/Default

 Linux:
/home/<username>/.config/google-chrome/default
change the <username> to whatever is your PC username

Mine is linux, so all the linux users this arugment will be the same
but for windows user copy paste this

WEB SCRAPPING

See the id of subscribed button has id = 'subscribe-button'


Now we'll see the ID of the 'Confirmation Box'















SUMMARY:

  1. So what we have done is , we have first logged in to the browser(done before you run this program, only once is enough if you don’t log out).
  2. So now you goto the T-series channel and then click on unsubscribe button and then we clicked on the confirmation OK button.
  3. Then you just run this program, but make sure chromedriver is still in your current working directory.
Thank you for reading :)
Here’s link to my previous blog, which will help you install this selenium webdriver and automation:

Comments

  1. Explained in the best possible way ✨😍

    ReplyDelete
    Replies
    1. Thank you so much bro, grateful ❤️❤️❤️✨👀

      Delete

Post a Comment

Popular posts from this blog

How to use Chess com API using Python

  How to use Chess com API using Python Chess is an amazing strategy-based game and if you have been following the recent boom of online chess then welcome to the chess club. Online chess is amazing since it allows you to play with a random stranger at your level or stockfish (computer). There are many popular online chess websites like lichess.org, chess.com, playchess.com, and newly created kasparovchess.com. Today we will be seeing how to use chess.com API for getting players' stats. You can create software and get affiliates from them (check out the link below), so share it with them if you are planning to create something. Before you start make sure you have the following things: Pre-requirements Postman Anaconda or mini conda or Python idle Any text editor of your choice Pretty good? Now let’s download the JSON file that chess com developers have already made for us from here and then you import it to the Postman. This just helps you with prewritten get methods so that ...

Create your own YouTube video and playlist downloader using QT designer in Python

Create your own YouTube video and playlist downloader using QT designer in Python The code for this software is available on my GitHub, the link is given below. Create your own YouTube video and playlist downloader using QT designer in Python This is the thing we are trying to make today for this article The code for this software is available on my GitHub, the link is given below. If you haven’t checked out my previous article on the same topic but not the GUI version, please check it out. 3 ways to download YouTube playlists at once using Python Have you guys ever wanted to download your entire youtube playlist? rahulbhatt1899.medium.com So before starting to code let's check if you have all the requirements beforehand: Pre-requirements : Qt designer Anaconda or mini conda or python 3.7 compiler Any text editor of your choice Libraries to download: Pytube Ffmpy PyQt5 This would be sectioned into the following structure: Creating the UI in Qt designer Converting UI file int...

Authentication Using Passport JS

Authentication is big and most complicated part of an application, but it is also the  preponderance  part of any web app/software in general. Passport JS Passport JS is a widely popular authentication module for  Node js.  The sole purpose is to authenticate requests and is based on the idea of pluggable authentication strategies ( including local strategy, there are more than 500 strategies currently  available  ). When using third party application Your app never receives your password  thus freeing the developer from the burden of security related to handling and storing passwords. The Passport authentication and its strategy will include protection against attacks like “man in the middle” and other vectors an attacker might exploit. We are going to use Facebook strategy, for now, to install Passport and Facebook strategy type in the following command: Next, we are going to write the authentication code, and we’ll be creating a different module cal...