#include #include #include #include "YtdlpWrapper.hpp" using json = nlohmann::json; namespace py = pybind11; using namespace py::literals; YtdlpWrapper::YtdlpWrapper() { ytdl = py::module::import("yt_dlp").attr("YoutubeDL")(py::dict({"ignoreerrors": true})); } json YtdlpWrapper::getJsonSearch(const string& searchTerm) { const auto info = ytdl.attr("extract_info")("ytsearch:"+searchTerm, "download"_a=py::bool_(false)); return json::parse(static_cast(info)); }