Skip to content

Commit

Permalink
auto-name downloaded decorations
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsPi3141 committed Nov 20, 2024
1 parent 6fe54fa commit 9c7c9e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions utils/getAvatarDecorations.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@
"div[class^='categories_'] div[class^='shopCard'] div[class^='avatarContainer_'] svg:nth-child(2) div[class^='avatarStack_'] > img[class^='avatar_']",
)) {
e.push(
el
`${el
.getAttribute("src")
.replace(/size=\d{2,4}&passthrough=false/, "size=1024"),
.replace(
/size=\d{2,4}&passthrough=false/,
"size=1024",
)}&name=${el.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode
.querySelector("div[class*='cardText_'] div[class*='productName_']")
.innerText.toLowerCase()
.replaceAll("'", "")
.replaceAll(/[^A-Za-z0-9]/g, "_")}.png`,
);
}
console.log(e.join("\n"));
Expand Down
2 changes: 1 addition & 1 deletion utils/massdownload/script.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if (Test-Path -Path ".\output\") {
}
mkdir .\output\
foreach ($url in Get-Content .\urls.txt) {
$name = $url -replace "\w+:\/\/(\w+\.?)+\/avatar-decoration-presets\/", ".\output\" -replace "\?(\w+=\w+&?)*", ""
$name = $url -replace ".+&name=", ".\output\"
Write-Output $name
Invoke-WebRequest $url -OutFile $name
}
Expand Down

0 comments on commit 9c7c9e6

Please sign in to comment.