diff options
author | ComradeCrow <comradecrow@vivaldi.net> | 2023-04-18 17:39:43 -0700 |
---|---|---|
committer | ComradeCrow <comradecrow@vivaldi.net> | 2023-04-18 17:39:43 -0700 |
commit | 772637e0947286e54ab97b8d55ad2c05fe9a1c86 (patch) | |
tree | 2a7d46adf1d2dd7d2b60698e6d0d6daf5bdbd2f8 | |
parent | 6737e6ac61634781638338b3753385e78aa1d571 (diff) | |
download | ytcpp-772637e0947286e54ab97b8d55ad2c05fe9a1c86.tar.gz |
hotfix
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/YtdlpWrapper.cpp | 5 | ||||
-rw-r--r-- | src/YtdlpWrapper.hpp | 2 | ||||
-rw-r--r-- | src/main.cpp | 4 |
4 files changed, 5 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b5fbdca..25833e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,6 +52,5 @@ target_link_libraries(${PROJECT_NAME} PRIVATE ftxui::component PRIVATE nlohmann_json::nlohmann_json PRIVATE SQLite::SQLite3 - ## ${PCAP_LIBRARY} PRIVATE pybind11::embed ) diff --git a/src/YtdlpWrapper.cpp b/src/YtdlpWrapper.cpp index ca1d4a4..2b87a62 100644 --- a/src/YtdlpWrapper.cpp +++ b/src/YtdlpWrapper.cpp @@ -24,10 +24,9 @@ py::object YtdlpWrapper::get_ytdl() { return ytdl; } -json YtdlpWrapper::getJsonSearch(const string& searchTerm) { +json YtdlpWrapper::getJsonSearch(const string& searchTerm, int limit) { - // py::object info = get_ytdl().attr("extract_info")("ytsearch:"+searchTerm, "download"_a=py::bool_(false)); - py::dict info("test"_a=py::bool_(true), "test2"_a=py::str("yoyoyo"), "test3"_a=py::none()); + py::dict info = get_ytdl().attr("extract_info")("ytsearch"+std::to_string(limit)+":"+searchTerm, "download"_a=py::bool_(false)); return json::parse(pyDictToJsonString(info)); } diff --git a/src/YtdlpWrapper.hpp b/src/YtdlpWrapper.hpp index 6cc045d..f7cc256 100644 --- a/src/YtdlpWrapper.hpp +++ b/src/YtdlpWrapper.hpp @@ -6,7 +6,7 @@ class YtdlpWrapper { public: - nlohmann::json getJsonSearch(const string& searchTerm); + nlohmann::json getJsonSearch(const string& searchTerm, int limit = 1); private: pybind11::object get_ytdl(); pybind11::object ytdl = pybind11::none(); diff --git a/src/main.cpp b/src/main.cpp index a03461f..f258c24 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,8 +17,8 @@ int main() { py::scoped_interpreter guard{}; YtdlpWrapper yt; - nlohmann::json j = yt.getJsonSearch("All Quiet on the Western Front Ost"); - cout << j << endl; + // nlohmann::json j = yt.getJsonSearch("All Quiet on the Western Front Ost"); + // cout << j << endl; // vector<string> instances = getInstances(); // for (auto i: instances) { |