Tengo un sitio y hay un cuadro de diálogo desde el que quiero obtener todos los enlaces a los que permite acceder.
Sabe que proviene de lo siguiente en el código fuente:
<div class="events_menu_tabs" data-id="main">
<ul>
<li class=""><a href="#event_type_1" data-type-id="1">Presidential</a></li>
<li class=""><a href="#event_type_3" data-type-id="3">Parliamentary</a></li>
<li class=""><a href="#event_type_4" data-type-id="4">Adjara SC</a></li>
<li class=""><a href="#event_type_5" data-type-id="5">Local</a></li>
<li class=""><a href="#event_type_2" data-type-id="2">Voters List</a></li>
</ul>
<div id="event_type_1">
<ul class="menu_list">
<li>
<ul class="menu_item clear">
<li class="official_data">
<a href="https://data.electionsportal.ge/en/event_type/1/event/38/shape/69898/shape_type/1?data_type=official" title="Official Data"><img alt="Menu_official" src="/assets/menu_official-12f92a8c3e721f6eec8f989691f70f7a.png" /></a>
</li>
<li class="event_name">
<span title="The results of the October 27, 2013 Presidential election. The President of Georgia is elected for a five year term.">
<a href="https://data.electionsportal.ge/en/event_type/1/event/38/shape/69898/shape_type/1?data_type=official">2013 Presidential</a>
</span>
</li>
</ul>
</li>
<li>
<ul class="menu_item clear">
<li class="official_data">
<a href="https://data.electionsportal.ge/en/event_type/1/event/2/shape/53148/shape_type/1?data_type=official" title="Official Data"><img alt="Menu_official" src="/assets/menu_official-12f92a8c3e721f6eec8f989691f70f7a.png" /></a>
</li>
<li class="event_name">
<span title="The results of the January 5, 2008 Presidential election. The President of Georgia is elected for a five year term. This election was a snap election.">
<a href="https://data.electionsportal.ge/en/event_type/1/event/2/shape/53148/shape_type/1?data_type=official">2008 Presidential</a>
</span>
</li>
</ul>
</li>
</ul>
</div>
<div id="event_type_3">
<ul class="menu_list">
<li>
<ul class="menu_item clear">
<li class="official_data">
<a href="https://data.electionsportal.ge/en/event_type/3/event/50/shape/89486/shape_type/1?data_type=official" title="Official Data"><img alt="Menu_official" src="/assets/menu_official-12f92a8c3e721f6eec8f989691f70f7a.png" /></a>
</li>
<li class="event_name">
<span title="The results of the October 30, 2016 ruoff election for 50 majoritarian districts of Parliament. Members of Parliament are elected for four year terms.">
<a href="https://data.electionsportal.ge/en/event_type/3/event/50/shape/89486/shape_type/1?data_type=official">2016 Parliamentary - Majoritarian Runoff</a>
</span>
</li>
</ul>
</li>
<li>
<ul class="menu_item clear">
<li class="official_data">
<a href="https://data.electionsportal.ge/en/event_type/3/event/49/shape/89486/shape_type/1?data_type=official" title="Official Data"><img alt="Menu_official" src="/assets/menu_official-12f92a8c3e721f6eec8f989691f70f7a.png" /></a>
</li>
<li class="event_name">
<span title="The results of the October 22, 2016 rerun election for 4 precincts in two majoritarian districts of Parliament. Members of Parliament are elected for four year terms.">
<a href="https://data.electionsportal.ge/en/event_type/3/event/49/shape/89486/shape_type/1?data_type=official">2016 Parliamentary - Majoritarian Rerun</a>
</span>
</li>
</ul>
</li>
<li>
<ul class="menu_item clear">
<li class="official_data">
<a href="https://data.electionsportal.ge/en/event_type/3/event/46/shape/89486/shape_type/1?data_type=official" title="Official Data"><img alt="Menu_official" src="/assets/menu_official-12f92a8c3e721f6eec8f989691f70f7a.png" /></a>
</li>
<li class="event_name">
<span title="The results of the October 8, 2016 election for majoritarian districts of Parliament. Members of Parliament are elected for four year terms.">
<a href="https://data.electionsportal.ge/en/event_type/3/event/46/shape/89486/shape_type/1?data_type=official">2016 Parliamentary - Majoritarian</a>
</span>
</li>
</ul>
</li>
...
Por lo momento hice :
import requests
import re
with requests.Session() as s:
webpage = 'https://data.electionsportal.ge/en#landing_menu'
main_page = s.get(webpage)
soup = BeautifulSoup(main_page.text, 'html.parser')
urls = re.findall(r'href=[\'"]?([^\'" >]+)', soup)
print(', '.join(urls))