ulixee / hero

The web browser built for scraping
MIT License
805 stars 41 forks source link

feat(client): add single resource search apis #99

Closed blakebyrnes closed 2 years ago

blakebyrnes commented 2 years ago

It became apparent when writing out example docs in Databox that we need both singular and plural resource apis. Otherwise you CAN'T do a findResource and actually find all of them. And once you have both findResource and findResources, it just doesn't make sense to have a method called waitForResource that returns multiple.

This PR changes our resource APIs to the following:

  1. waitForResource is renamed to waitForResources
  2. waitForResource is now a singular resource lookup. There is no "done" function required if you use a filter function. The function escapes when you return.
  3. findResource returns a single resource since the page loaded (http request, not in-page load)
  4. findResources finds many resources since the page loaded (http request, not in-page load)