You are not recognized as the original poster of this topic.
let table=document.querySelector("table[class^='wikitable']"),
tableHeader=[...table.querySelector("thead tr").children].map(c=>"colSpan"in c?Array(+c.colSpan).fill(c.innerText):c.innerText).flat(),
tableBody=table.querySelector("tbody");
console.log([...tableBody.children].map(e=>{
let c=[...e.children],a=[];
for(let i=0;i<c.length;i++){
if("colSpan"in c[i]){
for(let j=0;j<+c[i].colSpan;j++)a.push(c[i].innerText||null);
}else{
a.push(c[i].innerText||null);
}
}
let o={};
for(let i=0;i<a.length;i++){
if(tableHeader[i]in o){
if(typeof o[tableHeader[i]]==="string"){
o[tableHeader[i]]=[o[tableHeader[i]],a[i]];
}else{
o[tableHeader[i]].push(a[i]);
}
}else{
o[tableHeader[i]]=a[i];
}
}
return o;
}));return tableHeader.reduce((o,h,i)=>{
if(h in o)
if(typeof o[h]==="string")o[h]=[o[h],a[i]];else o[h].push(a[i]);
else o[h]=a[i];
return o;
},{});