File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,21 @@ const handleSkinCategory = ({
8989 throw new Error ( `${ name } is missing skin ${ skinName } on Skins page, but has skin in Gallery.` ) ;
9090} ;
9191
92+ const ICON_URL_TAILS = {
93+ "Icon.png" : "icon" ,
94+ "ChibiIcon.png" : "chibi" ,
95+ "Banner.png" : "banner"
96+ } ;
97+
98+ function parseIcons ( td : Element ) {
99+ return Array . from ( td . querySelectorAll ( "img" ) ) . map ( r => {
100+ const url = galleryThumbnailUrlToActualUrl ( r . getAttribute ( "src" ) ) ;
101+ const urlType = Object . keys ( ICON_URL_TAILS ) . find ( pattern => url . endsWith ( pattern ) ) ?? "unknown"
102+ return { url, urlType}
103+ } ) ;
104+ }
105+
106+
92107export async function fetchGallery (
93108 name : string ,
94109 url : string
@@ -135,9 +150,9 @@ export async function fetchGallery(
135150 let value : any = row . getElementsByTagName ( "td" ) [ 0 ] . textContent . trim ( ) ;
136151
137152 if ( key === "live2dModel" ) value = value === "Yes" ;
138- if ( key === "cost" ) value = parseInt ( value ) ;
139-
140- if ( ClientSkinNameHeaders [ key ] ) {
153+ else if ( key === "cost" ) value = parseInt ( value ) ;
154+ else if ( key === "icons" ) value = parseIcons ( row . getElementsByTagName ( "td" ) ) ;
155+ else if ( ClientSkinNameHeaders [ key ] ) {
141156 // Because skins have different names on different clients,
142157 // each skin's Gallery page has a row for their localized name.
143158 // Next to that is the availability in that client.
You can’t perform that action at this time.
0 commit comments