Closed r4ph74 closed 3 years ago
It looks as though you may have a duplicate line in your file. I can't replicate that error here. Try compiling one of the examples to see if you have the same error. If so try downloading a fresh copy of the library. If not, you'll need to share your code to look into the issue further.
The deprecated conversion
warning is a known issue. There is a pull request open to fix it (#34).
I just tried to compile the original example from the library still gives me the error.
this is the original sketch example file that I took from the library. ChannelStatistics.zip
And this is the youtubeAPI.h code . (the original code)
/* Copyright (c) 2020 Brian Lough. All right reserved.
YoutubeApi - An Arduino wrapper for the YouTube API
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
struct channelStatistics{ long viewCount; long commentCount; long subscriberCount; bool hiddenSubscriberCount; long videoCount; };
class YoutubeApi { public: YoutubeApi (char apiKey, Client &client); YoutubeApi (String apiKey, Client &client); int sendGetToYoutube(char command); bool getChannelStatistics(char *channelId); bool getChannelStatistics(String channelId); channelStatistics channelStats; bool _debug = false; String getMyRecentSubscribers(); String getMyRecentSubscribers(String pageToken); channelStatistics channelStats; String myRecentSubscribers[5]; // Fixed number for now, shouldn't go above 50
private: char _apiKey; Client client; int getHttpStatusCode(); void skipHeaders(); void closeClient(); };
===============================================================
I think there might be some changes in the parameter of youtubeApi. but I don't know how to fix it.
That header has been modified. The channelStatistics
member has been declared twice.
I see.
Should I just re-install or just copy paste the original header to mine?
I just reinstall the library again.
the re declaration is already gone .. but there are some warnings.. regarding string constant as below
As @dmadison points out, this is a modified code that didn't come with the library so it is not an issue with the library. Delete and re-install the library if you want to get back to a working version
EDIT: Forgot to submit this last night and submitted it this morning, but see you have replied. Good to see that its working for your again. Warnings will be fixed in a future release but will not stop it from working.
Thanks @dmadison and @witnessmenow for your support.
hi I'm still new in this Arduino world, I used to work with this project, and works fine. no problem at all.
It's been quite a long time I don't get this project again until today I got this project and I tried to compile it and comes up with this error. I haven't change the code and it works fine before .. just replace the wifi id * pass and channel id.
below is the error message from the Arduino console:
In file included from F:\ESP32\Project\YT_IG_Counter_Fix\YT_IG_Counter_WIFI\YT_IG_Counter_WIFI.ino:19:0: C:\Users\r4ph\Documents\Arduino\libraries\YoutubeApi-2.0.0\src/YoutubeApi.h:54:23: error: redeclaration of 'channelStatistics YoutubeApi::channelStats' channelStatistics channelStats; ^ C:\Users\r4ph\Documents\Arduino\libraries\YoutubeApi-2.0.0\src/YoutubeApi.h:50:23: note: previous declaration 'channelStatistics YoutubeApi::channelStats' channelStatistics channelStats; ^ F:\ESP32\Project\YT_IG_Counter_Fix\YT_IG_Counter_WIFI\YT_IG_Counter_WIFI.ino:50:31: warning: deprecated conversion from string constant to 'char' [-Wwrite-strings] YoutubeApi api(API_KEY, client); ^ F:\ESP32\Project\YT_IG_Counter_Fix\YT_IG_Counter_WIFI\YT_IG_Counter_WIFI.ino: In function 'void loop()': F:\ESP32\Project\YT_IG_Counter_Fix\YT_IG_Counter_WIFI\YT_IG_Counter_WIFI.ino:109:46: warning: deprecated conversion from string constant to 'char' [-Wwrite-strings] if (api.getChannelStatistics(CHANNEL_ID)) ^ exit status 1 Error compiling for board LOLIN(WEMOS) D1 R2 & mini.
================================
I hope some can help me how to resolve this error.
Thanks in Advance
Rafael
I'm using : Wemos D1 mini Arduino 1.8.13 YoutubeAPI : V2 ArduinoJson : 6.18.0