More robust ID parser
							parent
							
								
									a5e036d6fd
								
							
						
					
					
						commit
						14c4cce88e
					
				| 
						 | 
					@ -375,13 +375,12 @@ function isMod(prefix) {
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
function extractIDFromURL(url) {
 | 
					function extractIDFromURL(url) {
 | 
				
			||||||
    // URL are in the format https://f95zone.to/threads/GAMENAME-VERSION-DEVELOPER.ID/
 | 
					    // URL are in the format https://f95zone.to/threads/GAMENAME-VERSION-DEVELOPER.ID/
 | 
				
			||||||
    const splitted = url.split(".");
 | 
					    // or https://f95zone.to/threads/ID/
 | 
				
			||||||
 | 
					    const match = url.match(/(\.)?([0-9]+)(?!-)/);
 | 
				
			||||||
    // We took the last part (clean it)
 | 
					    if(!match) return -1;
 | 
				
			||||||
    const value = splitted.pop().replace("/", "").trim();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Parse and return number
 | 
					    // Parse and return number
 | 
				
			||||||
    return parseInt(value, 10);
 | 
					    return parseInt(match[0], 10);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue