TypeError: 'DeferredGeneratorList' object is not callable in Python Code

TypeError: 'DeferredGeneratorList' object is not callable in Python Code

我正在尝试将整个 Youtube 播放列表下载为 MP3,下面的代码给了我一个 TypeError: 'DeferredGeneratorList' object is not callable,我尝试用谷歌搜索它,我根本没有发现类似的错误,我有什么问题吗做错了吗?和/或,我可以使用其他方法来实现吗?

代码:

import os
import subprocess

from pytube import Playlist, YouTube


def run(pl):
    # get parent directory; VERY IMPORTANT!!
    # INCLUDE LAST SLASH AFTER FOLDER NAME
    # e.g. /home/username/Folder/ or C:\Users\Username\Folder\
    filepath = input("Please enter the filepath of the directory where this script is located:\n")
    # get linked list of links in the playlist
    links = pl.video_urls()
    # download each item in the list
    for l in links:
        # converts the link to a YouTube object
        yt = YouTube(l)
        # takes first stream; since ffmpeg will convert to mp3 anyway
        music = yt.streams.first()
        # gets the filename of the first audio stream
        default_filename = music.default_filename
        print("Downloading " + default_filename + "...")
        # downloads first audio stream
        music.download()
        # creates mp3 filename for downloaded file
        new_filename = default_filename[0:-3] + "mp3"
        print("Converting to mp3....")
        # converts mp4 audio to mp3 audio
        subprocess.run(['ffmpeg', '-i',
                        os.path.join(filepath, default_filename),
                        os.path.join(filepath, new_filename)
                        ])

    print("Download finished.")


if __name__ == "__main__":
    url = input("Please enter the url of the playlist you wish to download: ")
    pl = Playlist(url)
    run(pl)

错误:

Traceback (most recent call last):
  File "C:/Users/Totenkopf/Downloads/test/main.py", line 40, in <module>
    run(pl)
  File "C:/Users/Totenkopf/Downloads/test/main.py", line 13, in run
    links = pl.video_urls()
TypeError: 'DeferredGeneratorList' object is not callable

video_urls 是列表而不是方法。在没有 () 的情况下调用 video_urls。