own implementation of singleton and logger
This commit is contained in:
1 parent
f6c5bcca39
commit
6aed7b0027
19 files changed
+745
-206
No files matched your search
@@ -15,7 +15,7 @@
|
||||
#include <quickjs.h>
|
||||
// Project (Assuming similar structure to your Spotify bot)
|
||||
#include <ts6bot/Proxy.hpp>
|
||||
|
||||
#include <Logger.hpp>
|
||||
#include <PluginDefinitions.hpp>
|
||||
|
||||
namespace YouTube {
|
||||
@@ -40,6 +40,23 @@ struct Snippet {
|
||||
std::string liveBroadcastContent;
|
||||
std::string publishTime;
|
||||
};
|
||||
struct PlayListResourceId {
|
||||
std::string kind;
|
||||
std::string videoId;
|
||||
};
|
||||
struct PlayListSnippet{
|
||||
std::string publishedAt;
|
||||
std::string channelId;
|
||||
std::string title;
|
||||
std::string description;
|
||||
std::map<std::string, Thumbnail> thumbnails;
|
||||
std::string channelTitle;
|
||||
std::string playlistId;
|
||||
int position;
|
||||
PlayListResourceId resourceId;
|
||||
std::string videoOwnerChannelTitle;
|
||||
std::string videoOwnerChannelId;
|
||||
};
|
||||
|
||||
struct ResourceId {
|
||||
std::string kind;
|
||||
@@ -84,6 +101,13 @@ struct SearchResult {
|
||||
Snippet snippet;
|
||||
};
|
||||
|
||||
struct SearchPlaylistResult {
|
||||
std::string kind;
|
||||
std::string etag;
|
||||
std::string id;
|
||||
PlayListSnippet snippet;
|
||||
};
|
||||
|
||||
// API Response Wrappers
|
||||
template <typename T> struct PageResult {
|
||||
std::string kind;
|
||||
@@ -151,7 +175,9 @@ struct SearchParams {
|
||||
std::string videoDuration = "any"; // any, long, medium, short
|
||||
bool rawQuery = false; // Set to true to preserve -, |, etc. in query
|
||||
};
|
||||
|
||||
struct ShortenResponse {
|
||||
std::string shortUrl;
|
||||
};
|
||||
// ============================================================================
|
||||
// Main YouTube Client
|
||||
// ============================================================================
|
||||
@@ -178,6 +204,8 @@ public:
|
||||
void SetAccessToken(std::string token) { m_AccessToken = std::move(token); }
|
||||
void SetApiKey(std::string key) { m_ApiKey = std::move(key); }
|
||||
|
||||
auto ShortUrl(const std::string& url) const -> Result<std::string>;
|
||||
|
||||
// ========================================================================
|
||||
// Search API
|
||||
// ========================================================================
|
||||
@@ -214,8 +242,9 @@ public:
|
||||
// https://developers.google.com/youtube/v3/docs/playlistItems/list
|
||||
auto GetPlaylistItems(const std::string &playlistId,
|
||||
const std::string &pageToken = "")
|
||||
-> Result<PageResult<SearchResult>>; // Reusing SearchResult as structure
|
||||
-> Result<PageResult<SearchPlaylistResult>>; // Reusing SearchResult as structure
|
||||
// is similar enough for snippet
|
||||
auto GetPlaylistVideos(const std::string& playlistId) -> Result<std::vector<Video>>;
|
||||
// ========================================================================
|
||||
// Player API (The "Extraction" Logic)
|
||||
// ========================================================================
|
||||
|
||||
Reference in new issue
Block a user