Skip to content

Not work in Flutter Web Application #70

Description

@ZotInfo

I'm developing an investment application for a small group of investors, I need to read the google news, however, when I try to read the page, using flutter web, it returns the error in reading, the same occurs when I use the http plugin .

When I fetch data from an API using http, it works perfectly.

My code

String url = "https://www.google.com", 
page = "/search?q=${search}&hl=pt-BR&gl=BR&ceid=BR:pt-419";

print('getUltimasNoticias: $url$page');
final webScraper = WebScraper(url);
if (await webScraper.loadWebPage(page)) {
  final divElements = webScraper.getElement('div.NiLAwe y6IFtc R7GTQ keNKEd j7vNaf nID9nc', []);
  print("divElements: $divElements");
} else {
  print('Cannot load url');
}

Error and stacktrace

==================================================
Tela: 'NewsHelper'
Função: 'getUltimasNoticias'
Exception: Instance of 'WebScraperException'
StackTrace: C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 251:49  throw_
packages/web_scraper/web_scraper.dart 62:9                                                                                 loadWebPage
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 60:31            <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/zone.dart 1690:54                                          runBinary
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 174:22                                    handleError
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 778:46                                    handleError
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 799:13                                    _propagateToListeners
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 609:5                                     [_completeError]
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 665:7                                     callback
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/schedule_microtask.dart 40:11                              _microtaskLoop
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/schedule_microtask.dart 49:5                               _startMicrotaskLoop
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 166:15           <fn>

==================================================

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions