webscout 6.2b0__py3-none-any.whl → 6.4__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.
- webscout/AIauto.py +191 -176
- webscout/AIbase.py +112 -239
- webscout/AIutel.py +488 -1130
- webscout/Agents/functioncall.py +248 -198
- webscout/Bing_search.py +250 -153
- webscout/DWEBS.py +454 -178
- webscout/Extra/__init__.py +2 -1
- webscout/Extra/autocoder/__init__.py +9 -0
- webscout/Extra/autocoder/autocoder_utiles.py +121 -0
- webscout/Extra/autocoder/rawdog.py +681 -0
- webscout/Extra/autollama.py +246 -195
- webscout/Extra/gguf.py +441 -226
- webscout/Extra/weather.py +172 -67
- webscout/LLM.py +442 -100
- webscout/Litlogger/__init__.py +681 -0
- webscout/Local/formats.py +4 -2
- webscout/Provider/Amigo.py +19 -10
- webscout/Provider/Andi.py +0 -33
- webscout/Provider/Blackboxai.py +4 -204
- webscout/Provider/DARKAI.py +1 -1
- webscout/Provider/EDITEE.py +1 -1
- webscout/Provider/Llama3.py +1 -1
- webscout/Provider/Marcus.py +137 -0
- webscout/Provider/NinjaChat.py +1 -1
- webscout/Provider/PI.py +221 -207
- webscout/Provider/Perplexity.py +598 -598
- webscout/Provider/RoboCoders.py +206 -0
- webscout/Provider/TTI/AiForce/__init__.py +22 -0
- webscout/Provider/TTI/AiForce/async_aiforce.py +257 -0
- webscout/Provider/TTI/AiForce/sync_aiforce.py +242 -0
- webscout/Provider/TTI/Nexra/__init__.py +22 -0
- webscout/Provider/TTI/Nexra/async_nexra.py +286 -0
- webscout/Provider/TTI/Nexra/sync_nexra.py +258 -0
- webscout/Provider/TTI/PollinationsAI/__init__.py +23 -0
- webscout/Provider/TTI/PollinationsAI/async_pollinations.py +330 -0
- webscout/Provider/TTI/PollinationsAI/sync_pollinations.py +285 -0
- webscout/Provider/TTI/__init__.py +3 -4
- webscout/Provider/TTI/artbit/__init__.py +22 -0
- webscout/Provider/TTI/artbit/async_artbit.py +184 -0
- webscout/Provider/TTI/artbit/sync_artbit.py +176 -0
- webscout/Provider/TTI/blackbox/__init__.py +4 -0
- webscout/Provider/TTI/blackbox/async_blackbox.py +212 -0
- webscout/Provider/TTI/{blackboximage.py → blackbox/sync_blackbox.py} +199 -153
- webscout/Provider/TTI/deepinfra/__init__.py +4 -0
- webscout/Provider/TTI/deepinfra/async_deepinfra.py +227 -0
- webscout/Provider/TTI/deepinfra/sync_deepinfra.py +199 -0
- webscout/Provider/TTI/huggingface/__init__.py +22 -0
- webscout/Provider/TTI/huggingface/async_huggingface.py +199 -0
- webscout/Provider/TTI/huggingface/sync_huggingface.py +195 -0
- webscout/Provider/TTI/imgninza/__init__.py +4 -0
- webscout/Provider/TTI/imgninza/async_ninza.py +214 -0
- webscout/Provider/TTI/{imgninza.py → imgninza/sync_ninza.py} +209 -136
- webscout/Provider/TTI/talkai/__init__.py +4 -0
- webscout/Provider/TTI/talkai/async_talkai.py +229 -0
- webscout/Provider/TTI/talkai/sync_talkai.py +207 -0
- webscout/Provider/__init__.py +146 -132
- webscout/Provider/askmyai.py +158 -0
- webscout/Provider/cerebras.py +227 -206
- webscout/Provider/geminiapi.py +208 -198
- webscout/Provider/llama3mitril.py +180 -0
- webscout/Provider/llmchat.py +203 -0
- webscout/Provider/mhystical.py +176 -0
- webscout/Provider/perplexitylabs.py +265 -0
- webscout/Provider/talkai.py +196 -0
- webscout/Provider/twitterclone.py +251 -244
- webscout/Provider/typegpt.py +359 -0
- webscout/__init__.py +28 -23
- webscout/__main__.py +5 -5
- webscout/cli.py +327 -347
- webscout/conversation.py +227 -0
- webscout/exceptions.py +161 -29
- webscout/litagent/__init__.py +172 -0
- webscout/litprinter/__init__.py +831 -0
- webscout/optimizers.py +270 -0
- webscout/prompt_manager.py +279 -0
- webscout/swiftcli/__init__.py +810 -0
- webscout/transcriber.py +479 -551
- webscout/update_checker.py +125 -0
- webscout/version.py +1 -1
- webscout-6.4.dist-info/LICENSE.md +211 -0
- {webscout-6.2b0.dist-info → webscout-6.4.dist-info}/METADATA +34 -55
- webscout-6.4.dist-info/RECORD +154 -0
- webscout/Provider/TTI/AIuncensored.py +0 -103
- webscout/Provider/TTI/Nexra.py +0 -120
- webscout/Provider/TTI/PollinationsAI.py +0 -138
- webscout/Provider/TTI/WebSimAI.py +0 -142
- webscout/Provider/TTI/aiforce.py +0 -160
- webscout/Provider/TTI/artbit.py +0 -141
- webscout/Provider/TTI/deepinfra.py +0 -148
- webscout/Provider/TTI/huggingface.py +0 -155
- webscout/models.py +0 -23
- webscout-6.2b0.dist-info/LICENSE.md +0 -50
- webscout-6.2b0.dist-info/RECORD +0 -118
- /webscout/{g4f.py → gpt4free.py} +0 -0
- {webscout-6.2b0.dist-info → webscout-6.4.dist-info}/WHEEL +0 -0
- {webscout-6.2b0.dist-info → webscout-6.4.dist-info}/entry_points.txt +0 -0
- {webscout-6.2b0.dist-info → webscout-6.4.dist-info}/top_level.txt +0 -0
webscout/cli.py
CHANGED
|
@@ -1,347 +1,327 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
from
|
|
5
|
-
from
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
from .
|
|
12
|
-
from .
|
|
13
|
-
from .
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
from rich.
|
|
17
|
-
from rich.
|
|
18
|
-
from rich.
|
|
19
|
-
from rich.
|
|
20
|
-
from rich.
|
|
21
|
-
from rich.
|
|
22
|
-
from rich.
|
|
23
|
-
from rich.
|
|
24
|
-
from
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
text =
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
console.print(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
@
|
|
138
|
-
@
|
|
139
|
-
@
|
|
140
|
-
@
|
|
141
|
-
@
|
|
142
|
-
@
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
@
|
|
158
|
-
@
|
|
159
|
-
@
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
):
|
|
222
|
-
"""
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
region
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
@
|
|
239
|
-
@
|
|
240
|
-
@
|
|
241
|
-
@
|
|
242
|
-
@
|
|
243
|
-
@
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
@
|
|
281
|
-
@
|
|
282
|
-
@
|
|
283
|
-
@
|
|
284
|
-
@
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
@click.option("-t", "--to", default="en", help="Language to translate to (default: 'en').")
|
|
329
|
-
@click.option("-p", "--proxy", default=None, help="Proxy to send requests (e.g., socks5://localhost:9150)")
|
|
330
|
-
def translate(keywords, from_, to, proxy):
|
|
331
|
-
"""Performs translation using DuckDuckGo API with a rich UI."""
|
|
332
|
-
data = WEBS(proxy=proxy).translate(keywords=keywords, from_=from_, to=to)
|
|
333
|
-
_print_data(data)
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
@cli.command()
|
|
337
|
-
@click.option("-k", "--keywords", required=True, help="Keywords for query.")
|
|
338
|
-
@click.option("-r", "--region", default="wt-wt", help="Region (e.g., wt-wt, us-en, ru-ru) - See https://duckduckgo.com/params for more options.")
|
|
339
|
-
@click.option("-p", "--proxy", default=None, help="Proxy to send requests (e.g., socks5://localhost:9150)")
|
|
340
|
-
def suggestions(keywords, region, proxy):
|
|
341
|
-
"""Performs a suggestions search using DuckDuckGo API with a rich UI."""
|
|
342
|
-
data = WEBS(proxy=proxy).suggestions(keywords=keywords, region=region)
|
|
343
|
-
_print_data(data)
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
if __name__ == "__main__":
|
|
347
|
-
cli(prog_name="WEBS")
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
from urllib.parse import unquote
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from .swiftcli import CLI, option, argument, group
|
|
8
|
+
from curl_cffi import requests
|
|
9
|
+
import pyreqwest_impersonate as pri
|
|
10
|
+
from .webscout_search import WEBS
|
|
11
|
+
from .utils import json_dumps, json_loads
|
|
12
|
+
from .version import __version__
|
|
13
|
+
from .Litlogger import LitLogger, LogFormat, ColorScheme
|
|
14
|
+
from rich.console import Console
|
|
15
|
+
from rich.panel import Panel
|
|
16
|
+
from rich.markdown import Markdown
|
|
17
|
+
from rich.table import Table
|
|
18
|
+
from rich.style import Style
|
|
19
|
+
from rich.text import Text
|
|
20
|
+
from rich.align import Align
|
|
21
|
+
from rich.progress import track, Progress
|
|
22
|
+
from rich.prompt import Prompt, Confirm
|
|
23
|
+
from rich.columns import Columns
|
|
24
|
+
from pyfiglet import figlet_format
|
|
25
|
+
|
|
26
|
+
logger = LitLogger(
|
|
27
|
+
name="webscout",
|
|
28
|
+
format=LogFormat.MODERN_EMOJI,
|
|
29
|
+
color_scheme=ColorScheme.CYBERPUNK,
|
|
30
|
+
console_output=True
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
COLORS = {
|
|
34
|
+
0: "black",
|
|
35
|
+
1: "red",
|
|
36
|
+
2: "green",
|
|
37
|
+
3: "yellow",
|
|
38
|
+
4: "blue",
|
|
39
|
+
5: "magenta",
|
|
40
|
+
6: "cyan",
|
|
41
|
+
7: "bright_black",
|
|
42
|
+
8: "bright_red",
|
|
43
|
+
9: "bright_green",
|
|
44
|
+
10: "bright_yellow",
|
|
45
|
+
11: "bright_blue",
|
|
46
|
+
12: "bright_magenta",
|
|
47
|
+
13: "bright_cyan",
|
|
48
|
+
14: "white",
|
|
49
|
+
15: "bright_white",
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
def _print_data(data):
|
|
53
|
+
"""Prints data using rich panels and markdown."""
|
|
54
|
+
console = Console()
|
|
55
|
+
if data:
|
|
56
|
+
for i, e in enumerate(data, start=1):
|
|
57
|
+
table = Table(show_header=False, show_lines=True, expand=True, box=None) # Removed duplicate title
|
|
58
|
+
table.add_column("Key", style="cyan", no_wrap=True, width=15)
|
|
59
|
+
table.add_column("Value", style="white")
|
|
60
|
+
|
|
61
|
+
for j, (k, v) in enumerate(e.items(), start=1):
|
|
62
|
+
if v:
|
|
63
|
+
width = 300 if k in ("content", "href", "image", "source", "thumbnail", "url") else 78
|
|
64
|
+
k = "language" if k == "detected_language" else k
|
|
65
|
+
text = Text(f"{v}", style="white")
|
|
66
|
+
text = text.wrap(width=width, initial_indent="", subsequent_indent=" " * 18, preserve_paragraphs=True)
|
|
67
|
+
else:
|
|
68
|
+
text = Text(v, style="white")
|
|
69
|
+
table.add_row(k, text)
|
|
70
|
+
|
|
71
|
+
# Only the Panel has the title now
|
|
72
|
+
console.print(Panel(table, title=f"Result {i}", expand=False, style="green on black"))
|
|
73
|
+
console.print("\n")
|
|
74
|
+
|
|
75
|
+
# Initialize CLI app
|
|
76
|
+
app = CLI(name="webscout", help="Search the web with a rich UI", version=__version__)
|
|
77
|
+
|
|
78
|
+
@app.command()
|
|
79
|
+
def version():
|
|
80
|
+
"""Show the version of webscout."""
|
|
81
|
+
console = Console()
|
|
82
|
+
console.print(f"[bold green]webscout[/bold green] version: {__version__}")
|
|
83
|
+
|
|
84
|
+
@app.command()
|
|
85
|
+
@option("--proxy", help="Proxy URL to use for requests")
|
|
86
|
+
@option("--model", "-m", help="AI model to use", default="gpt-4o-mini", type=str)
|
|
87
|
+
def chat(proxy: str = None, model: str = "gpt-4o-mini"):
|
|
88
|
+
"""Interactive AI chat using DuckDuckGo's AI."""
|
|
89
|
+
webs = WEBS(proxy=proxy)
|
|
90
|
+
console = Console()
|
|
91
|
+
|
|
92
|
+
# Display header
|
|
93
|
+
console.print(f"[bold blue]{figlet_format('Webscout Chat')}[/]\n", justify="center")
|
|
94
|
+
console.print(f"[bold green]Using model:[/] {model}\n")
|
|
95
|
+
console.print("[cyan]Type your message and press Enter. Press Ctrl+C or type 'exit' to quit.[/]\n")
|
|
96
|
+
|
|
97
|
+
# Start chat loop
|
|
98
|
+
try:
|
|
99
|
+
while True:
|
|
100
|
+
try:
|
|
101
|
+
user_input = input("You: ").strip()
|
|
102
|
+
if not user_input or user_input.lower() in ['exit', 'quit']:
|
|
103
|
+
break
|
|
104
|
+
|
|
105
|
+
logger.info(f"Sending message to {model}")
|
|
106
|
+
response = webs.chat(keywords=user_input, model=model)
|
|
107
|
+
console.print(f"\nAI: {response}\n")
|
|
108
|
+
logger.success("Received response from AI")
|
|
109
|
+
|
|
110
|
+
except Exception as e:
|
|
111
|
+
logger.error(f"Error in chat: {str(e)}")
|
|
112
|
+
console.print(f"[bold red]Error:[/] {str(e)}\n")
|
|
113
|
+
|
|
114
|
+
except KeyboardInterrupt:
|
|
115
|
+
logger.info("Chat session terminated by user")
|
|
116
|
+
|
|
117
|
+
console.print("\n[cyan]Chat session ended. Goodbye![/]")
|
|
118
|
+
|
|
119
|
+
@app.command()
|
|
120
|
+
@option("--keywords", "-k", help="Search keywords")
|
|
121
|
+
@option("--region", "-r", help="Region for search results", default="wt-wt")
|
|
122
|
+
@option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
|
|
123
|
+
@option("--timelimit", "-t", help="Time limit for results", default=None)
|
|
124
|
+
@option("--backend", "-b", help="Search backend to use", default="api")
|
|
125
|
+
@option("--max-results", "-m", help="Maximum number of results", type=int, default=25)
|
|
126
|
+
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
127
|
+
def text(keywords: str, region: str, safesearch: str, timelimit: str, backend: str, max_results: int, proxy: str = None):
|
|
128
|
+
"""Perform a text search using DuckDuckGo API."""
|
|
129
|
+
webs = WEBS(proxy=proxy)
|
|
130
|
+
try:
|
|
131
|
+
webs.text(keywords, region, safesearch, timelimit, backend, max_results)
|
|
132
|
+
except Exception as e:
|
|
133
|
+
logger.error(f"Error in text search: {e}")
|
|
134
|
+
raise e
|
|
135
|
+
|
|
136
|
+
@app.command()
|
|
137
|
+
@option("--keywords", "-k", help="Search keywords")
|
|
138
|
+
@option("--region", "-r", help="Region for search results", default="wt-wt")
|
|
139
|
+
@option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
|
|
140
|
+
@option("--timelimit", "-t", help="Time limit for results", default=None)
|
|
141
|
+
@option("--max-results", "-m", help="Maximum number of results", type=int, default=25)
|
|
142
|
+
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
143
|
+
def answers(keywords: str, region: str, safesearch: str, timelimit: str, max_results: int, proxy: str = None):
|
|
144
|
+
"""Perform an answers search using DuckDuckGo API."""
|
|
145
|
+
webs = WEBS(proxy=proxy)
|
|
146
|
+
try:
|
|
147
|
+
webs.answers(keywords, region, safesearch, timelimit, max_results)
|
|
148
|
+
except Exception as e:
|
|
149
|
+
logger.error(f"Error in answers search: {e}")
|
|
150
|
+
raise e
|
|
151
|
+
|
|
152
|
+
@app.command()
|
|
153
|
+
@option("--keywords", "-k", help="Search keywords")
|
|
154
|
+
@option("--region", "-r", help="Region for search results", default="wt-wt")
|
|
155
|
+
@option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
|
|
156
|
+
@option("--timelimit", "-t", help="Time limit for results", default=None)
|
|
157
|
+
@option("--size", "-size", help="Image size", default=None)
|
|
158
|
+
@option("--color", "-c", help="Image color", default=None)
|
|
159
|
+
@option("--type", "-type", help="Image type", default=None)
|
|
160
|
+
@option("--layout", "-l", help="Image layout", default=None)
|
|
161
|
+
@option("--license", "-lic", help="Image license", default=None)
|
|
162
|
+
@option("--max-results", "-m", help="Maximum number of results", type=int, default=90)
|
|
163
|
+
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
164
|
+
def images(
|
|
165
|
+
keywords: str,
|
|
166
|
+
region: str,
|
|
167
|
+
safesearch: str,
|
|
168
|
+
timelimit: str,
|
|
169
|
+
size: str,
|
|
170
|
+
color: str,
|
|
171
|
+
type: str,
|
|
172
|
+
layout: str,
|
|
173
|
+
license: str,
|
|
174
|
+
max_results: int,
|
|
175
|
+
proxy: str = None,
|
|
176
|
+
):
|
|
177
|
+
"""Perform an images search using DuckDuckGo API."""
|
|
178
|
+
webs = WEBS(proxy=proxy)
|
|
179
|
+
try:
|
|
180
|
+
webs.images(keywords, region, safesearch, timelimit, size, color, type, layout, license, max_results)
|
|
181
|
+
except Exception as e:
|
|
182
|
+
logger.error(f"Error in images search: {e}")
|
|
183
|
+
raise e
|
|
184
|
+
|
|
185
|
+
@app.command()
|
|
186
|
+
@option("--keywords", "-k", help="Search keywords")
|
|
187
|
+
@option("--region", "-r", help="Region for search results", default="wt-wt")
|
|
188
|
+
@option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
|
|
189
|
+
@option("--timelimit", "-t", help="Time limit for results", default=None)
|
|
190
|
+
@option("--resolution", "-res", help="Video resolution", default=None)
|
|
191
|
+
@option("--duration", "-d", help="Video duration", default=None)
|
|
192
|
+
@option("--license", "-lic", help="Video license", default=None)
|
|
193
|
+
@option("--max-results", "-m", help="Maximum number of results", type=int, default=50)
|
|
194
|
+
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
195
|
+
def videos(
|
|
196
|
+
keywords: str,
|
|
197
|
+
region: str,
|
|
198
|
+
safesearch: str,
|
|
199
|
+
timelimit: str,
|
|
200
|
+
resolution: str,
|
|
201
|
+
duration: str,
|
|
202
|
+
license: str,
|
|
203
|
+
max_results: int,
|
|
204
|
+
proxy: str = None,
|
|
205
|
+
):
|
|
206
|
+
"""Perform a videos search using DuckDuckGo API."""
|
|
207
|
+
webs = WEBS(proxy=proxy)
|
|
208
|
+
try:
|
|
209
|
+
webs.videos(keywords, region, safesearch, timelimit, resolution, duration, license, max_results)
|
|
210
|
+
except Exception as e:
|
|
211
|
+
logger.error(f"Error in videos search: {e}")
|
|
212
|
+
raise e
|
|
213
|
+
|
|
214
|
+
@app.command()
|
|
215
|
+
@option("--keywords", "-k", help="Search keywords")
|
|
216
|
+
@option("--region", "-r", help="Region for search results", default="wt-wt")
|
|
217
|
+
@option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
|
|
218
|
+
@option("--timelimit", "-t", help="Time limit for results", default=None)
|
|
219
|
+
@option("--max-results", "-m", help="Maximum number of results", type=int, default=25)
|
|
220
|
+
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
221
|
+
def news(keywords: str, region: str, safesearch: str, timelimit: str, max_results: int, proxy: str = None):
|
|
222
|
+
"""Perform a news search using DuckDuckGo API."""
|
|
223
|
+
webs = WEBS(proxy=proxy)
|
|
224
|
+
try:
|
|
225
|
+
webs.news(keywords, region, safesearch, timelimit, max_results)
|
|
226
|
+
except Exception as e:
|
|
227
|
+
logger.error(f"Error in news search: {e}")
|
|
228
|
+
raise e
|
|
229
|
+
|
|
230
|
+
@app.command()
|
|
231
|
+
@option("--keywords", "-k", help="Search keywords")
|
|
232
|
+
@option("--place", "-p", help="Simplified search - if set, the other parameters are not used")
|
|
233
|
+
@option("--street", "-s", help="House number/street")
|
|
234
|
+
@option("--city", "-c", help="City of search")
|
|
235
|
+
@option("--county", "-county", help="County of search")
|
|
236
|
+
@option("--state", "-state", help="State of search")
|
|
237
|
+
@option("--country", "-country", help="Country of search")
|
|
238
|
+
@option("--postalcode", "-post", help="Postal code of search")
|
|
239
|
+
@option("--latitude", "-lat", help="Geographic coordinate (north-south position)")
|
|
240
|
+
@option("--longitude", "-lon", help="Geographic coordinate (east-west position); if latitude and longitude are set, the other parameters are not used")
|
|
241
|
+
@option("--radius", "-r", help="Expand the search square by the distance in kilometers", type=int, default=0)
|
|
242
|
+
@option("--max-results", "-m", help="Number of results", type=int, default=50)
|
|
243
|
+
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
244
|
+
def maps(
|
|
245
|
+
keywords: str,
|
|
246
|
+
place: str,
|
|
247
|
+
street: str,
|
|
248
|
+
city: str,
|
|
249
|
+
county: str,
|
|
250
|
+
state: str,
|
|
251
|
+
country: str,
|
|
252
|
+
postalcode: str,
|
|
253
|
+
latitude: str,
|
|
254
|
+
longitude: str,
|
|
255
|
+
radius: int,
|
|
256
|
+
max_results: int,
|
|
257
|
+
proxy: str = None,
|
|
258
|
+
):
|
|
259
|
+
"""Perform a maps search using DuckDuckGo API."""
|
|
260
|
+
webs = WEBS(proxy=proxy)
|
|
261
|
+
try:
|
|
262
|
+
webs.maps(
|
|
263
|
+
keywords,
|
|
264
|
+
place,
|
|
265
|
+
street,
|
|
266
|
+
city,
|
|
267
|
+
county,
|
|
268
|
+
state,
|
|
269
|
+
country,
|
|
270
|
+
postalcode,
|
|
271
|
+
latitude,
|
|
272
|
+
longitude,
|
|
273
|
+
radius,
|
|
274
|
+
max_results,
|
|
275
|
+
)
|
|
276
|
+
except Exception as e:
|
|
277
|
+
logger.error(f"Error in maps search: {e}")
|
|
278
|
+
raise e
|
|
279
|
+
|
|
280
|
+
@app.command()
|
|
281
|
+
@option("--keywords", "-k", help="Text for translation")
|
|
282
|
+
@option("--from", "-f", help="Language to translate from (defaults automatically)")
|
|
283
|
+
@option("--to", "-t", help="Language to translate to (default: 'en')", default="en")
|
|
284
|
+
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
285
|
+
def translate(keywords: str, from_: str, to: str, proxy: str = None):
|
|
286
|
+
"""Perform translation using DuckDuckGo API."""
|
|
287
|
+
webs = WEBS(proxy=proxy)
|
|
288
|
+
try:
|
|
289
|
+
webs.translate(keywords, from_, to)
|
|
290
|
+
except Exception as e:
|
|
291
|
+
logger.error(f"Error in translation: {e}")
|
|
292
|
+
raise e
|
|
293
|
+
|
|
294
|
+
@app.command()
|
|
295
|
+
@option("--keywords", "-k", help="Search keywords")
|
|
296
|
+
@option("--region", "-r", help="Region for search results", default="wt-wt")
|
|
297
|
+
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
298
|
+
def suggestions(keywords: str, region: str, proxy: str = None):
|
|
299
|
+
"""Perform a suggestions search using DuckDuckGo API."""
|
|
300
|
+
webs = WEBS(proxy=proxy)
|
|
301
|
+
try:
|
|
302
|
+
webs.suggestions(keywords, region)
|
|
303
|
+
except Exception as e:
|
|
304
|
+
logger.error(f"Error in suggestions search: {e}")
|
|
305
|
+
raise e
|
|
306
|
+
|
|
307
|
+
@app.command()
|
|
308
|
+
@option("--proxy", help="Proxy URL to use for requests")
|
|
309
|
+
def interactive(proxy: str = None):
|
|
310
|
+
"""Start an interactive search session with AI-powered responses."""
|
|
311
|
+
webs = WEBS(proxy=proxy)
|
|
312
|
+
try:
|
|
313
|
+
webs.interactive()
|
|
314
|
+
except Exception as e:
|
|
315
|
+
logger.error(f"Error in interactive mode: {e}")
|
|
316
|
+
raise e
|
|
317
|
+
|
|
318
|
+
def main():
|
|
319
|
+
"""Main entry point for the CLI."""
|
|
320
|
+
try:
|
|
321
|
+
app.run()
|
|
322
|
+
except Exception as e:
|
|
323
|
+
logger.error(f"Error: {e}")
|
|
324
|
+
sys.exit(1)
|
|
325
|
+
|
|
326
|
+
if __name__ == "__main__":
|
|
327
|
+
main()
|