I need to extract the data of this HTML in Python, I report only a part of the HTML but like this in the same file I have 100 (products) so I need to make a find_all
but it doesn't work. Here is the code I created in Python that work perfectly but only for 1 product, I want for all product:
Python code:
# importing the libraries
from bs4 import BeautifulSoup
import requests
url="http://www.disotech.it/images/espo.html"
# Make a GET request to fetch the raw HTML content
html_content = requests.get(url).text
# Parse the html content
soup = BeautifulSoup(html_content, "lxml")
print(soup.prettify()) # print the parsed data of html
soup.findAll('tr')
disp = soup.find('div',attrs={'class':'onstock'}).text
print (disp)
articoloin = soup.find('div',attrs={'class':'article_number'}).text
print (articoloin)
nomearticolo = soup.find('span',attrs={'class':'article_results_vg_name'}).text
print (nomearticolo)
prezzonetto = soup.find('span',attrs={'class':'nettoprice'}).text
print (prezzonetto)
produttore = soup.find('span',attrs={'class':'article_results_manufacturer_name'}).text
print (produttore)
prezzopub = soup.find('span',attrs={'class':'bruttoprice'}).text
print (prezzopub)
disp = soup.find('span',attrs={'class':'stockQuantity'}).text
print (disp)
<tr class="replacementFLUKDST" style="background:#fff" id="fromarticleidFLUKDST">
<td class="article_results_picture_td" colspan="2" rowspan="3" style="width:145px;height:200px;text-align:center;vertical-align:top;">
<br><div id="pictureplaceholderFLUKDST" style="background:#fff; url('../pics/eshop/wait_fr.gif') 50% 50% no-repeat; border:1px solid #ffffff;">
<a onclick="AbortArticleModelAjax();" href="javascript:Fe=window.open('include/picture_V2.php?picture=FLUKDST&checksum=27cda62b2155e3a2c56963b5622bd46d&nsearch=1','Picture','top=0,width=800,height=600,resizable=1,scrollbars=1');Fe.focus();">
<img alt="#FLUKDST" id="thumbnailpictureFLUKDST" src="https://download.aswo.com/apics120/70/a7/70a71e4d8b56a79170f499d23a103356.jpg"></a>
<br style="line-height:10%;"><a onclick="AbortArticleModelAjax();" style="font-size:10px;color:#aaa;" href="javascript:Fe=window.open('include/picture_V2.php?picture=FLUKDST&checksum=27cda62b2155e3a2c56963b5622bd46d&nsearch=1','Picture','top=0,width=800,height=600,resizable=1,scrollbars=1');Fe.focus();">Altre foto (9)</a>
</div></td>
<td style="display:table-cell;vertical-align:top;" rowspan="3"><span class="replacment_article">
<a onclick="AbortArticleModelAjax();" href="/showArticleDetails/?articleNo=FLUKDST&fromprofile=nsearch&source5=388346306&replacement=1&articleref=fb8583334265cd761d2accc1ef0b2f12#replacement" title="Alternativa disponbile"><img class="replacementicon" src="../pics/eshop/templates/nSearch/icon_baugleichgeraete.gif" alt="Mostra i ricambi"></a>
</span><br><a onclick="AbortArticleModelAjax();" href="javascript:showSuchbegriffListe('FLUKDST', '');" title="Feedback su test-shop di questo articolo" id="AddArticleInfoLinkFLUKDST">
<img src="../pics/eshop/templates/nSearch/add.png" title="Feedback su test-shop: inserire termine di ricerca (Tags) su questo articolo" alt="Feedback su : inserire termine di ricerca (Tags) su questo articolo"></a></td>
<td id="descriptioncellFLUKDST" class="article_results_description_td" style="text-align:left;border-bottom:0px;height:70px;vertical-align:top;">
<span class="article_description_onstock">
<a href="/showArticleDetails/?articleNo=FLUKDST&fromprofile=nsearch&source5=388346306&articleref=fb8583334265cd761d2accc1ef0b2f12" target="_self" class="articledetailsbacklink" data-ref="FLUKDST" onclick="AbortArticleModelAjax();" title="Dettagli articolo">TESTER FLUKE</a></span><div style="padding-top:3px;">
<div class="article_number" style="float:left;display:inline-block;width:75px">#FLUKDST</div>
<div style="margin-left:80px;">
<div class="onstock">Disponibile</div></div>
<span style="height:1px;width:1px;line-height:0.1;clear:both;"></span>
<br><span class="article_results_vg_name">TESTER 200V 4A</span>
</div></td>
<td style="display:table-cell;vertical-align:top;text-align:left">FL-001<br>
<span style="color:#081b6a;white-space:nowrap;"><span class="article_results_manufacturer_name">FLUKEPRODUTTORE</span></span>
</td>
<td style="display:table-cell;vertical-align:top;text-align:right;" class="article_results_price_td" id="pricecellFLUKDST">
<div id="pricecellplaceholderFLUKDST"><span class="nettoprice" title="Lordo € 21,67">€ 17,76</span>
<br><span class="bruttoprice" title="Prezzo al pubblico consigliato IVA incl." style="font-size: 95%;color: #909090;">€ 26,01</span>
</div></td>
<td style="display:table-cell;vertical-align:top;text-align:right;padding-right:15px;"><a title="in magazzino">
<img src="../pics/eshop/templates/nSearch/greenhook.png" alt="in magazzino"></a><br><span class="stockQuantity">16</span></td>
<td style="border-right:1px solid #ccc;display:table-cell;vertical-align:top;width:160px;">
<input type="number" min="0" data-ref="FLUKDST" id="ID_quantity-FLUKDST" name="quantitiy-FLUKDST" value="" size="5" data-arttype="" data-resultpos="1" style="width:55px;border:1px solid #BACDE3" placeholder="Quantità" tabindex="01" onkeypress="if(event.keyCode==13){ autoSubmitBasket('FLUKDST', false); return false;}" class="amountvalues"><br><input type="text" size="14" class="orderrefs" name="ordertext-FLUKDST" value="" maxlength="30" style="border:1px solid #BACDE3;margin-top:2px;" placeholder="Testo articolo" tabindex="02" onkeypress="if(event.keyCode==13){ autoSubmitBasket('FLUKDST', false); return false;}"><br><br><a href="javascript:void(0);" onkeypress="if(event.keyCode==13){ autoSubmitBasket('FLUKDST', false); return false;}"><img style="cursor:pointer;" alt="Inserimento articolo nel carrello" src="../pics/eshop/templates/nSearch/button_basket.gif" title="Inserimento articolo nel carrello" onclick="AbortArticleModelAjax();autoSubmitBasket('FLUKDST', false); return false;" tabindex="03"></a> <a href="javascript:void(0);" onkeypress="if(event.keyCode==13){ autoSubmitWishlist2('FLUKDST',false); }"><img class="wishlisticon" style="cursor:pointer;" alt="Salva articolo nel blocco note personale" src="../pics/eshop/templates/nSearch/button_wishlist.gif" title="Salva articolo nel blocco note personale" onclick="AbortArticleModelAjax();autoSubmitWishlist2('FLUKDST',false);" tabindex="06"></a> <a href="javascript:void(0);" onkeypress="if(event.keyCode==13){ gotoASWOHelpdesk('FLUKDST','', 388346306);}">
<img class="helpdeskicon helpdesk4FLUKDST" style="cursor:pointer;" alt="Compila una richiesta articolo" src="../pics/eshop/templates/nSearch/question.gif" title="Compila una richiesta articolo" tabindex="07" onclick="AbortArticleModelAjax();gotoASWOHelpdesk('FLUKDST','', 388346306);"></a>
</td></tr>