Skip to content

Commit

Permalink
resolve tiktokabos (#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
ksibisamir committed May 18, 2023
2 parents 1efe8a4 + 5967a6f commit f253957
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions manager/oracles.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,25 +476,18 @@ exports.tiktokAbos = async (userId, access_token = null) => {

try {

/*const runCmd = cmd => {
const runCmd = cmd => {
let resp = child_process.execSync(cmd)
return resp.toString('UTF8')
}
var cmd = `curl -L -X GET 'https://open.tiktokapis.com/v2/user/info/?fields=follower_count' \
-H 'Authorization: Bearer ${accessToken}'`
var result = JSON.parse(runCmd(cmd))*/
var result = JSON.parse(runCmd(cmd))

const result = await axios.get('https://open.tiktokapis.com/v2/user/info', {
params: {
fields: 'follower_count',
},
headers: {
Authorization: `Bearer ${accessToken}`,
},
});



return result?.data?.data?.user?.follower_count ?? 0
return result?.data?.user?.follower_count ?? 0
} catch (err) {
console.error('tiktokAbos', err.message ? err.message : err.error)
}
Expand Down

0 comments on commit f253957

Please sign in to comment.