A
A
Alexey2019-06-09 12:55:29
Parsing
Alexey, 2019-06-09 12:55:29

Xpath. How to parse specific text?

The page contains the following code:

...
<div class="item">
  <a name="111" id="111">
  <div class="header">
    <h2 class="">Заголовок</h2>
    <div class="news-author"> Автор новости</div>
  </div>
  <div class="newsbody"
    <div class="news-text">Текст новости</div>
  </div>
</div>
...

And there are many such blocks on the page of each category. How to correctly compose an XPath to pull out new-author from a block with a specific id value in the a tag?
I use Google Sheets for data collection. I collect headlines, dates are all right.
Plugging in the collection of the news itself. They go in a row and belong to different categories. And when I try to collect the author:
=IMPORTXML(СЦЕПИТЬ("https://domain.tdl";IMPORTXML("https://domain.tdl/categories/"; "//div[@class='news-read-more']/a/@href")); "//div[@class='news-author']")

It collects authors from the first news category. Well, the texts, respectively.
Help pliz)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question