标签: ytdl

yt-dlp 'rate-limit' 不会限制 Python 脚本中的速度

我已将 yt-dlp 实现为 Python 脚本的一部分,它运行良好,但我无法使速率限制功能发挥作用。如果您从 CLI 运行相同的命令,速率会被正确限制,有人能告诉我正确的语法吗?

我尝试了多种组合,例如速率限制、限制速率 0.5m、500k、500KiB、500,但似乎都不起作用

        ydl_opts = {
        'limit-rate': '500k',

    }

    with yt_dlp.YoutubeDL(ydl_opts) as ydl:
        ydl.download([link]) 
Run Code Online (Sandbox Code Playgroud)

我正在使用这里的文档;https://github.com/yt-dlp/yt-dlp 但我很困惑,因为 CLI 命令有效,但嵌入式脚本版本无效,

我也尝试用 _ 替换 - 但仍然没有效果,你有什么想法吗?ydl_opts 中的其他选项可以正常工作

希望我们能够解析正确的语法,而不必实现 Trickle 或限制套接字。

python bandwidth-throttling ytdl

5
推荐指数
1
解决办法
2778
查看次数

如何使用discord.js 音乐机器人寻找歌曲中的某个点?

我正在尝试用 制作一个discord.js音乐机器人ytdl-core。我不太确定如何在使用命令时查找歌曲中的当前时间,并且搜索帮助并没有真正起到多大作用。该命令的工作方式如下!seek 1:30

我想要了解的是:
a) 调度程序是否包含查找功能?

//i.e like below
let ms = 90000; //would be converted from arguments
queue.connection.dispatcher.seek(ms) //Does this exist???
Run Code Online (Sandbox Code Playgroud)

或 b) 如何在特定时间开始播放歌曲?

//Add the song again, but with a timestamp, and end current song
let seekedSong = queue.songs[0];
seekedSong.startTime = 90000; 
queue.songs.unshift(seekedSong);
queue.connection.dispatcher.end()
/* However, how do I start a song given a start time?
 * 
 * In my play.js file, which plays the next song in the queue automatically, 
 * …
Run Code Online (Sandbox Code Playgroud)

node.js discord.js ytdl

1
推荐指数
1
解决办法
4746
查看次数

Discord.js ytdl 错误:输入流:状态代码:416

我有一个使用 ytdl 的音乐 Discord 机器人,偶尔,歌曲会随机停止并输出此错误:

Error: input stream: Status code: 416
Run Code Online (Sandbox Code Playgroud)

这是我的 playSong 函数的代码

static playSong(queue, message) {
    const classThis = this;
    queue[0].voiceChannel
    .join()
    .then(function(connection) {
        const dispatcher = connection.play(ytdl(queue[0].url, {quality: 'highestaudio'}))
        .on('start', function() {
            message.guild.musicData.songDispatcher = dispatcher;
            dispatcher.setVolume(message.guild.musicData.volume);
            const videoEmbed = new Discord.MessageEmbed()
                .setThumbnail(queue[0].thumbnail)
                .setColor(embedSettings.color)
                .addField('Now Playing', `${queue[0].title} (${queue[0].url})`)
                .addField('Duration', queue[0].duration)
                .setFooter(embedSettings.footer, embedSettings.footer_url);
            if (queue[1]) videoEmbed.addField('Next Song:', queue[1].title);
            message.say(videoEmbed);
            message.guild.musicData.nowPlaying = queue[0];
            return queue.shift();
        })
        .on('finish', function() {
            if (queue.length >= 1) {
                return classThis.playSong(queue, message);
            } else { …
Run Code Online (Sandbox Code Playgroud)

node.js discord discord.js ytdl

0
推荐指数
1
解决办法
2895
查看次数