Play youtube in python

Introduction

I wanted to make a beep so that I could see that the calculation was finished, but it was difficult on a Mac. It was troublesome to get the audio file, so I decided to play youtube. With Python, it was pretty easy with standard modules. Occasionally scratches when the commercial is played. .. ..

environment

mac OS Catalina 10.15.6 Python 3.5.5

code

play_youtube.py


import webbrowser
webbrowser.open("URL of the video you want to play")

It's pretty easy, it's done in two lines. By the way, I'm using this

Recommended Posts

Play youtube in python
Search and play YouTube videos in Python
Get YouTube Comments in Python
Quadtree in Python --2
Python in optimization
CURL in python
Geocoding in python
SendKeys in Python
Meta-analysis in Python
Unittest in python
Epoch in Python
Discord in Python
Play Python async
Sudoku in Python
DCI in Python
Play with 2016-Python
quicksort in python
nCr in python
N-Gram in Python
Programming in python
Plink in Python
Constant in python
Lifegame in Python.
FizzBuzz in Python
Sqlite in python
StepAIC in Python
N-gram in python
LINE-Bot [0] in Python
Csv in python
Disassemble in Python
Reflection in Python
Constant in python
nCr in Python.
format in python
Scons in Python3
Puyo Puyo in python
python in virtualenv
PPAP in Python
Quad-tree in Python
Reflection in Python
Chemistry in Python
Hashable in python
DirectLiNGAM in Python
LiNGAM in Python
Flatten in python
flatten in python
Install Pyaudio to play wave in python
Get Youtube data in Python using Youtube Data API
Try hitting the YouTube API in Python
Sorted list in Python
Daily AtCoder # 36 in Python
Clustering text in Python
Daily AtCoder # 2 in Python
Daily AtCoder # 32 in Python
Daily AtCoder # 6 in Python
Daily AtCoder # 18 in Python
Edit fonts in Python
Singleton pattern in Python
Read DXF in python
Daily AtCoder # 53 in Python
Use config.ini in Python