vinissh

freeMarketResearch

Oct 10th, 2019
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. import requests
  2. from bs4 import BeautifulSoup
  3.  
  4. try:
  5.     pesquisaProduto = str(input('Oque deseja pesquisar ?:'))
  6.     requestMercadoLivre = requests.get('https://lista.mercadolivre.com.br/' + pesquisaProduto)
  7.     responseMercadoLivre = BeautifulSoup(requestMercadoLivre.text,'html.parser')
  8.     valoresProdutos = responseMercadoLivre.find_all(class_='price__fraction')
  9.     nomeProdutos  = responseMercadoLivre.find_all(class_='main-title')
  10.     for nprodutos in nomeProdutos:
  11.         format_nomes = str(nprodutos.text.strip())
  12.         for valores in valoresProdutos:
  13.             format_valores = str(valores.text.strip())
  14.             print(format_nomes)
  15.             print("R$:" + format_valores)
  16. except KeyboardInterrupt:
  17.     print('Consulta interrompida')
Add Comment
Please, Sign In to add comment