Bratanov / community-driven-radio

A radio station driven by the community
10 stars 1 forks source link

Improvement / Limit burst songs adding #29

Open Bratanov opened 7 years ago

Bratanov commented 7 years ago

Set a hard limit of how many songs can be added per minute/few seconds, so the playlist can't be flooded with Djordjano's all time playlist songs.

How to reproduce:

  1. Go into S Мюзик's YouTube channel: https://www.youtube.com/channel/UCEvaHPE8HZbIyAbQD_maekQ/videos
  2. Click Load more below until all videos are loaded.
  3. Execute the following code in the console:
    {
    let songs = []
    for(let song of $$(".spf-link")) {
    if(song.href && song.href.indexOf("watch?") !== -1) { 
      songs.push(song.href) 
    }
    }
    console.log("[\"" + songs.join("\",\"") + "\"]")
    }
  4. Copy console output.
  5. Go to community-driven-radio's console. Type in let songs =, Paste and execute.
  6. Execute the following code in the console:
    for(let song of songs) {
    socket.emit("new_song", getIdFromYoutubeUrl(song))
    }
  7. Have a nice day!

Of course, we could incapsulate the methods, socket connection, even provide a captcha for the input, however I believe burst limit will be the best way to handle this. Limit by IP sounds even better if we can differentiate between remote/local IPs in Node.