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

205
Visualizações
Is there a way to jump back and forth from python and JS?

I'm trying to create a chrome extension which are made in JS, however I built the main part of the code in python because it is the language I know, and I'm not sure if what I'm trying to do is even possible in JS. Is there a way to take in a variable I get from JS, use it to run a python function, and then continue with the JS code?

chrome.browserAction.onClicked.addListener(function(activeTab){ 
  chrome.tabs.getSelected(null, function(tab) {
var tabId = tab.id;
tabUrl = tab.url;
id = tabUrl.split("=")[1];
//call python func here
});
  var newURL = "frame.html";
  chrome.tabs.create({ url: newURL});

});

from youtube_transcript_api import YouTubeTranscriptApi
import webbrowser

def func(id):
    html_file = open('frame.html','w')
    list = YouTubeTranscriptApi.get_transcript(id)
    webbrowser.get('C:/Program Files/Google/Chrome/Application/chrome.exe %s')

    data = '<html>\n<head>\n<link rel="stylesheet" href="styles.css">\n</head>\n<body>\n<p>\n' 
    for i in list:
        data += i.get('text') + ' '

    data += '</p>\n</body>\n</html>'
    html_file.write(data)
    html_file.close()

#func(id from java)
about 4 years ago · Juan Pablo Isaza
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