youtubeapi.hpp 936 B

123456789101112131415161718192021222324252627282930
  1. #pragma once
  2. #include <glibmm/ustring.h>
  3. #include <string>
  4. #include <curl/curl.h>
  5. #include <vector>
  6. #include <sstream>
  7. #include <nlohmann/json.hpp>
  8. #include <iostream>
  9. #include <Database/entities.hpp>
  10. #include <Database/database.hpp>
  11. namespace ytapi {
  12. // Функция записи данных в std::ostringstream
  13. size_t write_http_data(char *ptr, size_t size, size_t nmemb, void *userdata);
  14. // Кодирует URL-строку
  15. // https://stackoverflow.com/a/154627
  16. std::string urlencode(const std::string& decoded);
  17. // Раскодирует URL-строку
  18. std::string urldecode(const std::string& encoded);
  19. // Получает список видео по запросу
  20. std::vector<db::video> getVideosByQuery(std::string api_key, std::string query);
  21. // Возвращает список видео из JSON
  22. std::vector<db::video> getVideosFromJSON(std::string input);
  23. }