kevin-rs / duckduckgo

🦆 A CLI and library for instant DuckDuckGo searches. (WIP)
https://docs.rs/duckduckgo
MIT License
1 stars 2 forks source link

Duckduckgo search didn’t work on version 0.1.2 #8

Open franklinselva opened 8 months ago

franklinselva commented 8 months ago

Duckduckgo search didn’t work on version 0.1.2

Returns empty results

franklinselva commented 8 months ago

Looking into the work further. Only the CLI version doesn't work. The library works as expected.

wiseaidev commented 8 months ago

Hello @franklinselva, thanks for filing this issue! Unfortunately, I can't reproduce it on my machine:

$ duckduckgo --query "rust lang"
Rust (programming language)
1. Rust (programming language) Category 
URL: https://duckduckgo.com/c/Rust_(programming_language)?kp=%2D2
--------------------------------------------
2. History of programming languages - The history of programming languages spans from documentation of early mechanical computers to modern tools for software development. Early programming languages were highly specialized, relying on mathematical notation and similarly obscure syntax. 
URL: https://duckduckgo.com/History_of_programming_languages?kp=%2D2
--------------------------------------------
3. Pattern matching programming languages 
URL: https://duckduckgo.com/c/Pattern_matching_programming_languages?kp=%2D2
--------------------------------------------
4. Multi-paradigm programming languages 
URL: https://duckduckgo.com/c/Multi-paradigm_programming_languages?kp=%2D2
--------------------------------------------
5. Statically typed programming languages 
URL: https://duckduckgo.com/c/Statically_typed_programming_languages?kp=%2D2
--------------------------------------------
6. Systems programming languages 
URL: https://duckduckgo.com/c/Systems_programming_languages?kp=%2D2
--------------------------------------------
7. Concurrent programming languages 
URL: https://duckduckgo.com/c/Concurrent_programming_languages?kp=%2D2
--------------------------------------------
8. High-level programming languages 
URL: https://duckduckgo.com/c/High-level_programming_languages?kp=%2D2
--------------------------------------------
9. Mozilla 
URL: https://duckduckgo.com/c/Mozilla?kp=%2D2
--------------------------------------------
10. Free software projects 
URL: https://duckduckgo.com/c/Free_software_projects?kp=%2D2
--------------------------------------------

So it could be an OS specific issue. What OS are you using?

franklinselva commented 8 months ago

@wiseaidev Thanks for the swift reply. Here is the output from my machine. I am using MacOS Sonoma & Ubuntu 22.04 for testing.

 duckduckgo --query "rust programming"

However, the same query you have added in your response seems to work fine.

Is the problem related to Duckduckgo's instant answer api

wiseaidev commented 8 months ago

Is the problem related to Duckduckgo's instant answer api

Yep! Also, the results the CLI is showing are just the surface-level search of DuckDuckGo. While building this crate, I have discovered that there are multiple backends for the DuckDuckGo API (html.duckduckgo, lite.duckduckgo..., not just api.duckduckgo). We should implement the other backends to display detailed results. If you want to improve this project, I am open to any discussion about design improvement to support all backends.