Advertisement
vinissh

Untitled

Nov 23rd, 2019
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. from bs4 import BeautifulSoup
  2. import requests
  3. import html5lib
  4. import wget
  5.  
  6. pesquisaProduto = str('naruto')
  7. requestMercadoLivre = requests.get('https://lista.mercadolivre.com.br/' + pesquisaProduto)
  8.  
  9.  
  10. with open('localizado.html','w',encoding='utf-8') as file:
  11. file.write(requestMercadoLivre.text)
  12.  
  13.  
  14.  
  15. with open('localizado.html','r',encoding='utf-8') as f:
  16. soup = BeautifulSoup(f.read(),'html5lib')
  17. foto = soup.find('img',class_='lazy-load')['src']
  18. #print(soup.find(class_='figure item-image item__js-link')['href'])
  19. wget.download(foto)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement