M
M
Mark Adams2016-12-16 20:31:01
Python
Mark Adams, 2016-12-16 20:31:01

How to extract a link in Grab by the text of the link in the response?

There is a response body. How to extract the desired link from the answer, knowing the text of the link?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mark Adams, 2016-12-16
@ilyakmet

g.doc.select('//a[contains(text(), "yourtexthere")]').attr('href')

I
Ilya, 2016-12-16
@glebovgin

In grab, it seems possible to feed xpath, so here's an example:
Try it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question