search-web-api 1.0.76 → 1.0.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/README.md +0 -3
  2. package/bun.lock +644 -0
  3. package/package.json +5 -2
  4. package/src/search/__tests__/public-searxng.test.ts +37 -17
  5. package/src/sources/academic/arxiv.ts +3 -0
  6. package/src/sources/academic/core.ts +3 -0
  7. package/src/sources/academic/crossref.ts +3 -0
  8. package/src/sources/academic/doaj.ts +3 -0
  9. package/src/sources/academic/google_scholar.ts +3 -0
  10. package/src/sources/academic/openalex.ts +3 -0
  11. package/src/sources/academic/pubmed.ts +3 -0
  12. package/src/sources/academic/semantic_scholar.ts +3 -0
  13. package/src/sources/academic/wikidata.ts +3 -0
  14. package/src/sources/general/baidu.ts +3 -0
  15. package/src/sources/general/bing.ts +3 -0
  16. package/src/sources/general/brave.ts +3 -0
  17. package/src/sources/general/duckduckgo.ts +3 -0
  18. package/src/sources/general/google.ts +3 -0
  19. package/src/sources/general/mojeek.ts +3 -0
  20. package/src/sources/general/qwant.ts +3 -0
  21. package/src/sources/general/startpage.ts +3 -0
  22. package/src/sources/general/yahoo.ts +3 -0
  23. package/src/sources/general/yandex.ts +3 -0
  24. package/src/sources/images/bing_images.ts +3 -0
  25. package/src/sources/images/deviantart.ts +3 -0
  26. package/src/sources/images/flickr.ts +3 -0
  27. package/src/sources/images/google_images.ts +3 -0
  28. package/src/sources/images/imgur.ts +3 -0
  29. package/src/sources/images/openclipart.ts +3 -0
  30. package/src/sources/images/pixabay.ts +3 -0
  31. package/src/sources/images/unsplash.ts +3 -0
  32. package/src/sources/images/wallhaven.ts +3 -0
  33. package/src/sources/it/crates.ts +3 -0
  34. package/src/sources/it/dockerhub.ts +3 -0
  35. package/src/sources/it/github.ts +3 -0
  36. package/src/sources/it/gitlab.ts +3 -0
  37. package/src/sources/it/npm.ts +3 -0
  38. package/src/sources/it/packagist.ts +3 -0
  39. package/src/sources/it/pypi.ts +3 -0
  40. package/src/sources/it/rubygems.ts +3 -0
  41. package/src/sources/it/stackoverflow.ts +3 -0
  42. package/src/sources/maps/apple_maps.ts +3 -0
  43. package/src/sources/maps/openstreetmap.ts +3 -0
  44. package/src/sources/maps/photon.ts +3 -0
  45. package/src/sources/news/bing_news.ts +3 -0
  46. package/src/sources/news/google_news.ts +3 -0
  47. package/src/sources/news/hackernews.ts +3 -0
  48. package/src/sources/news/yahoo_news.ts +3 -0
  49. package/src/sources/shopping/ebay.ts +3 -0
  50. package/src/sources/social/mastodon.ts +3 -0
  51. package/src/sources/social/medium.ts +3 -0
  52. package/src/sources/social/reddit.ts +3 -0
  53. package/src/sources/social/soundcloud.ts +3 -0
  54. package/src/sources/social/twitter.ts +3 -0
  55. package/src/sources/specialized/annas_archive.ts +3 -0
  56. package/src/sources/specialized/archive.ts +3 -0
  57. package/src/sources/specialized/genius.ts +3 -0
  58. package/src/sources/specialized/goodreads.ts +3 -0
  59. package/src/sources/specialized/imdb.ts +3 -0
  60. package/src/sources/specialized/openlibrary.ts +3 -0
  61. package/src/sources/specialized/wikipedia.ts +3 -0
  62. package/src/sources/specialized/wttr.ts +3 -0
  63. package/src/sources/torrents/1337x.ts +3 -0
  64. package/src/sources/torrents/eztv.ts +3 -0
  65. package/src/sources/torrents/kickass.ts +3 -0
  66. package/src/sources/torrents/nyaa.ts +3 -0
  67. package/src/sources/torrents/solidtorrents.ts +3 -0
  68. package/src/sources/torrents/thepiratebay.ts +3 -0
  69. package/src/sources/torrents/yts.ts +3 -0
  70. package/src/sources/videos/bing_videos.ts +3 -0
  71. package/src/sources/videos/dailymotion.ts +3 -0
  72. package/src/sources/videos/invidious.ts +3 -0
  73. package/src/sources/videos/peertube.ts +3 -0
  74. package/src/sources/videos/vimeo.ts +3 -0
  75. package/src/sources/videos/youtube.ts +3 -0
  76. package/src/suggest-next-words/autocomplete-ai.ts +41 -38
  77. package/src/types/search-engine-interface.ts +2 -2
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @fileoverview Engine adapter that scrapes Nyaa torrent search results.
3
+ */
1
4
  import { parseHTML } from "linkedom";
2
5
  import { EngineFunction } from "../../types/search-engine-interface.js";
3
6
 
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @fileoverview Engine adapter that scrapes SolidTorrents search results.
3
+ */
1
4
  import { parseHTML } from "linkedom";
2
5
  import { EngineFunction } from "../../types/search-engine-interface.js";
3
6
 
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @fileoverview Engine adapter that scrapes The Pirate Bay search results.
3
+ */
1
4
  import { parseHTML } from "linkedom";
2
5
  import { EngineFunction } from "../../types/search-engine-interface.js";
3
6
 
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @fileoverview Engine adapter that queries the YTS API for movie torrent search results.
3
+ */
1
4
  import { EngineFunction } from "../../types/search-engine-interface.js";
2
5
 
3
6
  export const yts: EngineFunction = async (
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @fileoverview Engine adapter that scrapes Bing Videos search results.
3
+ */
1
4
  import { parseHTML } from "linkedom";
2
5
  import { EngineFunction } from "../../types/search-engine-interface.js";
3
6
 
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @fileoverview Engine adapter that queries the Dailymotion API for video search results.
3
+ */
1
4
  import { EngineFunction } from "../../types/search-engine-interface.js";
2
5
 
3
6
  export const dailymotion: EngineFunction = async (
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @fileoverview Engine adapter that queries public Invidious instances for YouTube video search results.
3
+ */
1
4
  import { EngineFunction } from "../../types/search-engine-interface.js";
2
5
 
3
6
  // Public Invidious instances - user can configure their own
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @fileoverview Engine adapter that queries the PeerTube API for video search results.
3
+ */
1
4
  import { EngineFunction } from "../../types/search-engine-interface.js";
2
5
 
3
6
  export const peertube: EngineFunction = async (
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @fileoverview Engine adapter that queries the Vimeo API for video search results.
3
+ */
1
4
  import { EngineFunction } from "../../types/search-engine-interface.js";
2
5
 
3
6
  export const vimeo: EngineFunction = async (
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @fileoverview Engine adapter that queries YouTube video search via public Invidious instances, with fallback across multiple instances.
3
+ */
1
4
  import { EngineFunction } from "../../types/search-engine-interface.js";
2
5
 
3
6
  // Multiple Invidious instances for fallback
@@ -1,38 +1,41 @@
1
- import { pipeline, type TextGenerationSingle } from "@huggingface/transformers";
2
-
3
- /**
4
- * Generates the next words for a given prompt using a text generation model.
5
- *
6
- * The DistilGPT2 model is a distilled, smaller version of OpenAI's GPT-2, featuring
7
- * around 82 million parameters (~80MB), and available in Hugging Face Transformers
8
- * for efficient next word (next-token) prediction tasks in English text. It is
9
- * well-suited for sequence generation and can be used as a next word prediction
10
- * model with code similar to GPT2, but offers faster and lighter inference compared
11
- * GPT-2 (124M parameter) model, preserving most capabilities but running
12
- * significantly faster and requiring less memory.
13
- * @see https://huggingface.co/Xenova/distilgpt2
14
- * @param {string} prompt - The input prompt to complete.
15
- * @param {Object} [options] - Generation options.
16
- * @param {number} [options.maxTokens=16] - Maximum number of new tokens to generate.
17
- * @param {string} [options.model='Xenova/distilgpt2'] - The model identifier to use.
18
- * @returns {Promise<string>} - The generated text completions.
19
- */
20
- export async function predictNextWordsWithSmallLocalModel(
21
- prompt: string,
22
- { model = "Xenova/distilgpt2", maxTokens = 16, modelParams = {} } = {}
23
- ): Promise<string> {
24
- if (!prompt) throw new Error("Prompt is required");
25
- return (
26
- await (
27
- await pipeline("text-generation", model, {
28
- dtype: "fp16",
29
- device: "cpu",
30
- ...modelParams,
31
- })
32
- )(prompt, { max_new_tokens: maxTokens })
33
- )
34
- .map((res) => (res as TextGenerationSingle).generated_text)
35
- .join(" ")
36
- .replace(prompt, "")
37
- .trim();
38
- }
1
+ /**
2
+ * @fileoverview Local next-word prediction using the DistilGPT-2 model via Hugging Face Transformers.js.
3
+ */
4
+ import { pipeline, type TextGenerationSingle } from "@huggingface/transformers";
5
+
6
+ /**
7
+ * Generates the next words for a given prompt using a text generation model.
8
+ *
9
+ * The DistilGPT2 model is a distilled, smaller version of OpenAI's GPT-2, featuring
10
+ * around 82 million parameters (~80MB), and available in Hugging Face Transformers
11
+ * for efficient next word (next-token) prediction tasks in English text. It is
12
+ * well-suited for sequence generation and can be used as a next word prediction
13
+ * model with code similar to GPT2, but offers faster and lighter inference compared
14
+ * GPT-2 (124M parameter) model, preserving most capabilities but running
15
+ * significantly faster and requiring less memory.
16
+ * @see https://huggingface.co/Xenova/distilgpt2
17
+ * @param {string} prompt - The input prompt to complete.
18
+ * @param {Object} [options] - Generation options.
19
+ * @param {number} [options.maxTokens=16] - Maximum number of new tokens to generate.
20
+ * @param {string} [options.model='Xenova/distilgpt2'] - The model identifier to use.
21
+ * @returns {Promise<string>} - The generated text completions.
22
+ */
23
+ export async function predictNextWordsWithSmallLocalModel(
24
+ prompt: string,
25
+ { model = "Xenova/distilgpt2", maxTokens = 16, modelParams = {} } = {}
26
+ ): Promise<string> {
27
+ if (!prompt) throw new Error("Prompt is required");
28
+ return (
29
+ await (
30
+ await pipeline("text-generation", model, {
31
+ dtype: "fp16",
32
+ device: "cpu",
33
+ ...modelParams,
34
+ })
35
+ )(prompt, { max_new_tokens: maxTokens })
36
+ )
37
+ .map((res) => (res as TextGenerationSingle).generated_text)
38
+ .join(" ")
39
+ .replace(prompt, "")
40
+ .trim();
41
+ }
@@ -5,9 +5,9 @@
5
5
  * import `EngineFunction` and `EngineResult` from here.
6
6
  */
7
7
 
8
- import { EngineResult, Engine, EngineFunction } from "./search-result-types.js";
8
+ import type { EngineResult, Engine, EngineFunction } from "./search-result-types.js";
9
9
 
10
- export { EngineResult, Engine, EngineFunction };
10
+ export type { EngineResult, Engine, EngineFunction };
11
11
 
12
12
  /**
13
13
  * Extract the actual data from a grab-url response.