Paperd.Ink Library 0.0.5
Library for interacting with Paperd.Ink devices.
Loading...
Searching...
No Matches
youtube_parser.cpp
Go to the documentation of this file.
1#include "youtube.h"
2#include "youtube_parser.h"
3
5static YOUTUBE_STATE key_state;
6
10
12{
13 key_state = NOT_FOUND;
14}
15
17{
18 if (key.equals("viewCount"))
19 key_state = FOUND_VIEWS;
20 else if (key.equals("subscriberCount"))
21 key_state = FOUND_SUBSCRIBERS;
22}
23
25{
26 if (key_state == FOUND_VIEWS) {
27 sscanf(value.c_str(), "%lld", &Paperdink_Youtube.views);
28 Serial.printf("Views: %lld\r\n", Paperdink_Youtube.views);
29 key_state = NOT_FOUND;
30 } else if (key_state == FOUND_SUBSCRIBERS) {
31 sscanf(value.c_str(), "%lld", &Paperdink_Youtube.subscribers);
32 Serial.printf("Subscribers: %lld\r\n", Paperdink_Youtube.subscribers);
33 key_state = NOT_FOUND;
34 }
35}
36
40
44
48
52
virtual void startArray()
virtual void endObject()
virtual void whitespace(char c)
virtual void endArray()
virtual void key(String key)
virtual void startDocument()
virtual void endDocument()
virtual void startObject()
virtual void value(String value)
@ NOT_FOUND
PaperdinkUIYoutubeClass Paperdink_Youtube
Definition youtube.cpp:138
YOUTUBE_STATE
@ FOUND_SUBSCRIBERS
@ FOUND_VIEWS
@ NOT_FOUND