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 = ({
89
89
throw new Error ( `${ name } is missing skin ${ skinName } on Skins page, but has skin in Gallery.` ) ;
90
90
} ;
91
91
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
+
92
107
export async function fetchGallery (
93
108
name : string ,
94
109
url : string
@@ -135,9 +150,9 @@ export async function fetchGallery(
135
150
let value : any = row . getElementsByTagName ( "td" ) [ 0 ] . textContent . trim ( ) ;
136
151
137
152
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 ] ) {
141
156
// Because skins have different names on different clients,
142
157
// each skin's Gallery page has a row for their localized name.
143
158
// Next to that is the availability in that client.
You can’t perform that action at this time.
0 commit comments