B
B
Brutus12020-07-27 13:06:04
Python
Brutus1, 2020-07-27 13:06:04

How to parse individual links from a class?

how from this

[<div class="dots-item"><a href="/index.php?r=crop/harvest&amp;id=14120123"><img alt="Z" height="50" src="https://static.ru/light/crops/gas_station.png" width="50"/></a><a href="/index.php?r=crop/harvest&amp;id=14120123"><img alt="Harvest" class="crop_ico" src="https://static.ru/i/../light/dots/st/dot-st-ready.png"/></a></div>, <div class="dots-item"><a href="/index.php?r=crop/harvest&amp;id=14120124"><img alt="Z" height="50" src="https://static.ru/light/crops/gas_station.png" width="50"/></a><a href="/index.php?r=crop/harvest&amp;id=14120124"><img alt="Harvest" class="crop_ico" src="https://static.ru/i/../light/dots/st/dot-st-ready.png"/></a></div>, <div class="dots-item"><a class="" href="/index.php?r=crop/list&amp;id=14120125&amp;page=0"><img alt="" src="https://static.ru/light/dots/dot-plus.png"/></a><img alt="" src="https://static.ru/i/../light/dots/st/dot-st-none.png"/></div>, <div class="dots-item"><a class="" href="/index.php?r=crop/list&amp;id=14120126&amp;page=0"><img alt="" src="https://static.ru/light/dots/dot-plus.png"/></a><img alt="" src="https://static.ru/i/../light/dots/st/dot-st-none.png"/></div>]


pull only the first href
for example

actual_dot_url = '/index.php?r=crop/harvest&amp;id=14120123'

or
actual_dot_url = '/index.php?r=crop/list&amp;id=14120125&amp;page=0'


and how from this:

<div class="dots-item"><a href="/index.php?r=crop/harvest&amp;id=14120123"><img alt="Z" height="50" src="https://static.ru/light/crops/gas_station.png" width="50"/></a><a href="/index.php?r=crop/harvest&amp;id=14120123"><img alt="Harvest" class="crop_ico" src="https://static.ru/i/../light/dots/st/dot-st-ready.png"/></a></div>


get it

url_harvest = '/index.php?r=crop/harvest&amp;id=14120123'

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