spencerwooo / substats

( `д′) how many followers do i have? how many!
https://substats.swo.moe
MIT License
813 stars 56 forks source link

Cloudflare Workaround Worker tutorial needed. #32

Closed amirsaam closed 2 years ago

spencerwooo commented 2 years ago

can you elaborate?

amirsaam commented 2 years ago

as {"status":200,"data":{"totalSubs":0,"subsInEachSource":{"instagram":0},"failedSources":{"instagram":"Sorry, Substats has been limited by the Instagram API, please try and host Substats on your own Cloudflare Workers account as a workaround."}}} btw SubStats returns zero for Telegram and Steam Friends too, it worked before but not now.

spencerwooo commented 2 years ago

Both routes are working in the latest version btw, check README, I changed a lot of stuff since earlier this year.

spencerwooo commented 2 years ago

At least Instagram and Steam Friends should be working, Telegram has always worked for my channel :)

amirsaam commented 2 years ago

ah, I didn't saw the update you merged until a few hours later of my comment. btw as I tried to make it work for https://gist.github.com/spencerwooo/7955aefc4ffa5bc8ae7c83d85d05e7a4 (TermiWidget) but a lot need to change on that widget that I don't have enough knowledge on it to do it.

async function fetchData() {
  const apiurl = `https://api.swo.moe/stats`
  const url = `${apiurl}/instagram/${instagram}`
  const request = new Request(url)
  const res = await request.loadJSON()
  return res.data.count
}

this returns correct data for the request but I don't know how to implement it for the whole widget. your function fetchData() there has a "data" variable that no longer works with the new changes because you cannot request all datas at once with new api and needs seperate requests.

spencerwooo commented 2 years ago

yes, the current version does not support requesting a list of sources, as it is blocked by an upstream dependency (check README), i will try to get feature parity with the original 1.0 asap after the upstream is resolved.

amirsaam commented 2 years ago

I updated your TermiWidget iOS btw for SubStats v2 https://github.com/amirsaam/SubCounter-for-Scriptable