hi i would like to get some data which is on below < del> or < ins> tags but i could not find any solution for it can anyone has idea about this scraping and is there any short way for getting those informations
this is my python code
import requests
import json
from bs4 import BeautifulSoup
header = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7'}
base_url = "https://www.n11.com/super-firsatlar"
r = requests.get(base_url,headers=header)
if r.status_code == 200:
soup = BeautifulSoup(r.text, 'html.parser')
books = soup.find_all('li',attrs={"class":"column"})
result=[]
for book in books:
title=book.find('h3').text
link=base_url +book.find('a')['href']
picture = base_url + book.find('img')['src']
price = soup.find('a',attrs={"class":"ins"})
single ={'title':title,'link':link,'picture':picture,'price':price}
result.append(single)
with open('book.json','w', encoding='utf-8') as f:
json.dump(result ,f,indent=4,ensure_ascii=False)
else:
print(r.status_code)
<div class="proDetail">
<a href="https://test.com"class="oldPrice" title="Premium">
<del>69,00 TL</del></a>
<a href="https://test.com"class="newPrice" title="Premium">
<ins>14,90</ins>
</a>
</div>
and this is my output
{
"title": "Premium",
"link": "https://test.com",
"picture": "https://pic.gif",
"price": null
},