微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用pytube模块下载Youtube电影出现一些问题

如何解决使用pytube模块下载Youtube电影出现一些问题

这是我的代码,我正在尝试下载 YouTube 视频

 from pytube import YouTube
    yt = YouTube('https://www.youtube.com/watch?v=JwBXgJeqeOs')
    yt.streams.first().download()

如果有人能帮我解决这个问题,我遇到了一个错误 我正在尝试下载 youtube 视频

RegexMatchError                           Traceback (most recent call last)
    <ipython-input-9-1c0e243bf649> in <module>
          1 from pytube import YouTube
    ----> 2 yt = YouTube('https://www.youtube.com/watch?v=JwBXgJeqeOs')
          3 print(yt.streams)
          4 yt.streams.first().download()
    
    ~\anaconda3\lib\site-packages\pytube\__main__.py in __init__(self,url,defer_prefetch_init,on_progress_callback,on_complete_callback,proxies)
         89 
         90         if not defer_prefetch_init:
    ---> 91             self.prefetch()
         92             self.descramble()
         93 
    
    ~\anaconda3\lib\site-packages\pytube\__main__.py in prefetch(self)
        181         self.vid_info_raw = request.get(self.vid_info_url)
        182         if not self.age_restricted:
    --> 183             self.js_url = extract.js_url(self.watch_html)
        184             self.js = request.get(self.js_url)
        185 
    
    ~\anaconda3\lib\site-packages\pytube\extract.py in js_url(html)
        141         The html contents of the watch page.
        142     """
    --> 143     base_js = get_ytplayer_config(html)["assets"]["js"]
        144     return "https://youtube.com" + base_js
        145 
    
    ~\anaconda3\lib\site-packages\pytube\extract.py in get_ytplayer_config(html)
        200             return json.loads(yt_player_config)
        201 
    --> 202     raise RegexMatchError(caller="get_ytplayer_config",pattern="config_patterns")
        203 
        204 
    
    RegexMatchError: get_ytplayer_config: Could not find match for config_patterns

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。