blenderskool / untab

🔍 A productivity tool to boost your browser workflow!
https://getuntab.now.sh
MIT License
345 stars 27 forks source link

Initial implementation of DuckDuckGo Instant answer #44

Closed ismaeldcom closed 3 years ago

ismaeldcom commented 3 years ago

Fixes #36

I made a very basic initial implementation of Initial DuckDuckGo Instant answer adding provided results, abstract and related topics to the current search functionality.

Here is an example: image

There's room for improvement, but I'd rather start with that to see if it's what you like.

ismaeldcom commented 3 years ago

Thank you for this addition @ismaeldcom. Definitely better than what we had before.

I have added some comments and queries which I had in some parts, but apart from those things look in the right direction. We should add the attribution to DuckDuckGo in some part as it's required when consuming their API.

I'm changing it to add a new category with the results, but reading the API specs, maybe change the search item to Results from DuckDuckGo for $query might be a good option to meet the requirements because it already contains the logo and link to the search results. And use a category like Instant Answer for the actual results.

image A picture is better than a lot of words :)

What do you think?

blenderskool commented 3 years ago

This seems fine @ismaeldcom :+1:

ismaeldcom commented 3 years ago

@blenderskool I can't reproduce the error with wiki but searching for &format result in an error. I added a dummy catch to avoid code error and continue with execution.

ismaeldcom commented 3 years ago

@blenderskool Thanks for your improvements I'll take note.

Don't you see the favicons as in the attached images? From GitHub in the first screenshot, for example.

blenderskool commented 3 years ago

@ismaeldcom I was getting different results for the search. The Wikipedia link has a favicon in your image, but it doesn't seem to show up for me :thinking:

ismaeldcom commented 3 years ago

@blenderskool I made some tests and the API now returns relative (to DDG) URLs for icons. For the firsts screenshots attached and examples found online the URL was absolute.

I made a small function to parse the URL, I think is better to save it in another file and not write inline, but I don't know exactly where to store it in the current project structure.

blenderskool commented 3 years ago

I think is better to save it in another file and not write inline, but I don't know exactly where to store it in the current project structure.

Makes sense. Let's keep it within the item function itself for now, as it is specific to the DuckDuckGo plugin. We'll have to come up with a better file structure for the plugins.