A
A
activebomb2019-08-30 14:57:38
HTML
activebomb, 2019-08-30 14:57:38

How to extract only text from css element?

Text "Karambit - 5.00
Raise your account ratingfff."
I need to collect, without a link, via xpath( //div|br ) it works like this - Karambit - 5.00 https://ali.ski/-5dDY0Raise your account ratingfff.
how to choose the right xpath request so that only the text is taken? (
https://vk.com/aliexpressvramkaxzakona52 - link with the page code.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anatoly, 2019-08-30
@trofimovdev

Firstly, it's completely unnecessary to bother with xpath when VKontakte has an API that allows you to parse a wall.
Secondly, the link is easily cut off by a regular expression by type

^(https?:\/\/)?([\w\.]+)\.([a-z]{2,6}\.?)(\/[\w\.]*)*\/?$

E
Eugene Chefranov, 2019-08-30
@Chefranov

<div id="mydiv">
some text <a href="#">super link</a> la la la
</div>

xPath will be like this
string(//div[@id="mydiv"])

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question