在Colab 使用
pip install pytube
from pytube import YouTube
from google.colab import drive
drive.mount('/content/gdrive')
url =input('請輸入你要下載的youtube網址: ')
y=YouTube ('url')
yt=y.streams.get_highest_resolution()
yt.download('/content/gdrive/MyDrive/456')
產生下列錯誤訊息。
RegexMatchError Traceback (most recent call last)
in ()
1 url =input('請輸入你要下載的youtube網址: ')
----> 2 y=YouTube ('url')
3 yt=y.streams.get_highest_resolution()
4 yt.download('/content/gdrive/MyDrive/456')
2 frames
/usr/local/lib/python3.7/dist-packages/pytube/helpers.py in regex_search(pattern, string, group)
127 results = regex.search(string)
128 if not results:
--> 129 raise RegexMatchError(caller="regex_search", pattern=pattern)
130
131 logger.debug("matched regex search: %s", pattern)
RegexMatchError: regex_search: could not find match for (?:v=|/)([0-9A-Za-z_-]{11}).*