Skip to content

Commit

Permalink
update at schema
Browse files Browse the repository at this point in the history
  • Loading branch information
slugalisk committed Feb 25, 2024
1 parent 3613593 commit e11911b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions api/src/AngelThumpClient.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "AngelThumpClient.h"

#include <string>

#include "Curl.h"
#include "JSON.h"

Expand All @@ -20,7 +22,7 @@ rapidjson::Document ChannelResult::GetSchema() {
"type": "string",
"format": "uri"
},
"viewer_count": {"type": "integer"},
"viewer_count": {"type": "string"},
"user": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -69,7 +71,7 @@ bool ChannelResult::IsNSFW() const {

uint64_t ChannelResult::GetViewers() const {
return GetVideoData().HasMember("viewer_count")
? GetVideoData()["viewer_count"].GetUint64()
? std::stoull(json::StringRef(GetVideoData()["viewer_count"]))
: 0;
}

Expand Down
4 changes: 2 additions & 2 deletions api/tests/AngelthumpTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ TEST(AngelthumpTest, TestNSFW) {
{
"type": "live",
"thumbnail_url": "https://thumbnail.angelthump.com/thumbnails/psrngafk.jpeg",
"viewer_count": 38,
"viewer_count": "38",
"user": {
"offline_banner_url": "https://images-angelthump.nyc3.cdn.digitaloceanspaces.com/offline-banners/31dc54b09264952f60fcdd6b7b743920be725a74a1026a858b81b259cfc79fc6.png",
"title": "Arrival (2016)",
Expand Down Expand Up @@ -45,7 +45,7 @@ TEST(AngelthumpTest, TestNotNSFW) {
{
"type": "live",
"thumbnail_url": "https://thumbnail.angelthump.com/thumbnails/psrngafk.jpeg",
"viewer_count": 34,
"viewer_count": "34",
"user": {
"offline_banner_url": "https://images-angelthump.nyc3.cdn.digitaloceanspaces.com/offline-banners/31dc54b09264952f60fcdd6b7b743920be725a74a1026a858b81b259cfc79fc6.png",
"title": "Arrival (2016)",
Expand Down

0 comments on commit e11911b

Please sign in to comment.