A
A
altertable2020-05-19 00:04:34
Python
altertable, 2020-05-19 00:04:34

How to parse href links???

Need only href links? how to implement it with

import requests
from bs4 import BeautifulSoup as BS

r = requests.get('https://www.site/news/')  
html = BS(r.content, 'html.parser')

for el in html.select('.anons-readmore'):
                url_more = el.select('a')
                print(url_more)


5ec2f7eb88a74477192375.png
5ec2f7e07409d352403783.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Karbivnichy, 2020-05-19
@vityareabko

for el in html.select('.anons-readmore'):
                url_more = el.select_one('a').get('href')
                print(url_more)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question