A
A
AntVlad2020-11-24 20:54:19
Python
AntVlad, 2020-11-24 20:54:19

I am making a page parser (Python + selenium + beautiful soup). How to check references for occurrence of substring?

Of the many links on the page, I only need to find 6 links and follow them. The link text contains one keyword each, but the ending changes periodically in the url - the date is added. Therefore, I cannot declare a variable with urls. Tell me how to search for tags by text content and get from the found ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2020-11-24
@AntVlad

So, where are you looking for, in BS4 or selenium?
Regular expressions can be used in BS4

import re
soup.find('a', string=re.compile('содержимому'))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question