whoogle-search icon indicating copy to clipboard operation
whoogle-search copied to clipboard

[FEATURE] Add a parsable (JSON or XML) endpoint for results

Open throwaway34241 opened this issue 2 years ago • 7 comments

Describe the feature you'd like to see added

Current the /search endpoint returns a HTML file to display the results. This works well for UI users, which might be the first use case of Whoogle. But it's hard for programmatic use cases, as it requires parsing HTML.

I propose to add a new /search.{json|xml} endpoint to return the same results in a structured format: JSON or XML

Idea 1: JSON

A /search.json?q=%s endpoint which would search results as JSON.

I don't think there's a standard JSON format to use, but we could take inspiration for https://zenserp.com/ or https://serpapi.com/.

Idea 2: OpenSearch XML format

This project already uses opensearch, so we could leverage the same standard's response XML: https://github.com/dewitt/opensearch/blob/master/opensearch-1-1-draft-6.md#opensearch-response-elements

Additional context

I have a personal preference for JSON, as it seems to be today's web standard for APIs.

Adding parsable results would allow integration with various projects, via API (e.g. Zapier, Integromat), RSS or simple scripts. Some use cases include:

  • keyword monitoring
  • market research
  • build a voice assistant
  • and the imagination of the community

throwaway34241 avatar Jan 09 '22 03:01 throwaway34241