Is it possible to get Lemmy’s search result in JSON format? E.g., to include the search in search engines like searx. That would be really awesome.

  • Kromonos@fapsi.beOP
    link
    fedilink
    arrow-up
    7
    ·
    edit-2
    3 years ago

    hmm 🤔 … Normally, the following in the settings.yml should do the trick:

      - name : lemmy
        engine : json_engine
        search_url : https://lemmy.ml/api/v3/search?q={query}&page={pageno}&type_=Posts
        results_query : posts
        url_query : post/ap_id
        title_query : post/name
        content_query : post/body
        categories : general, social media
        shortcut : le
        paging : True
        disabled : False
    

    But my searx instance doesn’t even seem to fetch the JSON.

    OK, I said nothing. It works 😆

    https://search.bka.li/search?q=what is lemmy&categories=social+media&language=en-US

    One now could add e.g. comments too with something like this:

      - name : lemmy comments
        engine : json_engine
        search_url : https://lemmy.ml/api/v3/search?q={query}&page={pageno}&type_=Comments
        results_query : comments
        url_query : post/ap_id
        title_query : post/name
        content_query : post/body
        categories : general, social media
        shortcut : lec
        paging : True
        disabled : False
    

    As well as communities:

      - name : lemmy communities
        engine : json_engine
        search_url : https://lemmy.ml/api/v3/search?q={query}&page={pageno}&type_=Communities
        results_query : communities
        url_query : post/ap_id
        title_query : post/name
        content_query : post/body
        categories : general, social media
        shortcut : leco
        paging : True
        disabled : False
    

    User search is possible too, but adding this would only support bullying.

    • nutomicMA
      link
      fedilink
      arrow-up
      6
      ·
      edit-2
      3 years ago

      Cool! You should probably make a separate post for that.

  • boi
    link
    fedilink
    arrow-up
    5
    ·
    3 years ago

    Big searx supporter here, absolutely agree