Youtube Video title with API v3 without API key?

前端 未结 4 1310
猫巷女王i
猫巷女王i 2020-12-03 03:03

Is it possible to get the video title using the video ID with API v3 without the API key? I could not find any information or example of getting the title i

4条回答
  •  囚心锁ツ
    2020-12-03 04:02

    Yes You Can Without Any API Just Requests an re Modules

    Code In Python:

    import requests,re
    
    video_url = "https://www.youtube.com/watch?v=2i2khp_npdE"
    
    response = requests.get(video_url).text
    
    title = re.findall(r'"title":"[^>]*",',response)[0].split(',')[0][9:-1]
    
    print("\n[+] Video Title: {}".format(title))
    

    Output:

    [+] Video Title: Alan Walker - Sing Me To Sleep

提交回复
热议问题