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

180
Visualizações
Extracting a specific variable in a script tag on a webpage with multiple script tags with Javascript

I'm trying to build a simple javascript web scrapping project which extracts headlines from some news website.

the page I'm trying to scrape:

https://www.chinatimes.com/?chdtv

It has over 30 script tags

The variable I wanted to access is data on line 1610 in view-source mode(as shown below), which contains all the headline titles and URLs(unfortunately, they are available only here)

<script type="c04ba886ffa04b8e214f17e6-text/javascript">
        //速報
        $(document).ready(function () {
            $(".breaking-news").verticalMarquee({
                "onContentHeightChanged": function (baseDiv, contentHeight) {
                    var $self = $(baseDiv),
                        contentPadding = 12;
                    $self.height(contentHeight + contentPadding);
                }
            });
        });
        //焦點大圖
         $(document).ready(function () {
            var photoUrl;
var data = [...];
...
</script>

I tried targeting the script tag with puppeteer using $eval + css attribute selector, but the value of type for each scripts are dynamic(constantly changing)

Any solutions, opinions, keywords to google for will be deeply appreciated

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