Pytube
https://github.com/pytube/pytube
GitHub - pytube/pytube: A lightweight, dependency-free Python library (and command-line utility) for downloading YouTube Videos.
A lightweight, dependency-free Python library (and command-line utility) for downloading YouTube Videos. - GitHub - pytube/pytube: A lightweight, dependency-free Python library (and command-line ut...
github.com
How to use ?
from pytube import YouTube
url = 'https://youtu.be/2lAe1cqCOXo'
# 모든 정보 확인
yt = YouTube(url).streams
for k, v in yt.items():
print(k, v)
# url 영상 다운
yt = YouTube(url)
yt.streams.filter(progressive=True, file_extension='mp4').order_by('resolution').desc().first().download()
Error
1. raise RegexMatchError(caller="regex_search", pattern=pattern)
pytube.exceptions.RegexMatchError: regex_search: could not find match for (?:v=|\/)([0-9A-Za-z_-]{11}).*
https://github.com/pytube/pytube/pull/313#issuecomment-438175656
Fix of new signature deciphering by johnberroa · Pull Request #313 · pytube/pytube
#312 It seems a lot of people are getting this error because youtube changed its signature deciphering method (as pointed out by @anxdpanic). It's a hacky fix but it will get the program running:...
github.com
Solution
[python이 설치된 path]/[python 버전]/libs/site-packages/pytube/ciper.py 중 다음 line을 추가
r'\bc\s*&&\s*d\.set\([^,]+,.*?\((?P<sig>[a-zA-Z0-9$]+)\(\(0\s*,\s*window.decodeURIComponent' # add
'Python > 모듈 & 패키지 & 라이브러리' 카테고리의 다른 글
[Python] 리스트의 원소 곱 - reduce (0) | 2024.01.11 |
---|---|
[Python] 화면 캡쳐 라이브러리 처리 속도 비교 (0) | 2023.11.02 |
[Python] / [pafy] Youtube 영상 처리 (0) | 2023.07.10 |
[Python] 우선순위 큐 (Priority Queue) (0) | 2023.01.17 |
[Python] set 집합 (0) | 2022.10.18 |