kingwill101 / duckduckgo_search

Search using the DuckDuckGo api
https://pub.dev/packages/duckduckgo_search
MIT License
3 stars 0 forks source link

Range error on text #2

Open phantomate opened 1 week ago

phantomate commented 1 week ago

Hi again @kingwill101,

I also have a different issue on the text method. Here is the error I receive:

Unhandled Exception: RangeError (start): Invalid value: Not in inclusive range 0..95: 178 RangeError.checkValidRange (dart:core/errors.dart:360:7) _StringBase.replaceRange (dart:core-patch/string_patch.dart:622:33) normalize.<anonymous closure> (package:duckduckgo_search/src/utilities.dart:27:31) Iterable.fold (dart:core/iterable.dart:407:44) normalize (package:duckduckgo_search/src/utilities.dart:25:60) textApi.textApiPage (package:duckduckgo_search/src/backends/json.dart:75:21) textApi (package:duckduckgo_search/src/backends/json.dart:90:15)

Here is my method call: final results = await DuckDuckGoSearch().text('who is the ceo of tesla');

I hope you can fix it

kingwill101 commented 1 week ago

@phantomate thanks for reporting these. #3 should address both your issues

kingwill101 commented 1 week ago

@phantomate you can go ahead and bump the package version to 0.1.1

phantomate commented 1 week ago

@kingwill101 Wow that was fast. Thank you sir. Unfortunately the answer call is still not working.

When I call final answer = await DuckDuckGoSearch().answers('Who is the ceo of tesla?');

I still get this error: Unhandled Exception: type 'String' is not a subtype of type 'num?' in type cast _$AnswerFromJson (package:duckduckgo_search/src/models/answer.g.dart:22:41) new Answer.fromJson (package:duckduckgo_search/src/models/answer.dart:119:57) DuckDuckGoSearch.answers (package:duckduckgo_search/src/ddgs.dart:135:19)

kingwill101 commented 1 week ago

@kingwill101 Wow that was fast. Thank you sir. Unfortunately the answer call is still not working.

When I call final answer = await DuckDuckGoSearch().answers('Who is the ceo of tesla?');

I still get this error: Unhandled Exception: type 'String' is not a subtype of type 'num?' in type cast _$AnswerFromJson (package:duckduckgo_search/src/models/answer.g.dart:22:41) new Answer.fromJson (package:duckduckgo_search/src/models/answer.dart:119:57) DuckDuckGoSearch.answers (package:duckduckgo_search/src/ddgs.dart:135:19)

@phantomate i've released a new version

https://github.com/kingwill101/duckduckgo_search/releases/tag/v0.1.3

let me know if you encounter other issues

phantomate commented 6 days ago

@kingwill101 thank you for your fix! I'm not receiving an error anymore but I'm also not receiving an answer. The answer is empty/null no matter if I use answerAbstract, answer or abstractText or something else. The question is the same like above ('Who is the ceo of tesla?')