0
from bs4 import BeautifulSoup
import requests
import time
headers = requests.utils.default_headers()
headers.update({'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0'})
data = requests.get('http://br.investing.com/economic-calendar/', headers=headers)
resultados = []
if data.status_code == requests.codes.ok:
info = BeautifulSoup(data.text, 'html.parser')
blocos = ((info.find('table', {'id': 'economicCalendarData'})).find('tbody')).findAll('tr', {'class': 'js-event-item'})
time.sleep(3)
for blocos2 in blocos:
impacto = str((blocos2.find('td', {'class': 'sentiment'})).get('data-img_key')).replace('bull','')
horario = str(blocos2.get('data-event-datetime')).replace('/', '-')
moeda = (blocos2.find('td', {'class': 'left flagCur noWrap'})).text.strip()
resultados.append({'par': moeda, 'horario': horario, 'impacto': impacto})
for info in resultados:
print('PARIDADE:',info['par'],'\nHORARIO:',info['horario'],'\nIMPACTO:',info['impacto'],'\n--------\n')
APPEARS LIKE THIS:
PARIDADE: GBP
HORARIO: 2021-03-24 04:00:00
IMPACTO: 1
--------
PARIDADE: GBP
HORARIO: 2021-03-24 04:00:00
IMPACTO: 1
--------
PARIDADE: GBP
HORARIO: 2021-03-24 04:00:00
IMPACTO: 1
--------
I wish that instead of showing number shows ('')
Sorry, it’s so simple I can’t even write a reply. Keep your code running https://replit.com/@Ronaldovasques/scraping
– Augusto Vasques
Ours just because you are an expert can not help a person with little knowledge ? misericordia
– progamaxskynet
Opa Good evening my personal friend my most sincere apologies for the fact that I have been arrogant unfortunately I am new to this site thanks a lot of mediato I could not identify your help sorry it is because I am with a top-of-the-line bot I am fixing the code and not with you I’m with 4 error that you broke my branch
– progamaxskynet
sorry really thank you again if it was possible I would like to talk to Voce in private to see if I helped in this bot he and top my uproar is why I’m already almost 3 weeks walking in this code :'(
– progamaxskynet
Hello progamaxskynet. The problem has nothing to do with this whole code, it only has to do with converting number into , which could have been fully summarized in the question, it’s important you [Edit] and add a [mcve] of the problem, with a step by step of what has already done and explain in a simplified, clear and objective way. To better enjoy the site, understand and avoid closures is worth reading the Stack Overflow Survival Guide in English. Thank you for understanding.
– Guilherme Nascimento
@Augusto Vasques_ NOT EVEN TO SEND YOU MESSAGES
– progamaxskynet