5

I'm trying to write a Python app that can subscribe to a channel on YouTube, but I honestly have no idea how. The idea is that the script would open chrome, check if the user is signed in, and if so, subscribe to the channel by running code to clicking the button.

I'm looking for some kind of API or tool I can use to send commands or control the browser in some way. I've tried selenium, but I need to use a browser where the user is already signed in, so the driver Selenium uses won't work. I also tried to use a selenium RC server, but that wouldn't work. No other Python lib I've looked for can do what I need it to do. The closest is webbrowser which opens the tab, but that's it.

I don't need any code or anything, just a pointer to an API or keywords to search for to find what I need. Thanks for any help!

EDIT: I found out for the thing i'm trying to do, using image recognition to find the buttons on the screen and clicking them directly is much easier and better. Sorry for the trouble.

1
  • 1
    Why don't you use the Python YouTube API instead of trying to muck about automating a browser. Commented Nov 29, 2018 at 0:55

2 Answers 2

5

There is Puppeteer, headless Chrome for NodeJS created by Google for stuff like browser automation. Puppeteer is quite easy to use. You can use it with the Chrome that comes bundled with it or Chrome that is already installed (the one you probably need) on the user's system.

Puppeteer also has an unofficial port for Python that requires Python 3.6+. You can check that out as well. Puppeteer Python

I will recommend using the offical NodeJS Puppeteer though.

Note: It's Chrome-only.

Sign up to request clarification or add additional context in comments.

Comments

0

Why don't you just use pydirectinput or pyautogui just do pip install pyautogui or just do pip install pydirectinput and then use it

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.