opensearch_response_rss.xml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <rss version="2.0"
  3. xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
  4. xmlns:atom="http://www.w3.org/2005/Atom">
  5. <channel>
  6. <title>Searx search: {{ q|e }}</title>
  7. <link>{{ url_for('search', _external=True) }}?q={{ q|e }}</link>
  8. <description>Search results for "{{ q|e }}" - searx</description>
  9. <opensearch:totalResults>{{ number_of_results }}</opensearch:totalResults>
  10. <opensearch:startIndex>1</opensearch:startIndex>
  11. <opensearch:itemsPerPage>{{ number_of_results }}</opensearch:itemsPerPage>
  12. <atom:link rel="search" type="application/opensearchdescription+xml" href="{{ opensearch_url }}"/>
  13. <opensearch:Query role="request" searchTerms="{{ q|e }}" startPage="1" />
  14. {% if error_message %}
  15. <item>
  16. <title>Error</title>
  17. <description>{{ error_message|e }}</description>
  18. </item>
  19. {% endif %}
  20. {% for r in results %}
  21. <item>
  22. <title>{{ r.title }}</title>
  23. <link>{{ r.url }}</link>
  24. <description>{{ r.content }}</description>
  25. {% if r.pubdate %}<pubDate>{{ r.pubdate }}</pubDate>{% endif %}
  26. </item>
  27. {% endfor %}
  28. {% if answers %}
  29. {% for a in answers %}
  30. <item>
  31. <title>{{ a }}</title>
  32. <type>answer</type>
  33. </item>
  34. {% endfor %}
  35. {% endif %}
  36. {% if corrections %}
  37. {% for a in corrections %}
  38. <item>
  39. <title>{{ a }}</title>
  40. <type>correction</type>
  41. </item>
  42. {% endfor %}
  43. {% endif %}
  44. {% if suggestions %}
  45. {% for a in suggestions %}
  46. <item>
  47. <title>{{ a }}</title>
  48. <type>suggestion</type>
  49. </item>
  50. {% endfor %}
  51. {% endif %}
  52. </channel>
  53. </rss>