mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-24 16:38:41 +03:00
clean up getCWSUsers
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import axios from "axios";
|
||||
import { Logger } from "../utils/logger";
|
||||
|
||||
export const getCWSUsers = (extID: string) =>
|
||||
export const getCWSUsers = (extID: string): Promise<number | undefined> =>
|
||||
axios.post(`https://chrome.google.com/webstore/ajax/detail?pv=20210820&id=${extID}`)
|
||||
.then((res) => res.data.split("\n")[2])
|
||||
.then((data) => JSON.parse(data))
|
||||
.then((data) => (data[1][1][0][23]).replaceAll(/,|\+/g,""))
|
||||
.then((data) => parseInt(data))
|
||||
.then(res => res.data.split("\n")[2])
|
||||
.then(data => JSON.parse(data))
|
||||
.then(data => (data[1][1][0][23]).replaceAll(/,|\+/g,""))
|
||||
.then(data => parseInt(data))
|
||||
.catch((err) => {
|
||||
Logger.error(`Error getting chrome users - ${err}`);
|
||||
return undefined;
|
||||
return 0;
|
||||
});
|
||||
Reference in New Issue
Block a user