I am trying to get the links from a webpage and I have succeeded to get the href of the image next to the needed links but when trying to use next_sibling, I got None ..
Here's my try
import requests
from bs4 import BeautifulSoup
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36'}
response = requests.get('http://index-of.es/Python/', headers=headers)
soup = BeautifulSoup(response.text, 'lxml')
#print(soup.select('a img'))
for item in soup.select("a img"):
print(item.next_sibling)
The code works if I used print(item) but when trying to catch the next sibling, it doesn't work for me
Any ideas.