Aug-06-2019, 10:58 AM
Something like this,
A general way to split as shown,may need to adjust some to get what you want as not all advertisement text are the same.
id="ann-20047560"
is changes all time on this site.A general way to split as shown,may need to adjust some to get what you want as not all advertisement text are the same.
import requests from bs4 import BeautifulSoup url = 'https://www.ouedkniss.com/telephones' response = requests.get(url) soup = BeautifulSoup(response.content, 'lxml') id_find = soup.find('div', id="ann-20047560") text_tag = soup.find('span', class_="annonce_get_description", itemprop="description") print(text_tag.text) # split print('-' * 20) tag_spilt = text_tag.text.split('<br/>') lst = tag_spilt[0].split('\r\n') print(lst)