Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

156
Visualizações
local queue on YouTube

This might be a little bit of a weird question but I'm trying to make an extension that updates the youtube queue when you add a video from another window. I was thinking of just remaking the queue for youtube (I know that this would be a large task). How would I manually add a video to this queue?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

There are two main problems that need to be solved to add a this feature.

  1. Storing and synchronizing the queue.
  2. Knowing when a user adds or removes a video in the queue.

Both Firefox and chrome provide extension storage for this purpose and this should solve the first problem.
https://developer.chrome.com/docs/extensions/reference/storage/
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage

For the second problem you need to write a content script that will either add your own button to YouTube or override the original add to watch queue button functionality. So that when clicked the url of the video will be added to extension storage.

You could then display the queue in the extension popup and when a video is played a message can be sent to the active window changing the location to the new video like so.

// popup.js
chrome.storage.sync.get(['queue'], (result) => {
    const firstInQueue = result.queue.shift();
    chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
        chrome.tabs.sendMessage(tabs[0].id, {video: firstInQueue}, function(response) {
           chrome.storage.sync.set({queue: result.queue}, () => {
              console.log(`${result.queue.length} videos in queue`);
           });
        });
    });
});


// content.js
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
    document.location.href = request.video;
});

Overriding functionality on an existing site can be difficult and short-lived as if YouTube chooses to update its UI it may break you feature.

Looking at the network tab when adding a video to the queue reveals that a post request is made to https://www.youtube.com/youtubei/v1/playlist/create this may be another area to look.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda