about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorComradeCrow <comradecrow@vivaldi.net>2023-04-18 17:39:43 -0700
committerComradeCrow <comradecrow@vivaldi.net>2023-04-18 17:39:43 -0700
commit772637e0947286e54ab97b8d55ad2c05fe9a1c86 (patch)
tree2a7d46adf1d2dd7d2b60698e6d0d6daf5bdbd2f8 /src
parent6737e6ac61634781638338b3753385e78aa1d571 (diff)
downloadytcpp-772637e0947286e54ab97b8d55ad2c05fe9a1c86.tar.gz
hotfix
Diffstat (limited to 'src')
-rw-r--r--src/YtdlpWrapper.cpp5
-rw-r--r--src/YtdlpWrapper.hpp2
-rw-r--r--src/main.cpp4
3 files changed, 5 insertions, 6 deletions
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) {