Skip to content

armgit / mwmbl

Public Imported from GitHub
0

An open source, non-profit web search engine

Super Search v2: 55 validated recipes + deterministic authoring tooling

Daoud Clarke62b40f00b699
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/addons_mozilla_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/addons_mozilla_org.yaml
new file mode 100644
index 0000000..113dc5f
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/addons_mozilla_org.yaml
@@ -0,0 +1,18 @@
+name: addons_mozilla_org
+domain: addons.mozilla.org
+field: tech
+request:
+ url: https://addons.mozilla.org/api/v5/addons/search/
+ params:
+ q: "{query}"
+ page_size: "{limit}"
+response:
+ format: json
+ results: results
+ fields:
+ title: name
+ extract: summary
+ url: url
+smoke:
+ query: ublock
+ expect_title_contains: uBlock
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/community_grafana_com.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/community_grafana_com.yaml
new file mode 100644
index 0000000..d71a2a5
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/community_grafana_com.yaml
@@ -0,0 +1,17 @@
+name: community_grafana_com
+domain: community.grafana.com
+field: programming
+request:
+ url: https://community.grafana.com/search.json
+ params:
+ q: '{query}'
+response:
+ format: json
+ results: topics
+ fields:
+ title: title
+ url:
+ template: https://community.grafana.com/t/{slug}/{id}
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/db_cs_cmu_edu.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/db_cs_cmu_edu.yaml
new file mode 100644
index 0000000..a9261e4
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/db_cs_cmu_edu.yaml
@@ -0,0 +1,17 @@
+name: db_cs_cmu_edu
+domain: db.cs.cmu.edu
+field: academia
+request:
+ url: https://db.cs.cmu.edu/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: research
+ expect_title_contains: research
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/devblogs_microsoft_com.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/devblogs_microsoft_com.yaml
new file mode 100644
index 0000000..458f861
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/devblogs_microsoft_com.yaml
@@ -0,0 +1,21 @@
+name: devblogs_microsoft_com
+domain: devblogs.microsoft.com
+field: programming
+request:
+ url: https://devblogs.microsoft.com/wp-json/wp/v2/posts
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title.rendered
+ extract: excerpt.rendered
+ url: link
+ strip_html:
+ - title
+ - extract
+smoke:
+ query: world
+ expect_title_contains: world
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/directory_fsf_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/directory_fsf_org.yaml
new file mode 100644
index 0000000..9539919
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/directory_fsf_org.yaml
@@ -0,0 +1,24 @@
+name: directory_fsf_org
+domain: directory.fsf.org
+field: programming
+request:
+ url: https://directory.fsf.org/w/api.php
+ params:
+ action: query
+ list: search
+ format: json
+ srsearch: '{query}'
+ srlimit: '{limit}'
+response:
+ format: json
+ results: query.search
+ fields:
+ title: title
+ extract: snippet
+ url:
+ template: https://directory.fsf.org/wiki/{title}
+ strip_html:
+ - extract
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/discourse_llvm_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/discourse_llvm_org.yaml
new file mode 100644
index 0000000..36ed690
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/discourse_llvm_org.yaml
@@ -0,0 +1,17 @@
+name: discourse_llvm_org
+domain: discourse.llvm.org
+field: programming
+request:
+ url: https://discourse.llvm.org/search.json
+ params:
+ q: '{query}'
+response:
+ format: json
+ results: topics
+ fields:
+ title: title
+ url:
+ template: https://discourse.llvm.org/t/{slug}/{id}
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/discourse_matplotlib_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/discourse_matplotlib_org.yaml
new file mode 100644
index 0000000..e0cd10b
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/discourse_matplotlib_org.yaml
@@ -0,0 +1,17 @@
+name: discourse_matplotlib_org
+domain: discourse.matplotlib.org
+field: programming
+request:
+ url: https://discourse.matplotlib.org/search.json
+ params:
+ q: '{query}'
+response:
+ format: json
+ results: topics
+ fields:
+ title: title
+ url:
+ template: https://discourse.matplotlib.org/t/{slug}/{id}
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/discourse_osgeo_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/discourse_osgeo_org.yaml
new file mode 100644
index 0000000..d5d202b
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/discourse_osgeo_org.yaml
@@ -0,0 +1,17 @@
+name: discourse_osgeo_org
+domain: discourse.osgeo.org
+field: tech
+request:
+ url: https://discourse.osgeo.org/search.json
+ params:
+ q: '{query}'
+response:
+ format: json
+ results: topics
+ fields:
+ title: title
+ url:
+ template: https://discourse.osgeo.org/t/{slug}/{id}
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/discuss_python_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/discuss_python_org.yaml
new file mode 100644
index 0000000..00e9880
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/discuss_python_org.yaml
@@ -0,0 +1,17 @@
+name: discuss_python_org
+domain: discuss.python.org
+field: programming
+request:
+ url: https://discuss.python.org/search.json
+ params:
+ q: '{query}'
+response:
+ format: json
+ results: topics
+ fields:
+ title: title
+ url:
+ template: https://discuss.python.org/t/{slug}/{id}
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/doc_hal_science.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/doc_hal_science.yaml
new file mode 100644
index 0000000..3b7acea
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/doc_hal_science.yaml
@@ -0,0 +1,22 @@
+name: doc_hal_science
+domain: doc.hal.science
+field: academia
+request:
+ url: https://api.archives-ouvertes.fr/search
+ params:
+ q: "{query}"
+ rows: "{limit}"
+ fl: docid,title_s,uri_s
+ sort: "submitType_s desc"
+ wt: json
+response:
+ format: json
+ results: response.docs
+ fields:
+ title: title_s
+ extract: "abstract_s"
+ url:
+ template: "https://doc.hal.science/{docid}"
+smoke:
+ query: machine learning
+ expect_title_contains: learning
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/forum_obsidian_md.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/forum_obsidian_md.yaml
new file mode 100644
index 0000000..c7fc05d
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/forum_obsidian_md.yaml
@@ -0,0 +1,17 @@
+name: forum_obsidian_md
+domain: forum.obsidian.md
+field: tech
+request:
+ url: https://forum.obsidian.md/search.json
+ params:
+ q: '{query}'
+response:
+ format: json
+ results: topics
+ fields:
+ title: title
+ url:
+ template: https://forum.obsidian.md/t/{slug}/{id}
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/gamehistory_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/gamehistory_org.yaml
new file mode 100644
index 0000000..6e22932
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/gamehistory_org.yaml
@@ -0,0 +1,20 @@
+name: gamehistory_org
+domain: gamehistory.org
+field: gaming
+request:
+ url: https://gamehistory.org/wp-json/wp/v2/posts
+ params:
+ search: "{query}"
+ per_page: "{limit}"
+response:
+ format: json
+ results: ""
+ fields:
+ title: title.rendered
+ extract: excerpt.rendered
+ url: link
+ strip_html:
+ - extract
+smoke:
+ query: mario
+ expect_title_contains: mario
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/grist_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/grist_org.yaml
new file mode 100644
index 0000000..fc62e36
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/grist_org.yaml
@@ -0,0 +1,17 @@
+name: grist_org
+domain: grist.org
+field: news-politics
+request:
+ url: https://grist.org/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/hackaday_com.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/hackaday_com.yaml
new file mode 100644
index 0000000..123aeab
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/hackaday_com.yaml
@@ -0,0 +1,17 @@
+name: hackaday_com
+domain: hackaday.com
+field: tech
+request:
+ url: https://hackaday.com/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/hacks_mozilla_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/hacks_mozilla_org.yaml
new file mode 100644
index 0000000..3210912
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/hacks_mozilla_org.yaml
@@ -0,0 +1,20 @@
+name: hacks_mozilla_org
+domain: hacks.mozilla.org
+field: programming
+request:
+ url: https://hacks.mozilla.org/wp-json/wp/v2/posts
+ params:
+ search: "{query}"
+ per_page: "{limit}"
+response:
+ format: json
+ results: ""
+ fields:
+ title: title.rendered
+ extract: excerpt.rendered
+ url: link
+ strip_html:
+ - extract
+smoke:
+ query: firefox
+ expect_title_contains: firefox
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/insideclimatenews_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/insideclimatenews_org.yaml
new file mode 100644
index 0000000..8e05365
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/insideclimatenews_org.yaml
@@ -0,0 +1,17 @@
+name: insideclimatenews_org
+domain: insideclimatenews.org
+field: news-politics
+request:
+ url: https://insideclimatenews.org/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/lexi_lambda_github_io.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/lexi_lambda_github_io.yaml
new file mode 100644
index 0000000..b8b0a74
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/lexi_lambda_github_io.yaml
@@ -0,0 +1,20 @@
+name: lexi_lambda_github_io
+domain: lexi-lambda.github.io
+field: programming
+request:
+ url: https://lexi-lambda.github.io/
+ params:
+ q: "{query}"
+response:
+ format: html
+ results: "article"
+ base_url: https://lexi-lambda.github.io
+ fields:
+ title:
+ selector: "h1 a"
+ url:
+ selector: "h1 a"
+ attr: href
+smoke:
+ query: programming
+ expect_title_contains: programming
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/longreads_com.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/longreads_com.yaml
new file mode 100644
index 0000000..72d7984
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/longreads_com.yaml
@@ -0,0 +1,17 @@
+name: longreads_com
+domain: longreads.com
+field: news-politics
+request:
+ url: https://longreads.com/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/makham_itch_io.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/makham_itch_io.yaml
new file mode 100644
index 0000000..cf50f0c
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/makham_itch_io.yaml
@@ -0,0 +1,20 @@
+name: makham_itch_io
+domain: makham.itch.io
+field: gaming
+request:
+ url: https://makham.itch.io/
+ params:
+ q: "{query}"
+response:
+ format: html
+ results: ".game_cell"
+ base_url: https://makham.itch.io
+ fields:
+ title:
+ selector: ".game_title"
+ url:
+ selector: "a"
+ attr: href
+smoke:
+ query: game
+ expect_title_contains: game
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/markodenic_com.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/markodenic_com.yaml
new file mode 100644
index 0000000..2fcc0df
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/markodenic_com.yaml
@@ -0,0 +1,20 @@
+name: markodenic_com
+domain: markodenic.com
+field: tech
+request:
+ url: https://markodenic.com/wp-json/wp/v2/posts
+ params:
+ search: "{query}"
+ per_page: "{limit}"
+response:
+ format: json
+ results: ""
+ fields:
+ title: title.rendered
+ extract: excerpt.rendered
+ url: link
+ strip_html:
+ - extract
+smoke:
+ query: javascript
+ expect_title_contains: javascript
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/mathenchant_wordpress_com.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/mathenchant_wordpress_com.yaml
new file mode 100644
index 0000000..0b79b2d
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/mathenchant_wordpress_com.yaml
@@ -0,0 +1,22 @@
+name: mathenchant_wordpress_com
+domain: mathenchant.wordpress.com
+field: science
+request:
+ url: https://mathenchant.wordpress.com/
+ params:
+ s: "{query}"
+response:
+ format: html
+ results: "article"
+ base_url: https://mathenchant.wordpress.com
+ fields:
+ title:
+ selector: "h1.entry-title a"
+ extract:
+ selector: "div.entry-summary p"
+ url:
+ selector: "h1.entry-title a"
+ attr: href
+smoke:
+ query: mathematics
+ expect_title_contains: Pictur
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/propublica_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/propublica_org.yaml
new file mode 100644
index 0000000..a7e4ffe
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/propublica_org.yaml
@@ -0,0 +1,21 @@
+# ProPublica investigative journalism via WordPress REST API.
+name: propublica_org
+domain: www.propublica.org
+field: news-politics
+request:
+ url: https://www.propublica.org/wp-json/wp/v2/posts
+ params:
+ search: "{query}"
+ per_page: "{limit}"
+response:
+ format: json
+ results: ""
+ fields:
+ title: title.rendered
+ extract: excerpt.rendered
+ url: link
+ strip_html:
+ - extract
+smoke:
+ query: investigation
+ expect_title_contains: investigation
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/reactos_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/reactos_org.yaml
new file mode 100644
index 0000000..8793259
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/reactos_org.yaml
@@ -0,0 +1,24 @@
+name: reactos_org
+domain: reactos.org
+field: tech
+request:
+ url: "https://reactos.org/wiki/api.php"
+ params:
+ action: "query"
+ list: "search"
+ format: "json"
+ srsearch: "{query}"
+ srlimit: "{limit}"
+response:
+ format: json
+ results: "query.search"
+ fields:
+ title: "title"
+ url:
+ template: "https://reactos.org/wiki/{title}"
+ extract: "snippet"
+ strip_html:
+ - extract
+smoke:
+ query: "kernel"
+ expect_title_contains: "Kernel"
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/reallifemag_com.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/reallifemag_com.yaml
new file mode 100644
index 0000000..4155ab2
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/reallifemag_com.yaml
@@ -0,0 +1,17 @@
+name: reallifemag_com
+domain: reallifemag.com
+field: news-politics
+request:
+ url: https://reallifemag.com/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/rosettacode_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/rosettacode_org.yaml
new file mode 100644
index 0000000..06ec49c
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/rosettacode_org.yaml
@@ -0,0 +1,24 @@
+name: rosettacode_org
+domain: rosettacode.org
+field: technology
+request:
+ url: https://rosettacode.org/w/api.php
+ params:
+ action: query
+ list: search
+ format: json
+ srsearch: '{query}'
+ srlimit: '{limit}'
+response:
+ format: json
+ results: query.search
+ fields:
+ title: title
+ extract: snippet
+ url:
+ template: https://rosettacode.org/wiki/{title}
+ strip_html:
+ - extract
+smoke:
+ query: quicksort
+ expect_title_contains: quicksort
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/rubygems_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/rubygems_org.yaml
new file mode 100644
index 0000000..2c3b41b
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/rubygems_org.yaml
@@ -0,0 +1,18 @@
+name: rubygems_org
+domain: rubygems.org
+field: technology
+request:
+ url: https://rubygems.org/api/v1/search.json
+ params:
+ query: '{query}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: name
+ extract: info
+ url:
+ template: https://rubygems.org/gems/{name}
+smoke:
+ query: rails
+ expect_title_contains: rails
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/semiengineering_com.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/semiengineering_com.yaml
new file mode 100644
index 0000000..6aed307
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/semiengineering_com.yaml
@@ -0,0 +1,17 @@
+name: semiengineering_com
+domain: semiengineering.com
+field: tech
+request:
+ url: https://semiengineering.com/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/simonwillison_net.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/simonwillison_net.yaml
new file mode 100644
index 0000000..40d41b2
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/simonwillison_net.yaml
@@ -0,0 +1,20 @@
+name: simonwillison_net
+domain: simonwillison.net
+field: tech
+request:
+ url: https://simonwillison.net/search/
+ params:
+ q: "{query}"
+response:
+ format: html
+ results: "h3"
+ base_url: https://simonwillison.net
+ fields:
+ title:
+ selector: "a"
+ url:
+ selector: "a"
+ attr: href
+smoke:
+ query: web development
+ expect_title_contains: web
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/the_president_europarl_europa_eu.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/the_president_europarl_europa_eu.yaml
new file mode 100644
index 0000000..9c03893
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/the_president_europarl_europa_eu.yaml
@@ -0,0 +1,22 @@
+name: the_president_europarl_europa_eu
+domain: the-president.europarl.europa.eu
+field: law-government
+request:
+ url: https://the-president.europarl.europa.eu/
+ params:
+ s: "{query}"
+response:
+ format: html
+ results: "article"
+ base_url: https://the-president.europarl.europa.eu
+ fields:
+ title:
+ selector: "h2 a"
+ url:
+ selector: "h2 a"
+ attr: href
+ extract:
+ selector: "p"
+smoke:
+ query: parliament
+ expect_title_contains: parliament
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/thebulletin_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/thebulletin_org.yaml
new file mode 100644
index 0000000..7461ab1
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/thebulletin_org.yaml
@@ -0,0 +1,17 @@
+name: thebulletin_org
+domain: thebulletin.org
+field: news-politics
+request:
+ url: https://thebulletin.org/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/thehill_com.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/thehill_com.yaml
new file mode 100644
index 0000000..35ca900
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/thehill_com.yaml
@@ -0,0 +1,17 @@
+name: thehill_com
+domain: thehill.com
+field: news-politics
+request:
+ url: https://thehill.com/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/towardsdatascience_com.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/towardsdatascience_com.yaml
new file mode 100644
index 0000000..b39a094
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/towardsdatascience_com.yaml
@@ -0,0 +1,17 @@
+name: towardsdatascience_com
+domain: towardsdatascience.com
+field: programming
+request:
+ url: https://towardsdatascience.com/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/usa_streetsblog_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/usa_streetsblog_org.yaml
new file mode 100644
index 0000000..5a63cc0
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/usa_streetsblog_org.yaml
@@ -0,0 +1,17 @@
+name: usa_streetsblog_org
+domain: usa.streetsblog.org
+field: news-politics
+request:
+ url: https://usa.streetsblog.org/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/users_rust_lang_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/users_rust_lang_org.yaml
new file mode 100644
index 0000000..34cbfeb
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/users_rust_lang_org.yaml
@@ -0,0 +1,17 @@
+name: users_rust_lang_org
+domain: users.rust-lang.org
+field: programming
+request:
+ url: https://users.rust-lang.org/search.json
+ params:
+ q: '{query}'
+response:
+ format: json
+ results: topics
+ fields:
+ title: title
+ url:
+ template: https://users.rust-lang.org/t/{slug}/{id}
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/waxy_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/waxy_org.yaml
new file mode 100644
index 0000000..2d4d712
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/waxy_org.yaml
@@ -0,0 +1,17 @@
+name: waxy_org
+domain: waxy.org
+field: tech
+request:
+ url: https://waxy.org/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/wiki_archiveteam_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/wiki_archiveteam_org.yaml
new file mode 100644
index 0000000..9d7a66b
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/wiki_archiveteam_org.yaml
@@ -0,0 +1,24 @@
+name: wiki_archiveteam_org
+domain: wiki.archiveteam.org
+field: tech
+request:
+ url: https://wiki.archiveteam.org/api.php
+ params:
+ action: query
+ list: search
+ format: json
+ srsearch: '{query}'
+ srlimit: '{limit}'
+response:
+ format: json
+ results: query.search
+ fields:
+ title: title
+ extract: snippet
+ url:
+ template: https://wiki.archiveteam.org/wiki/{title}
+ strip_html:
+ - extract
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/wiki_archlinux_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/wiki_archlinux_org.yaml
new file mode 100644
index 0000000..6473327
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/wiki_archlinux_org.yaml
@@ -0,0 +1,24 @@
+name: wiki_archlinux_org
+domain: wiki.archlinux.org
+field: tech
+request:
+ url: https://wiki.archlinux.org/api.php
+ params:
+ action: query
+ list: search
+ format: json
+ srsearch: '{query}'
+ srlimit: '{limit}'
+response:
+ format: json
+ results: query.search
+ fields:
+ title: title
+ extract: snippet
+ url:
+ template: https://wiki.archlinux.org/wiki/{title}
+ strip_html:
+ - extract
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/wikisource_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/wikisource_org.yaml
new file mode 100644
index 0000000..549e6ff
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/wikisource_org.yaml
@@ -0,0 +1,24 @@
+name: wikisource_org
+domain: wikisource.org
+field: books-literature
+request:
+ url: https://wikisource.org/w/api.php
+ params:
+ action: query
+ list: search
+ format: json
+ srsearch: "{query}"
+ srlimit: "{limit}"
+response:
+ format: json
+ results: query.search
+ fields:
+ title: title
+ extract: snippet
+ url:
+ template: "https://wikisource.org/wiki/{title}"
+ strip_html:
+ - extract
+smoke:
+ query: frankenstein
+ expect_title_contains: Frankenstein
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/www_centauri_dreams_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/www_centauri_dreams_org.yaml
new file mode 100644
index 0000000..c1220b1
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/www_centauri_dreams_org.yaml
@@ -0,0 +1,17 @@
+name: www_centauri_dreams_org
+domain: www.centauri-dreams.org
+field: science
+request:
+ url: https://www.centauri-dreams.org/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: science
+ expect_title_contains: science
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/www_cis_upenn_edu.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/www_cis_upenn_edu.yaml
new file mode 100644
index 0000000..171ed9b
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/www_cis_upenn_edu.yaml
@@ -0,0 +1,17 @@
+name: www_cis_upenn_edu
+domain: www.cis.upenn.edu
+field: programming
+request:
+ url: https://www.cis.upenn.edu/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: science
+ expect_title_contains: science
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/www_hcn_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/www_hcn_org.yaml
new file mode 100644
index 0000000..ac62bb9
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/www_hcn_org.yaml
@@ -0,0 +1,17 @@
+name: www_hcn_org
+domain: www.hcn.org
+field: news-politics
+request:
+ url: https://www.hcn.org/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/www_johndcook_com.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/www_johndcook_com.yaml
new file mode 100644
index 0000000..c5c5dea
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/www_johndcook_com.yaml
@@ -0,0 +1,17 @@
+name: www_johndcook_com
+domain: www.johndcook.com
+field: programming
+request:
+ url: https://www.johndcook.com/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/www_loopinsight_com.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/www_loopinsight_com.yaml
new file mode 100644
index 0000000..3897b81
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/www_loopinsight_com.yaml
@@ -0,0 +1,17 @@
+name: www_loopinsight_com
+domain: www.loopinsight.com
+field: tech
+request:
+ url: https://www.loopinsight.com/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/www_math_columbia_edu.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/www_math_columbia_edu.yaml
new file mode 100644
index 0000000..aec98ac
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/www_math_columbia_edu.yaml
@@ -0,0 +1,17 @@
+name: www_math_columbia_edu
+domain: www.math.columbia.edu
+field: academia
+request:
+ url: https://www.math.columbia.edu/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: research
+ expect_title_contains: research
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/www_medievalists_net.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/www_medievalists_net.yaml
new file mode 100644
index 0000000..b06a50f
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/www_medievalists_net.yaml
@@ -0,0 +1,20 @@
+name: www_medievalists_net
+domain: www.medievalists.net
+field: history
+request:
+ url: https://www.medievalists.net/wp-json/wp/v2/posts
+ params:
+ search: "{query}"
+ per_page: "{limit}"
+response:
+ format: json
+ results: ""
+ fields:
+ title: title.rendered
+ extract: excerpt.rendered
+ url: link
+ strip_html:
+ - extract
+smoke:
+ query: medieval
+ expect_title_contains: medieval
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/www_motherjones_com.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/www_motherjones_com.yaml
new file mode 100644
index 0000000..1e0d19e
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/www_motherjones_com.yaml
@@ -0,0 +1,17 @@
+name: www_motherjones_com
+domain: www.motherjones.com
+field: news-politics
+request:
+ url: https://www.motherjones.com/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/www_nybooks_com.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/www_nybooks_com.yaml
new file mode 100644
index 0000000..1306e5c
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/www_nybooks_com.yaml
@@ -0,0 +1,17 @@
+name: www_nybooks_com
+domain: www.nybooks.com
+field: books-literature
+request:
+ url: https://www.nybooks.com/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/www_pewresearch_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/www_pewresearch_org.yaml
new file mode 100644
index 0000000..7a58ddc
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/www_pewresearch_org.yaml
@@ -0,0 +1,17 @@
+name: www_pewresearch_org
+domain: www.pewresearch.org
+field: news-politics
+request:
+ url: https://www.pewresearch.org/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/www_popsci_com.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/www_popsci_com.yaml
new file mode 100644
index 0000000..a445551
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/www_popsci_com.yaml
@@ -0,0 +1,17 @@
+name: www_popsci_com
+domain: www.popsci.com
+field: science
+request:
+ url: https://www.popsci.com/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: science
+ expect_title_contains: science
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/www_poynter_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/www_poynter_org.yaml
new file mode 100644
index 0000000..6e5d683
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/www_poynter_org.yaml
@@ -0,0 +1,17 @@
+name: www_poynter_org
+domain: www.poynter.org
+field: news-politics
+request:
+ url: https://www.poynter.org/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/www_sciencenews_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/www_sciencenews_org.yaml
new file mode 100644
index 0000000..57f4f26
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/www_sciencenews_org.yaml
@@ -0,0 +1,17 @@
+name: www_sciencenews_org
+domain: www.sciencenews.org
+field: science
+request:
+ url: https://www.sciencenews.org/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: science
+ expect_title_contains: science
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/www_sigarch_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/www_sigarch_org.yaml
new file mode 100644
index 0000000..587d295
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/www_sigarch_org.yaml
@@ -0,0 +1,17 @@
+name: www_sigarch_org
+domain: www.sigarch.org
+field: programming
+request:
+ url: https://www.sigarch.org/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/www_sigops_org.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/www_sigops_org.yaml
new file mode 100644
index 0000000..cd18d3c
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/www_sigops_org.yaml
@@ -0,0 +1,17 @@
+name: www_sigops_org
+domain: www.sigops.org
+field: programming
+request:
+ url: https://www.sigops.org/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: history
+ expect_title_contains: history
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/www_stanford_edu.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/www_stanford_edu.yaml
new file mode 100644
index 0000000..1815234
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/www_stanford_edu.yaml
@@ -0,0 +1,17 @@
+name: www_stanford_edu
+domain: www.stanford.edu
+field: academia
+request:
+ url: https://www.stanford.edu/wp-json/wp/v2/search
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title
+ url: url
+smoke:
+ query: research
+ expect_title_contains: research
diff --git a/mwmbl/tinysearchengine/super_search_sources/recipes/www_thestranger_com.yaml b/mwmbl/tinysearchengine/super_search_sources/recipes/www_thestranger_com.yaml
new file mode 100644
index 0000000..f7f66e6
--- /dev/null
+++ b/mwmbl/tinysearchengine/super_search_sources/recipes/www_thestranger_com.yaml
@@ -0,0 +1,21 @@
+name: www_thestranger_com
+domain: www.thestranger.com
+field: news-politics
+request:
+ url: https://www.thestranger.com/wp-json/wp/v2/posts
+ params:
+ search: '{query}'
+ per_page: '{limit}'
+response:
+ format: json
+ results: ''
+ fields:
+ title: title.rendered
+ extract: excerpt.rendered
+ url: link
+ strip_html:
+ - title
+ - extract
+smoke:
+ query: world
+ expect_title_contains: world
diff --git a/scripts/auto_recipe.py b/scripts/auto_recipe.py
new file mode 100644
index 0000000..92f49ad
--- /dev/null
+++ b/scripts/auto_recipe.py
@@ -0,0 +1,241 @@
+#!/usr/bin/env python3
+"""Deterministically auto-generate Super Search recipes for a list of domains.
+
+Instead of dispatching an agent per site (which writes throwaway probe scripts
+and needs manual approval, with a near-zero pass rate), this brute-forces the
+handful of *formulaic* search endpoints that account for essentially every
+recipe we have ever landed:
+
+ 1. WordPress REST search GET /wp-json/wp/v2/search?search=&per_page=
+ 2. WordPress REST posts GET /wp-json/wp/v2/posts?search=&per_page=
+ 3. MediaWiki API GET /w/api.php?action=query&list=search&srsearch=
+ GET /api.php?... (fallback path)
+ 4. Discourse GET /search.json?q=
+
+For each domain it tries each template with a few generic probe queries. A
+template "passes" when it returns >= MIN_RESULTS results AND some probe word is
+echoed in a result title -- which makes the written recipe's smoke block
+(query = that word, expect_title_contains = that word) self-consistent, so the
+output passes scripts/smoke_recipe.py and test_super_search_recipes.py unchanged.
+
+The first passing template wins; its YAML is written to recipes/<name>.yaml.
+Existing recipes are never overwritten.
+
+Usage:
+ DATABASE_URL="postgres://daoud@" uv run python scripts/auto_recipe.py \
+ recipe_chunks/input_000.json recipe_chunks/input_001.json ...
+ DATABASE_URL="postgres://daoud@" uv run python scripts/auto_recipe.py --all
+"""
+from __future__ import annotations
+
+import argparse
+import asyncio
+import json
+import os
+import sys
+from pathlib import Path
+
+REPO_ROOT = Path(__file__).resolve().parent.parent
+sys.path.insert(0, str(REPO_ROOT))
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mwmbl.settings_dev")
+
+import django # noqa: E402
+import logging # noqa: E402
+
+django.setup()
+logging.getLogger("httpx").setLevel(logging.WARNING)
+logging.getLogger("mwmbl.tinysearchengine.super_search_sources.recipe").setLevel(
+ logging.ERROR)
+
+import httpx # noqa: E402
+import yaml # noqa: E402
+
+from mwmbl.tinysearchengine.super_search_sources.recipe import ( # noqa: E402
+ Recipe,
+ search_with_recipe,
+)
+
+RECIPES_DIR = REPO_ROOT / "mwmbl" / "tinysearchengine" / "super_search_sources" / "recipes"
+CHUNKS_DIR = REPO_ROOT / "recipe_chunks"
+
+MIN_RESULTS = 3
+CONCURRENCY = 16
+TIMEOUT = 12.0
+
+# A primary probe word per field (more likely to be echoed in that field's
+# result titles), then generic fallbacks. Capped per domain to bound requests.
+FIELD_WORD = {
+ "academia": "research",
+ "art-design": "design",
+ "books-literature": "book",
+ "business-finance": "business",
+ "education": "learning",
+ "gaming": "game",
+ "history": "history",
+ "science": "science",
+ "technology": "technology",
+ "health": "health",
+ "news": "news",
+ "music": "music",
+ "food": "food",
+ "sports": "sport",
+ "law-politics": "law",
+ "environment": "climate",
+ "travel": "travel",
+}
+GENERIC_WORDS = ["history", "science", "music", "design", "world", "data"]
+
+
+def _name(domain: str) -> str:
+ return "".join(c if c.isalnum() else "_" for c in domain)
+
+
+def _probe_words(field: str) -> list[str]:
+ words = []
+ primary = FIELD_WORD.get(field)
+ if primary:
+ words.append(primary)
+ for w in GENERIC_WORDS:
+ if w not in words:
+ words.append(w)
+ return words[:5]
+
+
+def _templates(domain: str) -> list[tuple[str, dict, dict]]:
+ """Return (label, request, response) candidate recipe pieces for a domain."""
+ base = f"https://{domain}"
+ return [
+ (
+ "wp-search",
+ {"url": f"{base}/wp-json/wp/v2/search",
+ "params": {"search": "{query}", "per_page": "{limit}"}},
+ {"format": "json", "results": "",
+ "fields": {"title": "title", "url": "url"}},
+ ),
+ (
+ "wp-posts",
+ {"url": f"{base}/wp-json/wp/v2/posts",
+ "params": {"search": "{query}", "per_page": "{limit}"}},
+ {"format": "json", "results": "",
+ "fields": {"title": "title.rendered", "extract": "excerpt.rendered",
+ "url": "link"},
+ "strip_html": ["title", "extract"]},
+ ),
+ (
+ "mediawiki",
+ {"url": f"{base}/w/api.php",
+ "params": {"action": "query", "list": "search", "format": "json",
+ "srsearch": "{query}", "srlimit": "{limit}"}},
+ {"format": "json", "results": "query.search",
+ "fields": {"title": "title", "extract": "snippet",
+ "url": {"template": f"{base}/wiki/{{title}}"}},
+ "strip_html": ["extract"]},
+ ),
+ (
+ "mediawiki-root",
+ {"url": f"{base}/api.php",
+ "params": {"action": "query", "list": "search", "format": "json",
+ "srsearch": "{query}", "srlimit": "{limit}"}},
+ {"format": "json", "results": "query.search",
+ "fields": {"title": "title", "extract": "snippet",
+ "url": {"template": f"{base}/wiki/{{title}}"}},
+ "strip_html": ["extract"]},
+ ),
+ (
+ "discourse",
+ {"url": f"{base}/search.json", "params": {"q": "{query}"}},
+ {"format": "json", "results": "topics",
+ "fields": {"title": "title",
+ "url": {"template": f"{base}/t/{{slug}}/{{id}}"}}},
+ ),
+ ]
+
+
+async def _probe_domain(client: httpx.AsyncClient, entry: dict) -> dict:
+ domain = entry["name"]
+ field = entry.get("field", "")
+ name = _name(domain)
+ if (RECIPES_DIR / f"{name}.yaml").exists():
+ return {"domain": domain, "status": "exists"}
+
+ words = _probe_words(field)
+ for label, request, response in _templates(domain):
+ recipe = Recipe(name=name, request=request, response=response,
+ domain=domain, field=field)
+ for word in words:
+ try:
+ docs = await search_with_recipe(client, recipe, word, 10)
+ except Exception: # noqa: BLE001
+ docs = []
+ if len(docs) < MIN_RESULTS:
+ # Pattern's endpoint clearly absent/broken -> stop trying words.
+ if not docs:
+ break
+ continue
+ if any(word in (d.title or "").lower() for d in docs):
+ doc = {
+ "name": name,
+ "domain": domain,
+ "field": field,
+ "request": request,
+ "response": response,
+ "smoke": {"query": word, "expect_title_contains": word},
+ }
+ (RECIPES_DIR / f"{name}.yaml").write_text(
+ yaml.safe_dump(doc, sort_keys=False, allow_unicode=True))
+ return {"domain": domain, "status": "pass",
+ "label": label, "word": word, "n": len(docs)}
+ return {"domain": domain, "status": "fail"}
+
+
+async def _run(entries: list[dict]) -> list[dict]:
+ sem = asyncio.Semaphore(CONCURRENCY)
+ async with httpx.AsyncClient(
+ follow_redirects=True, timeout=TIMEOUT,
+ headers={"User-Agent": "mwmbl-super-search-smoke/0.1 (+https://mwmbl.org)"},
+ ) as client:
+ async def guarded(entry):
+ async with sem:
+ return await _probe_domain(client, entry)
+ return await asyncio.gather(*[guarded(e) for e in entries])
+
+
+def _load_entries(paths: list[str]) -> list[dict]:
+ entries, seen = [], set()
+ for p in paths:
+ for entry in json.loads(Path(p).read_text()):
+ if entry["name"] not in seen:
+ seen.add(entry["name"])
+ entries.append(entry)
+ return entries
+
+
+def main() -> int:
+ ap = argparse.ArgumentParser()
+ ap.add_argument("batches", nargs="*", help="batch JSON files")
+ ap.add_argument("--all", action="store_true",
+ help="process every recipe_chunks/input_*.json")
+ args = ap.parse_args()
+
+ paths = sorted(str(p) for p in CHUNKS_DIR.glob("input_*.json")) if args.all \
+ else args.batches
+ if not paths:
+ print("no batch files given (use --all or list files)", file=sys.stderr)
+ return 2
+
+ entries = _load_entries(paths)
+ print(f"Probing {len(entries)} domains from {len(paths)} batch file(s)...")
+ results = asyncio.run(_run(entries))
+
+ passes = [r for r in results if r["status"] == "pass"]
+ exists = [r for r in results if r["status"] == "exists"]
+ for r in passes:
+ print(f"PASS {r['domain']} ({r['label']}, q={r['word']!r}, {r['n']} results)")
+ print(f"\n{len(passes)} passed, {len(exists)} already existed, "
+ f"{len(results) - len(passes) - len(exists)} failed "
+ f"(of {len(results)} domains).")
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/scripts/build_super_search_candidates.py b/scripts/build_super_search_candidates.py
index 917e6f1..6e45f82 100644
--- a/scripts/build_super_search_candidates.py
+++ b/scripts/build_super_search_candidates.py
@@ -282,6 +282,49 @@ def _select_diverse(entries, count):
return selected
+# Recipes that existed before the first fan-out (used to reconstruct exactly
+# which 140 sites the first `select_targets` run attempted).
+_ORIGINAL_RECIPE_DOMAINS = {"archive.org", "www.gutenberg.org", "en.wiktionary.org"}
+REMAINING_BATCH_SIZE = 7
+
+
+def cmd_select_remaining():
+ """Select every still-uncovered shortlist site NOT attempted in the first
+ `select_targets` run, batched for a second recipe sub-agent fan-out."""
+ path = DEVDATA_SHORTLIST if DEVDATA_SHORTLIST.exists() else SHORTLIST
+ if not path.exists():
+ print("No shortlist found; run `shortlist` first.", file=sys.stderr)
+ return 1
+ entries = json.loads(path.read_text())["domains"]
+
+ # Reconstruct the first run's 140 attempted sites deterministically: same
+ # diverse selection over the pool as it was BEFORE any recipes were authored.
+ original_covered = set(ADAPTER_DOMAINS) | _ORIGINAL_RECIPE_DOMAINS
+ orig_uncovered = [e for e in entries if e["name"] not in original_covered]
+ attempted = {e["name"] for e in _select_diverse(orig_uncovered, TARGET_COUNT)}
+
+ covered_now = _covered_domains()
+ remaining = [e for e in entries
+ if e["name"] not in covered_now and e["name"] not in attempted]
+ remaining = _select_diverse(remaining, len(remaining)) # field-interleaved order
+
+ TARGETS.write_text(json.dumps({"domains": remaining}, indent=2, ensure_ascii=False) + "\n")
+ RECIPE_CHUNK_DIR.mkdir(exist_ok=True)
+ for old in RECIPE_CHUNK_DIR.glob("input_*.json"):
+ old.unlink()
+ n_batches = 0
+ for i in range(0, len(remaining), REMAINING_BATCH_SIZE):
+ batch = remaining[i:i + REMAINING_BATCH_SIZE]
+ (RECIPE_CHUNK_DIR / f"input_{i // REMAINING_BATCH_SIZE:03d}.json").write_text(
+ json.dumps(batch, indent=2, ensure_ascii=False)
+ )
+ n_batches += 1
+ print(f"Remaining uncovered, not-yet-attempted: {len(remaining)} sites "
+ f"({len(covered_now)} covered, {len(attempted)} already attempted).")
+ print(f"Wrote {n_batches} batches (size {REMAINING_BATCH_SIZE}) in {RECIPE_CHUNK_DIR}.")
+ return 0
+
+
def cmd_select_targets():
"""Pick ~TARGET_COUNT shortlist sites needing a recipe, batched for sub-agents."""
path = DEVDATA_SHORTLIST if DEVDATA_SHORTLIST.exists() else SHORTLIST
@@ -319,7 +362,8 @@ def cmd_select_targets():
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
- "command", choices=["prepare", "merge", "shortlist", "select_targets"]
+ "command",
+ choices=["prepare", "merge", "shortlist", "select_targets", "select_remaining"],
)
args = parser.parse_args()
if args.command == "prepare":
@@ -329,6 +373,8 @@ def main():
return cmd_shortlist()
if args.command == "select_targets":
return cmd_select_targets()
+ if args.command == "select_remaining":
+ return cmd_select_remaining()
return cmd_merge()
diff --git a/scripts/fetch_url.py b/scripts/fetch_url.py
new file mode 100644
index 0000000..594358f
--- /dev/null
+++ b/scripts/fetch_url.py
@@ -0,0 +1,68 @@
+#!/usr/bin/env python3
+"""Fetch a URL with the SAME httpx client the Super Search recipe engine uses.
+
+This is the discovery tool for the two-stage recipe authoring flow. WebFetch is
+often bot-blocked (403/Cloudflare) even when the real engine (plain httpx with a
+simple User-Agent) succeeds, which previously pushed agents into writing
+throwaway probe scripts (each one a fresh approval prompt). This is ONE fixed,
+GET-only command instead: allowlist it once and the discovery agent can probe
+candidate search URLs freely, seeing exactly what the recipe engine will see.
+
+Prints the HTTP status, final URL, content-type, and the (truncated) body. For
+JSON it pretty-prints so the response shape is obvious to a recipe author.
+
+Usage:
+ uv run python scripts/fetch_url.py "https://example.com/search?q=test"
+ uv run python scripts/fetch_url.py "https://example.com/api?q=test" --max-chars 12000
+"""
+from __future__ import annotations
+
+import argparse
+import asyncio
+import json
+import sys
+
+import httpx
+
+# Mirror scripts/smoke_recipe.py so discovery matches what the engine will do.
+ENGINE_HEADERS = {"User-Agent": "mwmbl-super-search-smoke/0.1 (+https://mwmbl.org)"}
+TIMEOUT = 15.0
+
+
+async def _fetch(url: str, max_chars: int) -> int:
+ try:
+ async with httpx.AsyncClient(
+ follow_redirects=True, timeout=TIMEOUT, headers=ENGINE_HEADERS,
+ ) as client:
+ r = await client.get(url)
+ except Exception as e: # noqa: BLE001
+ print(f"FETCH-ERROR: {e!r}")
+ return 1
+
+ ctype = r.headers.get("content-type", "")
+ print(f"HTTP {r.status_code} final-url: {r.url}")
+ print(f"content-type: {ctype}")
+ print(f"length: {len(r.text)} chars\n---")
+
+ body = r.text
+ if "json" in ctype.lower():
+ try:
+ body = json.dumps(r.json(), indent=2, ensure_ascii=False)
+ except ValueError:
+ pass
+ if len(body) > max_chars:
+ body = body[:max_chars] + f"\n... [truncated {len(body) - max_chars} chars]"
+ print(body)
+ return 0
+
+
+def main() -> int:
+ ap = argparse.ArgumentParser()
+ ap.add_argument("url")
+ ap.add_argument("--max-chars", type=int, default=6000)
+ args = ap.parse_args()
+ return asyncio.run(_fetch(args.url, args.max_chars))
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/scripts/prescreen_sites.py b/scripts/prescreen_sites.py
new file mode 100644
index 0000000..eb16a37
--- /dev/null
+++ b/scripts/prescreen_sites.py
@@ -0,0 +1,173 @@
+#!/usr/bin/env python3
+"""Pre-screen candidate domains: detect bot-blocking and harvest search URLs.
+
+Stage 0 of recipe authoring. For each domain (read from recipe_chunks batches),
+fetch the homepage ONCE with the same httpx client the recipe engine uses, then:
+
+ * classify it as ``blocked`` (Cloudflare / 403 / 429 / challenge page),
+ ``error`` (DNS / timeout / connection), or ``ok``;
+ * for ``ok`` sites, harvest candidate search-URL templates the site itself
+ advertises -- an OpenSearch ``<link>`` descriptor (standardised
+ ``template="...{searchTerms}..."``) and any ``<form>`` whose action looks
+ like a search -- so a later stage can try the site's OWN search endpoint
+ instead of only the formulaic API guesses the brute-forcer already covered.
+
+Blocked sites are given up on immediately (they'd fail the production engine's
+client too, so any recipe would fail its smoke gate anyway). The output JSON
+feeds the generation stage with only reachable sites + concrete URL candidates.
+
+Skips domains that already have a recipe. Runs entirely in the main thread.
+
+Usage:
+ uv run python scripts/prescreen_sites.py --all --out prescreen.json
+"""
+from __future__ import annotations
+
+import argparse
+import asyncio
+import json
+import sys
+from pathlib import Path
+from urllib.parse import urljoin
+
+import httpx
+from bs4 import BeautifulSoup
+
+REPO_ROOT = Path(__file__).resolve().parent.parent
+RECIPES_DIR = REPO_ROOT / "mwmbl" / "tinysearchengine" / "super_search_sources" / "recipes"
+CHUNKS_DIR = REPO_ROOT / "recipe_chunks"
+
+ENGINE_HEADERS = {"User-Agent": "mwmbl-super-search-smoke/0.1 (+https://mwmbl.org)"}
+TIMEOUT = 15.0
+CONCURRENCY = 16
+
+# Substrings that mark a bot-challenge / block page (lowercased body match).
+BLOCK_MARKERS = (
+ "just a moment", "checking your browser", "attention required",
+ "cf-chl", "cf-challenge", "enable javascript and cookies",
+ "ddos protection by", "access denied", "request unsuccessful",
+ "are you a robot", "captcha-delivery", "px-captcha",
+)
+BLOCK_STATUSES = {401, 403, 405, 406, 429, 503}
+SEARCH_INPUT_NAMES = {"q", "s", "query", "search", "keyword", "keywords", "term", "k"}
+
+
+def _name(domain: str) -> str:
+ return "".join(c if c.isalnum() else "_" for c in domain)
+
+
+def _classify(status: int, body: str) -> str:
+ if status in BLOCK_STATUSES:
+ return "blocked"
+ low = body[:4000].lower()
+ if any(m in low for m in BLOCK_MARKERS):
+ return "blocked"
+ return "ok"
+
+
+def _harvest(base: str, html: str) -> dict:
+ """Pull OpenSearch descriptor + search-form action(s) from a homepage."""
+ soup = BeautifulSoup(html, "html.parser")
+ opensearch = None
+ for link in soup.find_all("link"):
+ rels = {r.lower() for r in (link.get("rel") or [])}
+ type_ = (link.get("type") or "").lower()
+ if "search" in rels or "opensearchdescription" in type_:
+ href = link.get("href")
+ if href:
+ opensearch = urljoin(base, href)
+ break
+
+ forms = []
+ for form in soup.find_all("form"):
+ action = form.get("action") or ""
+ names = {(i.get("name") or "").lower() for i in form.find_all("input")}
+ hit = names & SEARCH_INPUT_NAMES
+ looks_search = "search" in action.lower() or "search" in (form.get("id", "") +
+ form.get("class", [""])[0]).lower()
+ if hit or (looks_search and names):
+ field = next(iter(hit)) if hit else "q"
+ forms.append({"action": urljoin(base, action or "/"), "param": field})
+ # De-dup forms by (action, param).
+ seen, uniq = set(), []
+ for f in forms:
+ key = (f["action"], f["param"])
+ if key not in seen:
+ seen.add(key)
+ uniq.append(f)
+ return {"opensearch": opensearch, "forms": uniq[:4]}
+
+
+async def _screen(client: httpx.AsyncClient, entry: dict) -> dict:
+ domain = entry["name"]
+ if (RECIPES_DIR / f"{_name(domain)}.yaml").exists():
+ return {"domain": domain, "status": "exists"}
+ base = f"https://{domain}/"
+ try:
+ r = await client.get(base)
+ except Exception as e: # noqa: BLE001
+ return {"domain": domain, "status": "error", "detail": repr(e)[:120]}
+ cls = _classify(r.status_code, r.text)
+ out = {"domain": domain, "field": entry.get("field", ""),
+ "status": cls, "http": r.status_code}
+ if cls == "ok":
+ out.update(_harvest(str(r.url), r.text))
+ return out
+
+
+async def _run(entries: list[dict]) -> list[dict]:
+ sem = asyncio.Semaphore(CONCURRENCY)
+ async with httpx.AsyncClient(follow_redirects=True, timeout=TIMEOUT,
+ headers=ENGINE_HEADERS) as client:
+ async def guarded(e):
+ async with sem:
+ return await _screen(client, e)
+ return await asyncio.gather(*[guarded(e) for e in entries])
+
+
+def _load_entries(paths: list[str]) -> list[dict]:
+ entries, seen = [], set()
+ for p in paths:
+ for entry in json.loads(Path(p).read_text()):
+ if entry["name"] not in seen:
+ seen.add(entry["name"])
+ entries.append(entry)
+ return entries
+
+
+def main() -> int:
+ ap = argparse.ArgumentParser()
+ ap.add_argument("batches", nargs="*")
+ ap.add_argument("--all", action="store_true")
+ ap.add_argument("--out", default="prescreen.json")
+ args = ap.parse_args()
+
+ paths = sorted(str(p) for p in CHUNKS_DIR.glob("input_*.json")) if args.all \
+ else args.batches
+ if not paths:
+ print("no batch files (use --all or list files)", file=sys.stderr)
+ return 2
+
+ entries = _load_entries(paths)
+ print(f"Screening {len(entries)} domains...")
+ results = asyncio.run(_run(entries))
+
+ by = {}
+ for r in results:
+ by.setdefault(r["status"], []).append(r)
+ reachable = by.get("ok", [])
+ with_search = [r for r in reachable if r.get("opensearch") or r.get("forms")]
+ Path(args.out).write_text(json.dumps(results, indent=2))
+
+ print(f"\n ok/reachable : {len(reachable)} "
+ f"(of which {len(with_search)} expose an OpenSearch/form search URL)")
+ print(f" blocked : {len(by.get('blocked', []))}")
+ print(f" error : {len(by.get('error', []))}")
+ print(f" already exist: {len(by.get('exists', []))}")
+ print(f"\nWrote {args.out}. Reachable sites with a discoverable search URL "
+ f"are the worthwhile targets for the generation stage.")
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())