简体   繁体   中英

Are those Tableau dashboards possible to scrape?

I'm trying to scrape data from some Tableau dashboards that I use in a daily basis in order to get a up to date data frame. However, some dashboards don't seem to appear as public Tableau ones. I've used the code below extract data from the public ones, such as "Consumo", based on the TableauScraper package ( https://github.com/bertrandmartel/tableau-scraping ), but would help me a lot if a could extract data form dashboards like "Geração".

    from tableauscraper import TableauScraper as TS

url = "https://public.tableau.com/shared/CW8T7MTMX?:display_count=n&:origin=viz_share_link"

ts = TS()
ts.loads(url)
workbook = ts.getWorkbook()

for t in workbook.worksheets:
    print(f"worksheet name : {t.name}") #show worksheet name
    print(t.data) #show dataframe for this worksheet

Is there any adaptation which can make it possible?

The dashboards: https://www.ccee.org.br/portal/faces/pages_publico/o-que-fazemos/infomercado?_afrLoop=393990020070066&_adf.ctrl-state=61nwief61_1#.%40%40%3F_afrLoop%3D393990020070066%26_adf.ctrl-state%3D61nwief61_5

The main tableau URL is https://public.tableau.com/views/ConsumodeenergianoSIN/AnlisedeconsumonoSIN

When you click on "Geraçao", it returns https://tableaupub.ccee.org.br/t/CCEE/views/PainelGerao/GeraonoSIN :

from tableauscraper import TableauScraper as TS

url = "https://tableaupub.ccee.org.br/t/CCEE/views/PainelGerao/GeraonoSIN"

ts = TS()
ts.loads(url)
workbook = ts.getWorkbook()

for t in workbook.worksheets:
    print(f"worksheet name : {t.name}") #show worksheet name
    print(t.data) #show dataframe for this worksheet

repl.it link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM