Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YT link not available when contain special character?(link checked using ytdl.validateURL) #1066

Closed
DanielBUBU opened this issue Feb 20, 2022 · 2 comments · Fixed by #1073
Closed
Labels

Comments

@DanielBUBU
Copy link

DanielBUBU commented Feb 20, 2022

  • If you're getting a specific error message, include the full stack trace
https://www.youtube.com/watch?v=RypOHapqCeQ
R [Error]: No video id found:  https://www.youtube.com/watch?v=RypOHapqCeQ
    at Object.exports.getVideoID (D:\甲類資料\PD_maid\node_modules\ytdl-core\lib\url-utils.js:63:11)
    at Function.exports.<computed> [as getInfo] (D:\甲類資料\PD_maid\node_modules\ytdl-core\lib\info.js:476:29)
    at ytdl (D:\甲類資料\PD_maid\node_modules\ytdl-core\lib\index.js:19:8)
    at next_song (D:\甲類資料\PD_maid\music_functions\music_func.js:23:39)
    at B.<anonymous> (D:\甲類資料\PD_maid\index.js:52:5)
    at B.emit (node:events:526:28)
    at B.set state [as state] (D:\甲類資料\PD_maid\node_modules\@discordjs\voice\dist\index.js:6:6048)
    at OggDemuxer.t (D:\甲類資料\PD_maid\node_modules\@discordjs\voice\dist\index.js:8:395)
    at Object.onceWrapper (node:events:646:26)
    at OggDemuxer.emit (node:events:538:35) {
  resource: T {
    playStream: OggDemuxer {
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 6,
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: true,
      _remainder: null,
      _head: null,
      _bitstream: null,
      [Symbol(kCapture)]: false,
      [Symbol(kCallback)]: null
    },
    edges: [ [Object], [Object] ],
    metadata: null,
    volume: undefined,
    encoder: undefined,
  • If you're getting unexpected behavior without an error message
    • What should happen?
      -no error
    • What happens instead?
    • error caught
  • Include any relevant code around ytdl-core. You don't have to upload your entire program, small snippets are fine.
if (ytpl.validateID(inp_url)) {
                        const playlist = await ytpl(inp_url, { pages: 4 });

                        if (playlist.items.length >= client.ytpl_limit) {


                            modal.channel.send({ embeds: [output_embed], components: [row1] });
                            modal.reply((client.ytpl_limit) + ' songs adding to list' + `\`\`\`${inp_url}\`\`\``)
                            for (let index = 0; index < client.ytpl_limit; index++) {
                                client.queue.push(playlist.items[index].shortUrl);
                            }

                            client.ytpl_continuation = playlist;
                        } else {
                            modal.reply((playlist.items.length) + ' songs adding to list' + `\`\`\`${inp_url}\`\`\``)
                            for (let index = 0; index < playlist.items.length; index++) {
                                client.queue.push(playlist.items[index].shortUrl);
                            }

                        }




                    } else if (ytdl.validateURL(inp_url)) {
                        await client.queue.push(inp_url);
                        modal.reply('1 song adding to list' + `\`\`\`${inp_url}\`\`\``)
                    } else {
                        modal.reply('link not avaliable' + `\`\`\`${inp_url}\`\`\``)
                    }
next_song(client, args) {


        if (client.queue.length) {
            const next_song_url = client.queue.shift();
            console.log(next_song_url);
            client.audio_stream = ytdl(next_song_url, { filter: 'audioonly', highWaterMark: 1024, dlChunkSize: 65536 });
            client.audio_resauce = createAudioResource(client.audio_stream, { inputType: StreamType.Arbitrary });
            client.audio_player.play(client.audio_resauce);
            if (client.isloop === true) {
                client.queue.push(next_song_url);
            }


        } else {
            console.log("queue is empty")
        }
    },
  • If this error happens only on some videos, include a link or links to videos.
  • link is copied from cmd console log, might contain special character
    No error occur when link is copied from chorme
@TimeForANinja
Copy link
Collaborator

if you check the error

No video id found:  https://www.youtube.com/watch?v=RypOHapqCeQ

you can see that there are 2 spaces between found: and https://
one is expected as part of the template string, the second is invalid input by the user
the #1073 will add a new feature to trim whitespaces from the id's

@github-actions
Copy link

github-actions bot commented Mar 5, 2022

🎉 This issue has been resolved in version 4.11.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants