-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Não esquecer dde terminar o webscraping !!
- Loading branch information
1 parent
f073aae
commit 2f4e581
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import requests | ||
from bs4 import BeautifulSoup | ||
|
||
url1 = requests.get('https://coinmarketcap.com/pt-br/currencies/bitcoin/') | ||
#print(url1.status_code) | ||
htmlBruto1 = url1.content | ||
|
||
site = BeautifulSoup(htmlBruto1, 'html.parser') | ||
tagPreco = site.find('div', attrs={'class':'priceValue smallerPrice'}) | ||
print(tagPreco) | ||
preco = tagPreco.find('span') | ||
|
||
print() | ||
print(preco.text) | ||
print() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import requests | ||
import schedule | ||
import time | ||
from bs4 import BeautifulSoup | ||
|
||
def job(): | ||
url1 = requests.get('https://coinmarketcap.com/pt-br/currencies/bitcoin/') | ||
#print(url1.status_code) | ||
|
||
htmlBruto1 = url1.content | ||
site = BeautifulSoup(htmlBruto1, 'html.parser') | ||
tagPreco = site.find('div', attrs={'class':'priceValue smallerPrice'}) | ||
#print(tagPreco) | ||
|
||
preco = tagPreco.find('span') | ||
lastPrice = " " | ||
|
||
while lastPrice != preco.text: | ||
lastPrice = preco.text | ||
with open ("precos.txt") as arquivo: | ||
arquivo.write(lastPrice) | ||
print(lastPrice) | ||
|
||
schedule.every(10).seconds.do(job) | ||
|
||
while True: | ||
schedule.run_pending() | ||
time.sleep(1) |