zoukankan      html  css  js  c++  java
  • youtube爬虫

    pycharm安装pytube工具包,可以参考github:https://github.com/nficano/pytube

    from pytube import YouTube
    link = input("enter link of youtube vadio:")
    yt = YouTube(link)
    videos = yt.streams.filter(subtype='mp4').all()
    
    i = 1
    for stream in videos:
        print(str(i) + " " + str(stream))
        i += 1
    
    stream_number = int(input("enter number:"))
    
    video = videos[stream_number-1]
    # vadio文件夹必须存在,否则报错 video.download("D:/vadio") print("downloaded")
    控制台操作:
    enter link of youtube vadio:https://www.youtube.com/watch?v=BH7D2aLPekc 1 <Stream: itag="22" mime_type="video/mp4" res="720p" fps="30fps" vcodec="avc1.64001F" acodec="mp4a.40.2"> 2 <Stream: itag="18" mime_type="video/mp4" res="360p" fps="30fps" vcodec="avc1.42001E" acodec="mp4a.40.2"> 3 <Stream: itag="136" mime_type="video/mp4" res="720p" fps="30fps" vcodec="avc1.4d401f"> 4 <Stream: itag="135" mime_type="video/mp4" res="480p" fps="30fps" vcodec="avc1.4d4014"> 5 <Stream: itag="134" mime_type="video/mp4" res="360p" fps="30fps" vcodec="avc1.4d401e"> 6 <Stream: itag="133" mime_type="video/mp4" res="240p" fps="30fps" vcodec="avc1.4d400c"> 7 <Stream: itag="160" mime_type="video/mp4" res="144p" fps="30fps" vcodec="avc1.4d400b"> 8 <Stream: itag="140" mime_type="audio/mp4" abr="128kbps" acodec="mp4a.40.2"> enter number:1 downloaded

      

    Unkonw Unkonw(你不知道一样东西,你也会不知道自己不知道这样东西)
  • 相关阅读:
    java后端
    2017-12-11
    二叉树与分治法整理
    javaweb
    安装docker
    爬虫
    lintcode
    DEEPlearning
    剑指offer_by牛客网
    DFS
  • 原文地址:https://www.cnblogs.com/2014-1130/p/11650636.html
Copyright © 2011-2022 走看看