【问题标题】:Youtube dl title print _Youtube dl 标题打印_
【发布时间】:2019-12-09 12:07:30
【问题描述】:

我正在创建一个音乐机器人,当用户使用命令播放时 机器人打印带有标题和其他信息的嵌入 但是当嵌入打印 desc 时,歌曲的标题是_。 我该如何解决?

截图:

async with ctx.typing():
    try:
        source = await YTDLSource.create_source(ctx, search, loop=self.bot.loop)
    except YTDLError as e:
        await ctx.send('Errore: {}'.format(str(e)))
    else:
        song = Song(source)
        await ctx.voice_state.songs.put(song)
        ctx.source = source
        ctx.requester = source.requester
        print(source)
        print(source.requester)
        print(source.title)
        embed = (discord.Embed(title='Aggiunto alla coda',
                               description='```css\n{0.source.title}\n```'.format(ctx),
                               color=discord.Color.orange())
                 .add_field(name='Durata', value=ctx.source.duration)
                 .add_field(name='Richiesta da', value=ctx.requester.mention)
                 .set_thumbnail(url=ctx.source.thumbnail))
        await ctx.send(embed=embed)

这里可能有问题?

def __init__(self, ctx: commands.Context, source: discord.FFmpegPCMAudio, *, data: dict, volume: float = 0.5):
    self.title = data.get('title')

【问题讨论】:

    标签: python discord.py youtube-dl


    【解决方案1】:

    '_' 是 youtube-dl 无法确定标题时的值。

    如果这发生在 2019 年 7 月附近并且在 YouTube 视频中(而不是其他 1000+ supported sites 之一),最可能的解释是您的 youtube-dl 版本已过时; YouTube 于 2019 年 7 月 30 日更改了视频标题的格式。

    访问 https://yt-dl.org/update 了解如何更新 youtube-dl。很可能,它就像运行 youtube-dl -U 一样简单。

    要获取有关此类问题的更多信息,最好将 youtube-dl 发出的警告显示在 stderr 上,至少对开发人员而言是这样。

    【讨论】:

    • 编辑:conda 没有更新模块现在它适用于所有人
    猜你喜欢
    • 1970-01-01
    • 2022-01-27
    • 2021-09-05
    • 2015-02-20
    • 2018-04-11
    • 1970-01-01
    • 1970-01-01
    • 2015-10-24
    • 2015-08-03
    相关资源
    最近更新 更多