add new CWS user parsing method

This commit is contained in:
Michael C
2023-02-20 22:21:53 -05:00
parent 72fb4eb6ec
commit 1bda331b0c
3 changed files with 58 additions and 32 deletions

13
src/utils/getCWSUsers.ts Normal file
View File

@@ -0,0 +1,13 @@
import axios from "axios";
import { Logger } from "../utils/logger";
export const getCWSUsers = (extID: string) =>
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(/,|\+/,""))
.then((data) => parseInt(data))
.catch((err) => {
Logger.error(`Error getting chrome users - ${err}`);
return undefined;
});