import bs4, requests url = "https://lordchannel.com/" def getLC(url): res = requests.get(url) res.raise_for_status() soup = bs4.BeautifulSoup(res.text,"html.parser") elementi = soup.select('#post-123 > div > div > div.fl-row.fl-row-fixed-width.fl-row-bg-photo.fl-node-5bab8763f0554.fl-row-bg-overlay > div > div > div > div > div > div > div > div > div > ul') elems = soup.select('#post-123 > div > div > div.fl-row.fl-row-fixed-width.fl-row-bg-photo.fl-node-5bab8763f0554.fl-row-bg-overlay > div > div > div > div > div > div > div > div > div > ul > li:nth-child(6) > a') links_with_text = [] for a in soup.find_all('a', href=True): if a.text: links_with_text.append(a['href']) return elems[0].text.strip(),elementi[0].text.strip() elemento,articoli = getLC(url) print(f"{articoli}") # print(f"{elemento}")