Skip to content

Instantly share code, notes, and snippets.

@nathan130200
Created July 20, 2022 23:52
Show Gist options
  • Save nathan130200/4801f496f6fbf5ec5c6b5ca5b0f92bc3 to your computer and use it in GitHub Desktop.
Save nathan130200/4801f496f6fbf5ec5c6b5ca5b0f92bc3 to your computer and use it in GitHub Desktop.
Steam depot to XML
// Use browser devtools on an steam depot from https://steamdb.info/depot/:depot_id
// This will fetch all manifest + basic depot info from webpage and return as function value.
function SteamDepotToXML() {
var manifests = [];
for(let temp of document.querySelectorAll(`tr[data-branch]`).entries()) {
if(!temp.length && !temp[1]) continue;
let node = temp[1];
var el = node.querySelector('td:nth-child(3)');
manifests.push({
id: el.querySelector('a').innerText,
date: node.querySelector('td:nth-child(2)').dataset.time,
branch: node.dataset.branch
});
console.log(node.dataset.branch);
}
const depotName = document.querySelector('.muted').parentElement.innerText.substring(8);
const depotId = document.querySelector('.span3').parentElement.innerText.substring(9);
const depotDateTime = document.querySelector('i.muted > time').attributes['datetime'].value;
var arr = manifests.map(x => {
return `\t<manifest id="${x.id}" create_date_utc="${x.date}" branch="${x.branch}" />`
}).join("\n");
return `<depot id="${depotId}" name="${depotName}" seen_date_utc="${depotDateTime}">
${arr}
</depot>`;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment