File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -81,23 +81,23 @@ bool YoutubeApi::getChannelStatistics(String channelId){
81
81
82
82
bool YoutubeApi::getChannelStatistics (char *channelId){
83
83
char command[150 ] = YTAPI_CHANNEL_ENDPOINT;
84
- strcat (command, " ?part=statistics&id=%s" );
85
- sprintf (command, command, channelId);
86
- strcat (command, " &key=%s" );
87
- sprintf (command, command, _apiKey);
84
+ char params[120 ];
85
+ sprintf (params, " ?part=statistics&id=%s&key=%s" , channelId, _apiKey);
86
+ strcat (command, params);
88
87
89
88
if (_debug)
90
89
{
91
90
Serial.println (command);
92
91
}
93
92
94
- bool hasError = true ;
93
+ bool wasSuccessful = false ;
95
94
96
95
// Get from https://arduinojson.org/v6/assistant/
97
96
const size_t bufferSize = JSON_ARRAY_SIZE (1 )
98
97
+ JSON_OBJECT_SIZE (2 )
99
98
+ 2 *JSON_OBJECT_SIZE (4 )
100
- + JSON_OBJECT_SIZE (5 );
99
+ + JSON_OBJECT_SIZE (5 )
100
+ + 330 ;
101
101
102
102
int httpStatus = sendGetToYoutube (command);
103
103
@@ -110,7 +110,7 @@ bool YoutubeApi::getChannelStatistics(char *channelId){
110
110
DeserializationError error = deserializeJson (doc, *client);
111
111
if (!error)
112
112
{
113
- hasError = false ;
113
+ wasSuccessful = true ;
114
114
115
115
JsonObject itemStatistics = doc[" items" ][0 ][" statistics" ];
116
116
@@ -131,7 +131,7 @@ bool YoutubeApi::getChannelStatistics(char *channelId){
131
131
}
132
132
closeClient ();
133
133
134
- return hasError ;
134
+ return wasSuccessful ;
135
135
}
136
136
137
137
void YoutubeApi::skipHeaders ()
You can’t perform that action at this time.
0 commit comments