1

Im looking for how i would get this format of data when web scraping: How would I instruct it to grab content that is marked in the source code as:

 <div hidden="">https://doi.org/10.1016/S0272-7757(21)00078-9</div>

I have a working web scraping application that takes data in this format, taking the class data and pushing it into an array:

$('.js-article-title', html).each(function () {
            const title = $(this).text()
            articles.push({
                title
            })

How would I take this code and help me find this hidden data on the page? Please help im a beginner.

  • 2
    You can use `div[hidden]` to select a `div` with `hidden` tag. – Idrizi.A Jun 23 '22 at 18:12
  • thanks so much @Enve, how would i work this into the code? would it just be as a replacement of the current quote? do I still need a period before it? – doingmybest Jun 23 '22 at 18:20
  • 2
    I would have to see the rest of the html to know that. If the hidden div you are trying to select is a child of `.js-article-title` then you can use `.js-article-title div[hidden]`. If you want to select every hidden div in the page, then just `div[hidden]` without the class will work – Idrizi.A Jun 23 '22 at 18:24
  • Youre the best thank you! that totally worked! – doingmybest Jun 23 '22 at 18:38

0 Answers0