0

I'm trying to extract the whole following Warcraftlog table in a Google Sheets. I just need the "names" with "count" and the "percentage numbers".

=IMPORTXML("URL"; "XPATH")
=IMPORTXML("https://classic.warcraftlogs.com/reports/P4CQdFTp21wADfKX/#boss=-3&difficulty=0&type=auras&ability=31035"; "//table[contains(@id,'main-table-0')]")

But it doesn't work with //table[contains(@id,'main-table-0')] in the Xpath. With //table/tr/td it will extract nearly everything on the warcraftlog website, except the table I want to extract.

Is there another option to extract them with XPath?

Tony
  • 3
  • 1

2 Answers2

0
  1. You are after an html table so switch to IMPORTHTML
  2. Data is pulled dynamically from another endpoint you can find in the network tab of the browser, so make your request to that
  3. The last two webpage visible table columns are $ delimited in the retrieved table so you will need to split the entries e.g. using helper column in column D of sheet (if formula in A1) containing SPLIT

=IMPORTHTML("https://classic.warcraftlogs.com/reports/auras/P4CQdFTp21wADfKX/0/0/6175385/buffs/31035/0/0/0/0/source/0/-3.0.0/0/Any/Any/0", "table",1)

enter image description here

QHarr
  • 80,579
  • 10
  • 51
  • 94
  • Hi, can you explain me how you generate the new url? With other Combatlogs for example https://classic.warcraftlogs.com/reports/94VJZrLHQj7YmwqT/#boss=-3&difficulty=0&type=auras&ability=31035 it doesn't work, because the numbers doesn't match anymore. – Tony Feb 15 '22 at 06:37
  • https://classic.warcraftlogs.com/reports/auras/94VJZrLHQj7YmwqT/0/0/9256615/buffs/31035/0/0/0/0/source/0/-3.0.0/0/Any/Any/0. The variable bit is the 9256615 which is the endTime. According to one of the js files endTime is `The end time of the fight. This is an offset relative to the start of the report, not an absolute time. * This offset is in milliseconds.` So, you most likely can calculate it. However, as the url construct is the same but just with this number changing and the id P4CQdFTp21wADfKX which is in original url, you can filter web traffic for url using filter on `buffs/31035/` – QHarr Feb 15 '22 at 21:34
  • The end time desc I found in https://assets.rpglogs.com/js/app.a7aa2a851a3295afd2c0.js – QHarr Feb 15 '22 at 21:35
0

Nice it works! You're a legend!
But how did you know how to change the URL?

The first is my original URL and the second one is yours. You deleted completely the auras and ability string. I have no idea why it still works! ^^

https://classic.warcraftlogs.com/reports/P4CQdFTp21wADfKX/#boss=-3&difficulty=0&type=auras&ability=31035

https://classic.warcraftlogs.com/reports/auras/P4CQdFTp21wADfKX/0/0/6175385/buffs/31035/0/0/0/0/source/0/-3.0.0/0/Any/Any/0

How did you know how to change it? I couldn't find on google how to change an URL like that!

Tony
  • 3
  • 1
  • This should be added as a comment on the correct answer. As it is here, it appears as a new answer without context. – Tres' Bailey Feb 08 '22 at 18:09