This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
import logging as log | |
log.basicConfig(level=log.DEBUG) | |
class FollowerExtractor(): | |
""" | |
Extracts followers for a given profile | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import os | |
from bs4 import BeautifulSoup | |
def requisitar_site(siteUrl): | |
conteudoSite = requests.get(siteUrl).content | |
analisar_requisicao(conteudoSite) | |
def analisar_requisicao(conteudoRequisicao): | |
objBs4 = BeautifulSoup(conteudoRequisicao, "html.parser") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def analisar_requisicao(conteudoRequisicao): | |
objBs4 = BeautifulSoup(conteudoRequisicao, "html.parser") | |
marcas = objBs4.find_all('div', {'class': 'product-box-brand'}) | |
nomes = objBs4.select('div.catalog-content p.product-box-title') | |
links = objBs4.find_all('a', { | |
'class': 'product-box-link is-lazyloaded image product-image-rotate' | |
}) | |
precos = objBs4.find_all('span', {'class': 'product-box-price-from'}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def armazenar_dados(dadosObtidos): | |
arquivo = open('roupas.csv', 'a+', encoding='utf-8') | |
arquivo.write(dadosObtidos) | |
arquivo.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def analisar_requisicao(conteudoRequisicao): | |
objBs4 = BeautifulSoup(conteudoRequisicao, "html.parser") | |
marcas = objBs4.find_all('div', {'class': 'product-box-brand'}) | |
nomes = objBs4.select('div.catalog-content p.product-box-title') | |
links = objBs4.find_all('a', { | |
'class': 'product-box-link is-lazyloaded image product-image-rotate' | |
}) | |
precos = objBs4.find_all('span', {'class': 'product-box-price-from'}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def tratamento_dados(dadoObtido, tipoString): | |
if tipoString == 'Preco': | |
return str(dadoObtido).replace('R$','').strip() | |
else: | |
return str(dadoObtido).replace(';',',').strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def analisar_requisicao(conteudoRequisicao): | |
objBs4 = BeautifulSoup(conteudoRequisicao, "html.parser") | |
marcas = objBs4.find_all('div', {'class': 'product-box-brand'}) | |
nomes = objBs4.select('div.catalog-content p.product-box-title') | |
links = objBs4.find_all('a', { | |
'class': 'product-box-link is-lazyloaded image product-image-rotate' | |
}) | |
precos = objBs4.find_all('span', {'class': 'product-box-price-from'}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
analisar_requisicao(conteudoRequisicao): | |
objetoBs4 = BeautifulSoup(conteudoRequisicao, 'html.parser') | |
marcas = objBs4.find_all('div', {'class': 'product-box-brand'}) | |
nomes = objBs4.select('div.catalog-content p.product-box-title') | |
links = objBs4.find_all('a', { | |
'class': 'product-box-link is-lazyloaded image product-image-rotate' | |
}) | |
precos = objBs4.find_all('span', {'class': 'product-box-price-from'}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
analisar_requisicao(conteudoRequisicao): | |
objetoBs4 = BeautifulSoup(conteudoRequisicao, 'html.parser') | |
marcas = objBs4.find_all('div', {'class': 'product-box-brand'}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def requisitar_site(siteUrl): | |
conteudoSite = requests.get(siteUrl).content | |
analisar_requisicao(conteudoSite) |
NewerOlder