webscout 7.7__py3-none-any.whl → 7.8__py3-none-any.whl

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.

Potentially problematic release.


This version of webscout might be problematic. Click here for more details.

Files changed (121) hide show
  1. webscout/AIutel.py +2 -1
  2. webscout/Bard.py +14 -11
  3. webscout/DWEBS.py +431 -415
  4. webscout/Extra/autocoder/__init__.py +9 -9
  5. webscout/Extra/autocoder/autocoder_utiles.py +332 -194
  6. webscout/Extra/autocoder/rawdog.py +68 -9
  7. webscout/Extra/gguf.py +682 -682
  8. webscout/Provider/AI21.py +1 -1
  9. webscout/Provider/AISEARCH/DeepFind.py +2 -2
  10. webscout/Provider/AISEARCH/ISou.py +2 -2
  11. webscout/Provider/AISEARCH/felo_search.py +6 -6
  12. webscout/Provider/AISEARCH/genspark_search.py +1 -1
  13. webscout/Provider/Aitopia.py +292 -0
  14. webscout/Provider/AllenAI.py +1 -1
  15. webscout/Provider/Andi.py +3 -3
  16. webscout/Provider/C4ai.py +1 -1
  17. webscout/Provider/ChatGPTES.py +3 -5
  18. webscout/Provider/ChatGPTGratis.py +4 -4
  19. webscout/Provider/Chatify.py +2 -2
  20. webscout/Provider/Cloudflare.py +3 -2
  21. webscout/Provider/DARKAI.py +3 -2
  22. webscout/Provider/DeepSeek.py +2 -2
  23. webscout/Provider/Deepinfra.py +1 -1
  24. webscout/Provider/EDITEE.py +1 -1
  25. webscout/Provider/ElectronHub.py +178 -96
  26. webscout/Provider/ExaChat.py +310 -0
  27. webscout/Provider/Free2GPT.py +2 -2
  28. webscout/Provider/Gemini.py +5 -19
  29. webscout/Provider/GithubChat.py +1 -1
  30. webscout/Provider/Glider.py +4 -4
  31. webscout/Provider/Groq.py +3 -3
  32. webscout/Provider/HF_space/qwen_qwen2.py +1 -1
  33. webscout/Provider/HeckAI.py +1 -1
  34. webscout/Provider/HuggingFaceChat.py +1 -1
  35. webscout/Provider/Hunyuan.py +1 -1
  36. webscout/Provider/Jadve.py +3 -3
  37. webscout/Provider/Koboldai.py +3 -3
  38. webscout/Provider/LambdaChat.py +1 -1
  39. webscout/Provider/Llama.py +3 -5
  40. webscout/Provider/Llama3.py +4 -12
  41. webscout/Provider/Marcus.py +3 -3
  42. webscout/Provider/OLLAMA.py +8 -8
  43. webscout/Provider/Openai.py +7 -3
  44. webscout/Provider/PI.py +1 -1
  45. webscout/Provider/Perplexitylabs.py +1 -1
  46. webscout/Provider/Phind.py +1 -1
  47. webscout/Provider/PizzaGPT.py +1 -1
  48. webscout/Provider/QwenLM.py +4 -7
  49. webscout/Provider/TTI/FreeAIPlayground/async_freeaiplayground.py +3 -1
  50. webscout/Provider/TTI/FreeAIPlayground/sync_freeaiplayground.py +3 -3
  51. webscout/Provider/TTI/ImgSys/__init__.py +23 -0
  52. webscout/Provider/TTI/ImgSys/async_imgsys.py +202 -0
  53. webscout/Provider/TTI/ImgSys/sync_imgsys.py +195 -0
  54. webscout/Provider/TTI/__init__.py +3 -1
  55. webscout/Provider/TTI/artbit/async_artbit.py +1 -1
  56. webscout/Provider/TTI/artbit/sync_artbit.py +1 -1
  57. webscout/Provider/TTI/huggingface/async_huggingface.py +1 -1
  58. webscout/Provider/TTI/huggingface/sync_huggingface.py +1 -1
  59. webscout/Provider/TTI/piclumen/__init__.py +22 -22
  60. webscout/Provider/TTI/piclumen/sync_piclumen.py +232 -232
  61. webscout/Provider/TTI/pixelmuse/__init__.py +4 -0
  62. webscout/Provider/TTI/pixelmuse/async_pixelmuse.py +249 -0
  63. webscout/Provider/TTI/pixelmuse/sync_pixelmuse.py +182 -0
  64. webscout/Provider/TTI/talkai/sync_talkai.py +1 -1
  65. webscout/Provider/TTS/utils.py +1 -1
  66. webscout/Provider/TeachAnything.py +1 -1
  67. webscout/Provider/TextPollinationsAI.py +4 -4
  68. webscout/Provider/TwoAI.py +1 -2
  69. webscout/Provider/Venice.py +4 -2
  70. webscout/Provider/VercelAI.py +234 -0
  71. webscout/Provider/WebSim.py +3 -2
  72. webscout/Provider/WiseCat.py +10 -12
  73. webscout/Provider/Youchat.py +1 -1
  74. webscout/Provider/__init__.py +10 -0
  75. webscout/Provider/ai4chat.py +1 -1
  76. webscout/Provider/aimathgpt.py +2 -6
  77. webscout/Provider/akashgpt.py +1 -1
  78. webscout/Provider/askmyai.py +4 -4
  79. webscout/Provider/asksteve.py +203 -0
  80. webscout/Provider/bagoodex.py +2 -2
  81. webscout/Provider/cerebras.py +1 -1
  82. webscout/Provider/chatglm.py +4 -4
  83. webscout/Provider/cleeai.py +1 -0
  84. webscout/Provider/copilot.py +427 -415
  85. webscout/Provider/elmo.py +1 -1
  86. webscout/Provider/flowith.py +1 -1
  87. webscout/Provider/freeaichat.py +57 -31
  88. webscout/Provider/gaurish.py +3 -5
  89. webscout/Provider/geminiprorealtime.py +1 -1
  90. webscout/Provider/granite.py +4 -4
  91. webscout/Provider/hermes.py +5 -5
  92. webscout/Provider/julius.py +1 -1
  93. webscout/Provider/koala.py +1 -1
  94. webscout/Provider/lepton.py +1 -1
  95. webscout/Provider/llama3mitril.py +4 -4
  96. webscout/Provider/llamatutor.py +1 -1
  97. webscout/Provider/llmchat.py +3 -3
  98. webscout/Provider/meta.py +1 -1
  99. webscout/Provider/multichat.py +10 -10
  100. webscout/Provider/promptrefine.py +1 -1
  101. webscout/Provider/searchchat.py +293 -0
  102. webscout/Provider/sonus.py +2 -2
  103. webscout/Provider/talkai.py +2 -2
  104. webscout/Provider/turboseek.py +1 -1
  105. webscout/Provider/tutorai.py +1 -1
  106. webscout/Provider/typegpt.py +5 -42
  107. webscout/Provider/uncovr.py +4 -2
  108. webscout/Provider/x0gpt.py +1 -1
  109. webscout/__init__.py +36 -36
  110. webscout/cli.py +293 -332
  111. webscout/tempid.py +11 -11
  112. webscout/utils.py +2 -2
  113. webscout/version.py +1 -1
  114. webscout/webscout_search.py +1282 -1223
  115. webscout/webscout_search_async.py +813 -692
  116. {webscout-7.7.dist-info → webscout-7.8.dist-info}/METADATA +50 -29
  117. {webscout-7.7.dist-info → webscout-7.8.dist-info}/RECORD +121 -110
  118. {webscout-7.7.dist-info → webscout-7.8.dist-info}/LICENSE.md +0 -0
  119. {webscout-7.7.dist-info → webscout-7.8.dist-info}/WHEEL +0 -0
  120. {webscout-7.7.dist-info → webscout-7.8.dist-info}/entry_points.txt +0 -0
  121. {webscout-7.7.dist-info → webscout-7.8.dist-info}/top_level.txt +0 -0
webscout/cli.py CHANGED
@@ -1,332 +1,293 @@
1
- import sys
2
- from .swiftcli import CLI, option
3
- from .webscout_search import WEBS
4
- from .version import __version__
5
- from rich.console import Console
6
- from rich.panel import Panel
7
- from rich.table import Table
8
- from rich.text import Text
9
-
10
-
11
- COLORS = {
12
- 0: "black",
13
- 1: "red",
14
- 2: "green",
15
- 3: "yellow",
16
- 4: "blue",
17
- 5: "magenta",
18
- 6: "cyan",
19
- 7: "bright_black",
20
- 8: "bright_red",
21
- 9: "bright_green",
22
- 10: "bright_yellow",
23
- 11: "bright_blue",
24
- 12: "bright_magenta",
25
- 13: "bright_cyan",
26
- 14: "white",
27
- 15: "bright_white",
28
- }
29
-
30
- def _print_data(data):
31
- """Prints data using rich panels and markdown."""
32
- console = Console()
33
- if data:
34
- for i, e in enumerate(data, start=1):
35
- table = Table(show_header=False, show_lines=True, expand=True, box=None)
36
- table.add_column("Key", style="cyan", no_wrap=True, width=15)
37
- table.add_column("Value", style="white")
38
-
39
- for j, (k, v) in enumerate(e.items(), start=1):
40
- if v:
41
- width = 300 if k in ("content", "href", "image", "source", "thumbnail", "url") else 78
42
- k = "language" if k == "detected_language" else k
43
- text = Text(str(v), style="white")
44
- text = text.wrap(width=width, console=console)
45
- else:
46
- text = Text(str(v), style="white")
47
- table.add_row(k, text)
48
-
49
- console.print(Panel(table, title=f"Result {i}", expand=False, style="green on black"))
50
- console.print("\n")
51
-
52
- def _print_weather(data):
53
- """Prints weather data in a clean, focused format."""
54
- console = Console()
55
-
56
- # Current weather panel
57
- current = data["current"]
58
- current_table = Table(show_header=False, show_lines=True, expand=True, box=None)
59
- current_table.add_column("Metric", style="cyan", no_wrap=True, width=15)
60
- current_table.add_column("Value", style="white")
61
-
62
- current_table.add_row("Temperature", f"{current['temperature_c']}°C")
63
- current_table.add_row("Feels Like", f"{current['feels_like_c']}°C")
64
- current_table.add_row("Humidity", f"{current['humidity']}%")
65
- current_table.add_row("Wind", f"{current['wind_speed_ms']} m/s")
66
- current_table.add_row("Direction", f"{current['wind_direction']}°")
67
-
68
- console.print(Panel(current_table, title=f"Current Weather in {data['location']}", expand=False, style="green on black"))
69
- console.print("\n")
70
-
71
- # Daily forecast panel
72
- daily_table = Table(show_header=True, show_lines=True, expand=True, box=None)
73
- daily_table.add_column("Date", style="cyan")
74
- daily_table.add_column("Condition", style="white")
75
- daily_table.add_column("High", style="red")
76
- daily_table.add_column("Low", style="blue")
77
-
78
- for day in data["daily_forecast"][:5]: # Show next 5 days
79
- daily_table.add_row(
80
- day["date"],
81
- day["condition"],
82
- f"{day['max_temp_c']}°C",
83
- f"{day['min_temp_c']}°C"
84
- )
85
-
86
- console.print(Panel(daily_table, title="5-Day Forecast", expand=False, style="green on black"))
87
-
88
- # Initialize CLI app
89
- app = CLI(name="webscout", help="Search the web with a rich UI", version=__version__)
90
-
91
- @app.command()
92
- def version():
93
- """Show the version of webscout."""
94
- console = Console()
95
- console.print(f"[bold green]webscout[/bold green] version: {__version__}")
96
-
97
- @app.command()
98
- @option("--proxy", help="Proxy URL to use for requests")
99
- @option("--model", "-m", help="AI model to use", default="gpt-4o-mini", type=str)
100
- def chat(proxy: str = None, model: str = "gpt-4o-mini"):
101
- """Interactive AI chat using DuckDuckGo's AI."""
102
- webs = WEBS(proxy=proxy)
103
- console = Console()
104
-
105
- # Display header
106
- # console.print(f"[bold blue]{figlet_format('Webscout Chat')}[/]\n", justify="center")
107
- console.print(f"[bold green]Using model:[/] {model}\n")
108
- console.print("[cyan]Type your message and press Enter. Press Ctrl+C or type 'exit' to quit.[/]\n")
109
-
110
- # Start chat loop
111
- try:
112
- while True:
113
- try:
114
- user_input = input(">>> ").strip()
115
- if not user_input or user_input.lower() in ['exit', 'quit']:
116
- break
117
-
118
- response = webs.chat(keywords=user_input, model=model)
119
- console.print(f"\nAI: {response}\n")
120
-
121
- except Exception as e:
122
- console.print(f"[bold red]Error:[/] {str(e)}\n")
123
-
124
- except KeyboardInterrupt:
125
- console.print("\n[bold red]Chat session interrupted. Exiting...[/]")
126
-
127
- @app.command()
128
- @option("--keywords", "-k", help="Search keywords", required=True)
129
- @option("--region", "-r", help="Region for search results", default="wt-wt")
130
- @option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
131
- @option("--timelimit", "-t", help="Time limit for results", default=None)
132
- @option("--backend", "-b", help="Search backend to use", default="api")
133
- @option("--max-results", "-m", help="Maximum number of results", type=int, default=25)
134
- @option("--proxy", "-p", help="Proxy URL to use for requests")
135
- def text(keywords: str, region: str, safesearch: str, timelimit: str, backend: str, max_results: int, proxy: str = None):
136
- """Perform a text search using DuckDuckGo API."""
137
- webs = WEBS(proxy=proxy)
138
- try:
139
- results = webs.text(keywords, region, safesearch, timelimit, backend, max_results)
140
- _print_data(results)
141
- except Exception as e:
142
- raise e
143
-
144
- @app.command()
145
- @option("--keywords", "-k", help="Search keywords", required=True)
146
- @option("--proxy", "-p", help="Proxy URL to use for requests")
147
- def answers(keywords: str, proxy: str = None):
148
- """Perform an answers search using DuckDuckGo API."""
149
- webs = WEBS(proxy=proxy)
150
- try:
151
- results = webs.answers(keywords)
152
- _print_data(results)
153
- except Exception as e:
154
- raise e
155
-
156
- @app.command()
157
- @option("--keywords", "-k", help="Search keywords", required=True)
158
- @option("--region", "-r", help="Region for search results", default="wt-wt")
159
- @option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
160
- @option("--timelimit", "-t", help="Time limit for results", default=None)
161
- @option("--size", "-size", help="Image size", default=None)
162
- @option("--color", "-c", help="Image color", default=None)
163
- @option("--type", "-type", help="Image type", default=None)
164
- @option("--layout", "-l", help="Image layout", default=None)
165
- @option("--license", "-lic", help="Image license", default=None)
166
- @option("--max-results", "-m", help="Maximum number of results", type=int, default=90)
167
- @option("--proxy", "-p", help="Proxy URL to use for requests")
168
- def images(
169
- keywords: str,
170
- region: str,
171
- safesearch: str,
172
- timelimit: str,
173
- size: str,
174
- color: str,
175
- type: str,
176
- layout: str,
177
- license: str,
178
- max_results: int,
179
- proxy: str = None,
180
- ):
181
- """Perform an images search using DuckDuckGo API."""
182
- webs = WEBS(proxy=proxy)
183
- try:
184
- results = webs.images(keywords, region, safesearch, timelimit, size, color, type, layout, license, max_results)
185
- _print_data(results)
186
- except Exception as e:
187
- raise e
188
-
189
- @app.command()
190
- @option("--keywords", "-k", help="Search keywords", required=True)
191
- @option("--region", "-r", help="Region for search results", default="wt-wt")
192
- @option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
193
- @option("--timelimit", "-t", help="Time limit for results", default=None)
194
- @option("--resolution", "-res", help="Video resolution", default=None)
195
- @option("--duration", "-d", help="Video duration", default=None)
196
- @option("--license", "-lic", help="Video license", default=None)
197
- @option("--max-results", "-m", help="Maximum number of results", type=int, default=50)
198
- @option("--proxy", "-p", help="Proxy URL to use for requests")
199
- def videos(
200
- keywords: str,
201
- region: str,
202
- safesearch: str,
203
- timelimit: str,
204
- resolution: str,
205
- duration: str,
206
- license: str,
207
- max_results: int,
208
- proxy: str = None,
209
- ):
210
- """Perform a videos search using DuckDuckGo API."""
211
- webs = WEBS(proxy=proxy)
212
- try:
213
- results = webs.videos(keywords, region, safesearch, timelimit, resolution, duration, license, max_results)
214
- _print_data(results)
215
- except Exception as e:
216
- raise e
217
-
218
- @app.command()
219
- @option("--keywords", "-k", help="Search keywords", required=True)
220
- @option("--region", "-r", help="Region for search results", default="wt-wt")
221
- @option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
222
- @option("--timelimit", "-t", help="Time limit for results", default=None)
223
- @option("--max-results", "-m", help="Maximum number of results", type=int, default=25)
224
- @option("--proxy", "-p", help="Proxy URL to use for requests")
225
- def news(keywords: str, region: str, safesearch: str, timelimit: str, max_results: int, proxy: str = None):
226
- """Perform a news search using DuckDuckGo API."""
227
- webs = WEBS(proxy=proxy)
228
- try:
229
- results = webs.news(keywords, region, safesearch, timelimit, max_results)
230
- _print_data(results)
231
- except Exception as e:
232
- raise e
233
-
234
- @app.command()
235
- @option("--keywords", "-k", help="Search keywords", required=True)
236
- @option("--place", "-p", help="Simplified search - if set, the other parameters are not used")
237
- @option("--street", "-s", help="House number/street")
238
- @option("--city", "-c", help="City of search")
239
- @option("--county", "-county", help="County of search")
240
- @option("--state", "-state", help="State of search")
241
- @option("--country", "-country", help="Country of search")
242
- @option("--postalcode", "-post", help="Postal code of search")
243
- @option("--latitude", "-lat", help="Geographic coordinate (north-south position)")
244
- @option("--longitude", "-lon", help="Geographic coordinate (east-west position); if latitude and longitude are set, the other parameters are not used")
245
- @option("--radius", "-r", help="Expand the search square by the distance in kilometers", type=int, default=0)
246
- @option("--max-results", "-m", help="Number of results", type=int, default=50)
247
- @option("--proxy", "-p", help="Proxy URL to use for requests")
248
- def maps(
249
- keywords: str,
250
- place: str,
251
- street: str,
252
- city: str,
253
- county: str,
254
- state: str,
255
- country: str,
256
- postalcode: str,
257
- latitude: str,
258
- longitude: str,
259
- radius: int,
260
- max_results: int,
261
- proxy: str = None,
262
- ):
263
- """Perform a maps search using DuckDuckGo API."""
264
- webs = WEBS(proxy=proxy)
265
- try:
266
- results = webs.maps(
267
- keywords,
268
- place,
269
- street,
270
- city,
271
- county,
272
- state,
273
- country,
274
- postalcode,
275
- latitude,
276
- longitude,
277
- radius,
278
- max_results,
279
- )
280
- _print_data(results)
281
- except Exception as e:
282
- raise e
283
-
284
- @app.command()
285
- @option("--keywords", "-k", help="Text for translation", required=True)
286
- @option("--from", "-f", help="Language to translate from (defaults automatically)")
287
- @option("--to", "-t", help="Language to translate to (default: 'en')", default="en")
288
- @option("--proxy", "-p", help="Proxy URL to use for requests")
289
- def translate(keywords: str, from_: str, to: str, proxy: str = None):
290
- """Perform translation using DuckDuckGo API."""
291
- webs = WEBS(proxy=proxy)
292
- try:
293
- results = webs.translate(keywords, from_, to)
294
- _print_data(results)
295
- except Exception as e:
296
- raise e
297
-
298
- @app.command()
299
- @option("--keywords", "-k", help="Search keywords", required=True)
300
- @option("--region", "-r", help="Region for search results", default="wt-wt")
301
- @option("--proxy", "-p", help="Proxy URL to use for requests")
302
- def suggestions(keywords: str, region: str, proxy: str = None):
303
- """Perform a suggestions search using DuckDuckGo API."""
304
- webs = WEBS(proxy=proxy)
305
- try:
306
- results = webs.suggestions(keywords, region)
307
- _print_data(results)
308
- except Exception as e:
309
- raise e
310
-
311
- @app.command()
312
- @option("--location", "-l", help="Location to get weather for", required=True)
313
- @option("--language", "-lang", help="Language code (e.g. 'en', 'es')", default="en")
314
- @option("--proxy", "-p", help="Proxy URL to use for requests")
315
- def weather(location: str, language: str, proxy: str = None):
316
- """Get weather information for a location from DuckDuckGo."""
317
- webs = WEBS(proxy=proxy)
318
- try:
319
- results = webs.weather(location, language)
320
- _print_weather(results)
321
- except Exception as e:
322
- raise e
323
-
324
- def main():
325
- """Main entry point for the CLI."""
326
- try:
327
- app.run()
328
- except Exception as e:
329
- sys.exit(1)
330
-
331
- if __name__ == "__main__":
332
- main()
1
+ import sys
2
+ from .swiftcli import CLI, option
3
+ from .webscout_search import WEBS
4
+ from .version import __version__
5
+
6
+
7
+ def _print_data(data):
8
+ """Prints data in a simple formatted way."""
9
+ if data:
10
+ for i, e in enumerate(data, start=1):
11
+ print(f"\nResult {i}:")
12
+ print("-" * 50)
13
+ for k, v in e.items():
14
+ if v:
15
+ k = "language" if k == "detected_language" else k
16
+ print(f"{k:15}: {v}")
17
+ print("-" * 50)
18
+
19
+ def _print_weather(data):
20
+ """Prints weather data in a clean format."""
21
+ current = data["current"]
22
+
23
+ print(f"\nCurrent Weather in {data['location']}:")
24
+ print("-" * 50)
25
+ print(f"Temperature: {current['temperature_c']}°C")
26
+ print(f"Feels Like: {current['feels_like_c']}°C")
27
+ print(f"Humidity: {current['humidity']}%")
28
+ print(f"Wind: {current['wind_speed_ms']} m/s")
29
+ print(f"Direction: {current['wind_direction']}°")
30
+ print("-" * 50)
31
+
32
+ print("\n5-Day Forecast:")
33
+ print("-" * 50)
34
+ print(f"{'Date':10} {'Condition':15} {'High':8} {'Low':8}")
35
+ print("-" * 50)
36
+
37
+ for day in data["daily_forecast"][:5]:
38
+ print(f"{day['date']:10} {day['condition']:15} {day['max_temp_c']:8.1f}°C {day['min_temp_c']:8.1f}°C")
39
+ print("-" * 50)
40
+
41
+ # Initialize CLI app
42
+ app = CLI(name="webscout", help="Search the web with a simple UI", version=__version__)
43
+
44
+ @app.command()
45
+ def version():
46
+ """Show the version of webscout."""
47
+ print(f"webscout version: {__version__}")
48
+
49
+ @app.command()
50
+ @option("--proxy", help="Proxy URL to use for requests")
51
+ @option("--model", "-m", help="AI model to use", default="gpt-4o-mini", type=str)
52
+ @option("--timeout", "-t", help="Timeout value for requests", type=int, default=10)
53
+ def chat(proxy: str = None, model: str = "gpt-4o-mini", timeout: int = 10):
54
+ """Interactive AI chat using DuckDuckGo's AI."""
55
+ webs = WEBS(proxy=proxy, timeout=timeout)
56
+
57
+ print(f"Using model: {model}")
58
+ print("Type your message and press Enter. Press Ctrl+C or type 'exit' to quit.\n")
59
+
60
+ try:
61
+ while True:
62
+ try:
63
+ user_input = input(">>> ").strip()
64
+ if not user_input or user_input.lower() in ['exit', 'quit']:
65
+ break
66
+
67
+ response = webs.chat(keywords=user_input, model=model)
68
+ print(f"\nAI: {response}\n")
69
+
70
+ except Exception as e:
71
+ print(f"Error: {str(e)}\n")
72
+
73
+ except KeyboardInterrupt:
74
+ print("\nChat session interrupted. Exiting...")
75
+
76
+ @app.command()
77
+ @option("--keywords", "-k", help="Search keywords", required=True)
78
+ @option("--region", "-r", help="Region for search results", default="wt-wt")
79
+ @option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
80
+ @option("--timelimit", "-t", help="Time limit for results", default=None)
81
+ @option("--backend", "-b", help="Search backend to use", default="api")
82
+ @option("--max-results", "-m", help="Maximum number of results", type=int, default=25)
83
+ @option("--proxy", "-p", help="Proxy URL to use for requests")
84
+ @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
85
+ def text(keywords: str, region: str, safesearch: str, timelimit: str, backend: str, max_results: int, proxy: str = None, timeout: int = 10):
86
+ """Perform a text search using DuckDuckGo API."""
87
+ webs = WEBS(proxy=proxy, timeout=timeout)
88
+ try:
89
+ results = webs.text(keywords, region, safesearch, timelimit, backend, max_results)
90
+ _print_data(results)
91
+ except Exception as e:
92
+ raise e
93
+
94
+ @app.command()
95
+ @option("--keywords", "-k", help="Search keywords", required=True)
96
+ @option("--proxy", "-p", help="Proxy URL to use for requests")
97
+ @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
98
+ def answers(keywords: str, proxy: str = None, timeout: int = 10):
99
+ """Perform an answers search using DuckDuckGo API."""
100
+ webs = WEBS(proxy=proxy, timeout=timeout)
101
+ try:
102
+ results = webs.answers(keywords)
103
+ _print_data(results)
104
+ except Exception as e:
105
+ raise e
106
+
107
+ @app.command()
108
+ @option("--keywords", "-k", help="Search keywords", required=True)
109
+ @option("--region", "-r", help="Region for search results", default="wt-wt")
110
+ @option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
111
+ @option("--timelimit", "-t", help="Time limit for results", default=None)
112
+ @option("--size", "-size", help="Image size", default=None)
113
+ @option("--color", "-c", help="Image color", default=None)
114
+ @option("--type", "-type", help="Image type", default=None)
115
+ @option("--layout", "-l", help="Image layout", default=None)
116
+ @option("--license", "-lic", help="Image license", default=None)
117
+ @option("--max-results", "-m", help="Maximum number of results", type=int, default=90)
118
+ @option("--proxy", "-p", help="Proxy URL to use for requests")
119
+ @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
120
+ def images(
121
+ keywords: str,
122
+ region: str,
123
+ safesearch: str,
124
+ timelimit: str,
125
+ size: str,
126
+ color: str,
127
+ type: str,
128
+ layout: str,
129
+ license: str,
130
+ max_results: int,
131
+ proxy: str = None,
132
+ timeout: int = 10,
133
+ ):
134
+ """Perform an images search using DuckDuckGo API."""
135
+ webs = WEBS(proxy=proxy, timeout=timeout)
136
+ try:
137
+ results = webs.images(keywords, region, safesearch, timelimit, size, color, type, layout, license, max_results)
138
+ _print_data(results)
139
+ except Exception as e:
140
+ raise e
141
+
142
+ @app.command()
143
+ @option("--keywords", "-k", help="Search keywords", required=True)
144
+ @option("--region", "-r", help="Region for search results", default="wt-wt")
145
+ @option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
146
+ @option("--timelimit", "-t", help="Time limit for results", default=None)
147
+ @option("--resolution", "-res", help="Video resolution", default=None)
148
+ @option("--duration", "-d", help="Video duration", default=None)
149
+ @option("--license", "-lic", help="Video license", default=None)
150
+ @option("--max-results", "-m", help="Maximum number of results", type=int, default=50)
151
+ @option("--proxy", "-p", help="Proxy URL to use for requests")
152
+ @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
153
+ def videos(
154
+ keywords: str,
155
+ region: str,
156
+ safesearch: str,
157
+ timelimit: str,
158
+ resolution: str,
159
+ duration: str,
160
+ license: str,
161
+ max_results: int,
162
+ proxy: str = None,
163
+ timeout: int = 10,
164
+ ):
165
+ """Perform a videos search using DuckDuckGo API."""
166
+ webs = WEBS(proxy=proxy, timeout=timeout)
167
+ try:
168
+ results = webs.videos(keywords, region, safesearch, timelimit, resolution, duration, license, max_results)
169
+ _print_data(results)
170
+ except Exception as e:
171
+ raise e
172
+
173
+ @app.command()
174
+ @option("--keywords", "-k", help="Search keywords", required=True)
175
+ @option("--region", "-r", help="Region for search results", default="wt-wt")
176
+ @option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
177
+ @option("--timelimit", "-t", help="Time limit for results", default=None)
178
+ @option("--max-results", "-m", help="Maximum number of results", type=int, default=25)
179
+ @option("--proxy", "-p", help="Proxy URL to use for requests")
180
+ @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
181
+ def news(keywords: str, region: str, safesearch: str, timelimit: str, max_results: int, proxy: str = None, timeout: int = 10):
182
+ """Perform a news search using DuckDuckGo API."""
183
+ webs = WEBS(proxy=proxy, timeout=timeout)
184
+ try:
185
+ results = webs.news(keywords, region, safesearch, timelimit, max_results)
186
+ _print_data(results)
187
+ except Exception as e:
188
+ raise e
189
+
190
+ @app.command()
191
+ @option("--keywords", "-k", help="Search keywords", required=True)
192
+ @option("--place", "-p", help="Simplified search - if set, the other parameters are not used")
193
+ @option("--street", "-s", help="House number/street")
194
+ @option("--city", "-c", help="City of search")
195
+ @option("--county", "-county", help="County of search")
196
+ @option("--state", "-state", help="State of search")
197
+ @option("--country", "-country", help="Country of search")
198
+ @option("--postalcode", "-post", help="Postal code of search")
199
+ @option("--latitude", "-lat", help="Geographic coordinate (north-south position)")
200
+ @option("--longitude", "-lon", help="Geographic coordinate (east-west position); if latitude and longitude are set, the other parameters are not used")
201
+ @option("--radius", "-r", help="Expand the search square by the distance in kilometers", type=int, default=0)
202
+ @option("--max-results", "-m", help="Number of results", type=int, default=50)
203
+ @option("--proxy", "-p", help="Proxy URL to use for requests")
204
+ @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
205
+ def maps(
206
+ keywords: str,
207
+ place: str,
208
+ street: str,
209
+ city: str,
210
+ county: str,
211
+ state: str,
212
+ country: str,
213
+ postalcode: str,
214
+ latitude: str,
215
+ longitude: str,
216
+ radius: int,
217
+ max_results: int,
218
+ proxy: str = None,
219
+ timeout: int = 10,
220
+ ):
221
+ """Perform a maps search using DuckDuckGo API."""
222
+ webs = WEBS(proxy=proxy, timeout=timeout)
223
+ try:
224
+ results = webs.maps(
225
+ keywords,
226
+ place,
227
+ street,
228
+ city,
229
+ county,
230
+ state,
231
+ country,
232
+ postalcode,
233
+ latitude,
234
+ longitude,
235
+ radius,
236
+ max_results,
237
+ )
238
+ _print_data(results)
239
+ except Exception as e:
240
+ raise e
241
+
242
+ @app.command()
243
+ @option("--keywords", "-k", help="Text for translation", required=True)
244
+ @option("--from", "-f", help="Language to translate from (defaults automatically)")
245
+ @option("--to", "-t", help="Language to translate to (default: 'en')", default="en")
246
+ @option("--proxy", "-p", help="Proxy URL to use for requests")
247
+ @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
248
+ def translate(keywords: str, from_: str, to: str, proxy: str = None, timeout: int = 10):
249
+ """Perform translation using DuckDuckGo API."""
250
+ webs = WEBS(proxy=proxy, timeout=timeout)
251
+ try:
252
+ results = webs.translate(keywords, from_, to)
253
+ _print_data(results)
254
+ except Exception as e:
255
+ raise e
256
+
257
+ @app.command()
258
+ @option("--keywords", "-k", help="Search keywords", required=True)
259
+ @option("--region", "-r", help="Region for search results", default="wt-wt")
260
+ @option("--proxy", "-p", help="Proxy URL to use for requests")
261
+ @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
262
+ def suggestions(keywords: str, region: str, proxy: str = None, timeout: int = 10):
263
+ """Perform a suggestions search using DuckDuckGo API."""
264
+ webs = WEBS(proxy=proxy, timeout=timeout)
265
+ try:
266
+ results = webs.suggestions(keywords, region)
267
+ _print_data(results)
268
+ except Exception as e:
269
+ raise e
270
+
271
+ @app.command()
272
+ @option("--location", "-l", help="Location to get weather for", required=True)
273
+ @option("--language", "-lang", help="Language code (e.g. 'en', 'es')", default="en")
274
+ @option("--proxy", "-p", help="Proxy URL to use for requests")
275
+ @option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
276
+ def weather(location: str, language: str, proxy: str = None, timeout: int = 10):
277
+ """Get weather information for a location from DuckDuckGo."""
278
+ webs = WEBS(proxy=proxy, timeout=timeout)
279
+ try:
280
+ results = webs.weather(location, language)
281
+ _print_weather(results)
282
+ except Exception as e:
283
+ raise e
284
+
285
+ def main():
286
+ """Main entry point for the CLI."""
287
+ try:
288
+ app.run()
289
+ except Exception as e:
290
+ sys.exit(1)
291
+
292
+ if __name__ == "__main__":
293
+ main()