HomeSketchwareHow to get Subscriber Count in Sketchware.

How to get Subscriber Count in Sketchware.

1) First Create a New Sketchware project.

2) Then add EditText as edittext1, Button as button1, TextView as textview5, textview2, textview3, textview4. Add two string variables as g and h. Add two map variables as map and map1. Add a List Map Variable as mapy.
textview5 for Channel Name, textview2 for Subscribers, textview3 for Views, textview4 for Videos.
Then add a Request Network Component with name cha.
3)Add a more block named ytch with strings id and key.
Then add some blocks as a video below
The first link used is  https://www.googleapis.com/youtube/v3/channels?part=snippet%2Cstatistics&id=  and the second link is  https://www.youtube.com/channel/ and last code is  &key=


 4) Then add a button1 on Click event and do as below:

Your Api Key must be replaced with your API Key.
If you don’t know how to get the API key you can watch the below video and don’t forgot to enable youtube APIs

5) Then in cha onResponse do like the video below:

The code used in if condition is “totalResults”: 1.
First code is 
g= (new Gson()).toJson(map.get(“items”), new TypeToken<ArrayList<HashMap<String, Object>>>(){}.getType());
Second code is
h= (new Gson()).toJson(mapy.get(0).get(“snippet”), new TypeToken<HashMap<String, Object>>(){}.getType());
Texts used in map.get key is subscriberCount, viewCount, videoCount, title.
Paste above texts as it is without any Space OR Spelling mistake.
6) In cha onErrorResponse add as below:

7) Save and run the Project.


2 thoughts on “How to get Subscriber Count in Sketchware.

  1. Still says invalid key

  2. I think you entered wrong channel url or a user url.
    Channel url is in the format :- http://www.youtube.com/channel/
    User url is in the format :- http://www.youtube.com/user/

Leave a Reply