webscout 6.2b0__py3-none-any.whl → 6.3__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/AIbase.py +309 -239
- webscout/Agents/functioncall.py +248 -198
- webscout/DWEBS.py +322 -178
- webscout/Extra/gguf.py +250 -60
- webscout/Extra/weather.py +172 -67
- webscout/LLM.py +279 -100
- 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/Llama3.py +1 -1
- webscout/Provider/Marcus.py +137 -0
- webscout/Provider/TTI/__init__.py +2 -1
- webscout/Provider/TTI/talkai.py +116 -0
- webscout/Provider/__init__.py +10 -3
- webscout/Provider/askmyai.py +158 -0
- webscout/Provider/cerebras.py +71 -58
- webscout/Provider/geminiapi.py +208 -198
- webscout/Provider/llama3mitril.py +181 -0
- webscout/Provider/llmchat.py +203 -0
- webscout/Provider/talkai.py +196 -0
- webscout/Provider/twitterclone.py +7 -6
- webscout/cli.py +354 -346
- webscout/version.py +1 -1
- webscout-6.3.dist-info/LICENSE.md +211 -0
- {webscout-6.2b0.dist-info → webscout-6.3.dist-info}/METADATA +11 -13
- {webscout-6.2b0.dist-info → webscout-6.3.dist-info}/RECORD +31 -25
- webscout-6.2b0.dist-info/LICENSE.md +0 -50
- /webscout/Provider/TTI/{AIuncensored.py → AIuncensoredimage.py} +0 -0
- {webscout-6.2b0.dist-info → webscout-6.3.dist-info}/WHEEL +0 -0
- {webscout-6.2b0.dist-info → webscout-6.3.dist-info}/entry_points.txt +0 -0
- {webscout-6.2b0.dist-info → webscout-6.3.dist-info}/top_level.txt +0 -0
webscout/cli.py
CHANGED
|
@@ -1,347 +1,355 @@
|
|
|
1
|
-
import csv
|
|
2
|
-
import logging
|
|
3
|
-
import os
|
|
4
|
-
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
5
|
-
from datetime import datetime
|
|
6
|
-
from urllib.parse import unquote
|
|
7
|
-
from pathlib import Path
|
|
8
|
-
import click
|
|
9
|
-
from curl_cffi import requests
|
|
10
|
-
import pyreqwest_impersonate as pri
|
|
11
|
-
from .webscout_search import WEBS
|
|
12
|
-
from .utils import json_dumps, json_loads
|
|
13
|
-
from .version import __version__
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
from rich.
|
|
18
|
-
from rich.
|
|
19
|
-
from rich.
|
|
20
|
-
from rich.
|
|
21
|
-
from rich.
|
|
22
|
-
from rich.
|
|
23
|
-
from rich.
|
|
24
|
-
from rich.
|
|
25
|
-
from rich.
|
|
26
|
-
from
|
|
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
|
-
table
|
|
56
|
-
table.add_column("
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
console.print("
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
keywords
|
|
77
|
-
|
|
78
|
-
.replace("
|
|
79
|
-
.replace(
|
|
80
|
-
.replace("
|
|
81
|
-
.replace("
|
|
82
|
-
.replace("
|
|
83
|
-
.replace("
|
|
84
|
-
.replace("
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
console
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
console
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
@
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
console
|
|
117
|
-
console.print(
|
|
118
|
-
|
|
119
|
-
chosen_model_idx =
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
@
|
|
139
|
-
@click.option("-
|
|
140
|
-
@click.option("-
|
|
141
|
-
@click.option("-
|
|
142
|
-
@click.option("-
|
|
143
|
-
@click.option("-
|
|
144
|
-
@click.option("-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
@
|
|
159
|
-
@click.option("-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
@
|
|
168
|
-
@click.option("-
|
|
169
|
-
@click.option("-
|
|
170
|
-
@click.option("-
|
|
171
|
-
@click.option("-
|
|
172
|
-
@click.option(
|
|
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
|
-
@click.option(
|
|
201
|
-
|
|
202
|
-
"
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
)
|
|
207
|
-
|
|
208
|
-
@click.option("-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
@
|
|
240
|
-
@click.option("-
|
|
241
|
-
@click.option("-
|
|
242
|
-
@click.option("-
|
|
243
|
-
@click.option("-
|
|
244
|
-
@click.option("-
|
|
245
|
-
@click.option("-
|
|
246
|
-
@click.option("-
|
|
247
|
-
@click.option("-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
@
|
|
265
|
-
@click.option("-
|
|
266
|
-
@click.option("-
|
|
267
|
-
@click.option("-
|
|
268
|
-
@click.option("-
|
|
269
|
-
@click.option("-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
@
|
|
280
|
-
@click.option("-
|
|
281
|
-
@click.option("-
|
|
282
|
-
@click.option("-
|
|
283
|
-
@click.option("-
|
|
284
|
-
@click.option("-
|
|
285
|
-
@click.option("-
|
|
286
|
-
@click.option("-
|
|
287
|
-
@click.option("-
|
|
288
|
-
@click.option("-
|
|
289
|
-
@click.option("-
|
|
290
|
-
@click.option("-
|
|
291
|
-
@click.option("-
|
|
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
|
-
@click.option("-
|
|
328
|
-
@click.option("-
|
|
329
|
-
@click.option("-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
@
|
|
338
|
-
@click.option("-
|
|
339
|
-
@click.option("-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
1
|
+
import csv
|
|
2
|
+
import logging
|
|
3
|
+
import os
|
|
4
|
+
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
5
|
+
from datetime import datetime
|
|
6
|
+
from urllib.parse import unquote
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
import click
|
|
9
|
+
from curl_cffi import requests
|
|
10
|
+
import pyreqwest_impersonate as pri
|
|
11
|
+
from .webscout_search import WEBS
|
|
12
|
+
from .utils import json_dumps, json_loads
|
|
13
|
+
from .version import __version__
|
|
14
|
+
from .interactive import interactive_session
|
|
15
|
+
|
|
16
|
+
# Import rich for panel interface
|
|
17
|
+
from rich.panel import Panel
|
|
18
|
+
from rich.markdown import Markdown
|
|
19
|
+
from rich.console import Console
|
|
20
|
+
from rich.table import Table
|
|
21
|
+
from rich.style import Style
|
|
22
|
+
from rich.text import Text
|
|
23
|
+
from rich.align import Align
|
|
24
|
+
from rich.progress import track, Progress
|
|
25
|
+
from rich.prompt import Prompt, Confirm
|
|
26
|
+
from rich.columns import Columns
|
|
27
|
+
from pyfiglet import figlet_format
|
|
28
|
+
|
|
29
|
+
logger = logging.getLogger(__name__)
|
|
30
|
+
|
|
31
|
+
COLORS = {
|
|
32
|
+
0: "black",
|
|
33
|
+
1: "red",
|
|
34
|
+
2: "green",
|
|
35
|
+
3: "yellow",
|
|
36
|
+
4: "blue",
|
|
37
|
+
5: "magenta",
|
|
38
|
+
6: "cyan",
|
|
39
|
+
7: "bright_black",
|
|
40
|
+
8: "bright_red",
|
|
41
|
+
9: "bright_green",
|
|
42
|
+
10: "bright_yellow",
|
|
43
|
+
11: "bright_blue",
|
|
44
|
+
12: "bright_magenta",
|
|
45
|
+
13: "bright_cyan",
|
|
46
|
+
14: "white",
|
|
47
|
+
15: "bright_white",
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
def _print_data(data):
|
|
51
|
+
"""Prints data using rich panels and markdown."""
|
|
52
|
+
console = Console()
|
|
53
|
+
if data:
|
|
54
|
+
for i, e in enumerate(data, start=1):
|
|
55
|
+
table = Table(show_header=False, show_lines=True, expand=True, box=None) # Removed duplicate title
|
|
56
|
+
table.add_column("Key", style="cyan", no_wrap=True, width=15)
|
|
57
|
+
table.add_column("Value", style="white")
|
|
58
|
+
|
|
59
|
+
for j, (k, v) in enumerate(e.items(), start=1):
|
|
60
|
+
if v:
|
|
61
|
+
width = 300 if k in ("content", "href", "image", "source", "thumbnail", "url") else 78
|
|
62
|
+
k = "language" if k == "detected_language" else k
|
|
63
|
+
text = click.wrap_text(
|
|
64
|
+
f"{v}", width=width, initial_indent="", subsequent_indent=" " * 18, preserve_paragraphs=True
|
|
65
|
+
).replace("\n", "\n\n")
|
|
66
|
+
else:
|
|
67
|
+
text = v
|
|
68
|
+
table.add_row(k, text)
|
|
69
|
+
|
|
70
|
+
# Only the Panel has the title now
|
|
71
|
+
console.print(Panel(table, title=f"Result {i}", expand=False, style="green on black"))
|
|
72
|
+
console.print("\n")
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _sanitize_keywords(keywords):
|
|
76
|
+
"""Sanitizes keywords for file names and paths. Removes invalid characters like ':'. """
|
|
77
|
+
keywords = (
|
|
78
|
+
keywords.replace("filetype", "")
|
|
79
|
+
.replace(":", "")
|
|
80
|
+
.replace('"', "'")
|
|
81
|
+
.replace("site", "")
|
|
82
|
+
.replace(" ", "_")
|
|
83
|
+
.replace("/", "_")
|
|
84
|
+
.replace("\\", "_")
|
|
85
|
+
.replace(" ", "")
|
|
86
|
+
)
|
|
87
|
+
return keywords
|
|
88
|
+
|
|
89
|
+
@click.group(chain=True)
|
|
90
|
+
def cli():
|
|
91
|
+
"""webscout CLI tool - Search the web with a rich UI."""
|
|
92
|
+
console = Console()
|
|
93
|
+
console.print(f"[bold blue]{figlet_format('Webscout')}[/]\n", justify="center")
|
|
94
|
+
|
|
95
|
+
def safe_entry_point():
|
|
96
|
+
try:
|
|
97
|
+
cli()
|
|
98
|
+
except Exception as ex:
|
|
99
|
+
click.echo(f"{type(ex).__name__}: {ex}")
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
@cli.command()
|
|
103
|
+
def version():
|
|
104
|
+
"""Shows the current version of webscout."""
|
|
105
|
+
console = Console()
|
|
106
|
+
console.print(Panel(Text(f"webscout v{__version__}", style="cyan"), title="Version", expand=False))
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
@cli.command()
|
|
110
|
+
@click.option("-p", "--proxy", default=None, help="Proxy to send requests (e.g., socks5://localhost:9150)")
|
|
111
|
+
def chat(proxy):
|
|
112
|
+
"""Interactive AI chat using DuckDuckGo's AI."""
|
|
113
|
+
models = ["gpt-3.5", "claude-3-haiku", "llama-3-70b", "mixtral-8x7b"]
|
|
114
|
+
client = WEBS(proxy=proxy)
|
|
115
|
+
|
|
116
|
+
console = Console()
|
|
117
|
+
console.print(Panel(Text("Available AI Models:", style="cyan"), title="DuckDuckGo AI Chat", expand=False))
|
|
118
|
+
console.print(Columns([Panel(Text(model, justify="center"), expand=True) for model in models]))
|
|
119
|
+
chosen_model_idx = Prompt.ask("[bold cyan]Choose a model by entering its number[/] [1]", choices=[str(i) for i in range(1, len(models) + 1)], default="1")
|
|
120
|
+
chosen_model_idx = int(chosen_model_idx) - 1
|
|
121
|
+
model = models[chosen_model_idx]
|
|
122
|
+
console.print(f"[bold green]Using model:[/] {model}")
|
|
123
|
+
|
|
124
|
+
while True:
|
|
125
|
+
user_input = Prompt.ask(f"{'-'*78}\n[bold blue]You:[/]")
|
|
126
|
+
if not user_input.strip():
|
|
127
|
+
break
|
|
128
|
+
|
|
129
|
+
resp_answer = client.chat(keywords=user_input, model=model)
|
|
130
|
+
text = click.wrap_text(resp_answer, width=78, preserve_paragraphs=True)
|
|
131
|
+
console.print(Panel(Text(f"AI: {text}", style="green"), title="AI Response"))
|
|
132
|
+
|
|
133
|
+
if "exit" in user_input.lower() or "quit" in user_input.lower():
|
|
134
|
+
console.print(Panel(Text("Exiting chat session.", style="cyan"), title="Goodbye", expand=False))
|
|
135
|
+
break
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
@cli.command()
|
|
139
|
+
@click.option("-k", "--keywords", required=True, help="Keywords for text search.")
|
|
140
|
+
@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.")
|
|
141
|
+
@click.option("-s", "--safesearch", default="moderate", type=click.Choice(["on", "moderate", "off"]), help="Safe search level.")
|
|
142
|
+
@click.option("-t", "--timelimit", default=None, type=click.Choice(["d", "w", "m", "y"]), help="Time limit (d: day, w: week, m: month, y: year).")
|
|
143
|
+
@click.option("-m", "--max_results", default=20, help="Maximum number of results to retrieve (default: 20).")
|
|
144
|
+
@click.option("-b", "--backend", default="api", type=click.Choice(["api", "html", "lite"]), help="Backend to use (api, html, lite).")
|
|
145
|
+
@click.option("-p", "--proxy", default=None, help="Proxy to send requests (e.g., socks5://localhost:9150)")
|
|
146
|
+
def text(keywords, region, safesearch, timelimit, backend, max_results, proxy):
|
|
147
|
+
"""Performs a text search using DuckDuckGo API with a rich UI."""
|
|
148
|
+
data = WEBS(proxy=proxy).text(
|
|
149
|
+
keywords=keywords,
|
|
150
|
+
region=region,
|
|
151
|
+
safesearch=safesearch,
|
|
152
|
+
timelimit=timelimit,
|
|
153
|
+
backend=backend,
|
|
154
|
+
max_results=max_results,
|
|
155
|
+
)
|
|
156
|
+
_print_data(data)
|
|
157
|
+
|
|
158
|
+
@cli.command()
|
|
159
|
+
@click.option("-k", "--keywords", required=True, help="Keywords for answers search.")
|
|
160
|
+
@click.option("-p", "--proxy", default=None, help="Proxy to send requests (e.g., socks5://localhost:9150)")
|
|
161
|
+
def answers(keywords, proxy):
|
|
162
|
+
"""Performs an answers search using DuckDuckGo API with a rich UI."""
|
|
163
|
+
data = WEBS(proxy=proxy).answers(keywords=keywords)
|
|
164
|
+
_print_data(data)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
@cli.command()
|
|
168
|
+
@click.option("-k", "--keywords", required=True, help="Keywords for images search.")
|
|
169
|
+
@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.")
|
|
170
|
+
@click.option("-s", "--safesearch", default="moderate", type=click.Choice(["on", "moderate", "off"]), help="Safe search level.")
|
|
171
|
+
@click.option("-t", "--timelimit", default=None, type=click.Choice(["Day", "Week", "Month", "Year"]), help="Time limit (Day, Week, Month, Year).")
|
|
172
|
+
@click.option("-size", "--size", default=None, type=click.Choice(["Small", "Medium", "Large", "Wallpaper"]), help="Image size (Small, Medium, Large, Wallpaper).")
|
|
173
|
+
@click.option(
|
|
174
|
+
"-c",
|
|
175
|
+
"--color",
|
|
176
|
+
default=None,
|
|
177
|
+
type=click.Choice(
|
|
178
|
+
[
|
|
179
|
+
"color",
|
|
180
|
+
"Monochrome",
|
|
181
|
+
"Red",
|
|
182
|
+
"Orange",
|
|
183
|
+
"Yellow",
|
|
184
|
+
"Green",
|
|
185
|
+
"Blue",
|
|
186
|
+
"Purple",
|
|
187
|
+
"Pink",
|
|
188
|
+
"Brown",
|
|
189
|
+
"Black",
|
|
190
|
+
"Gray",
|
|
191
|
+
"Teal",
|
|
192
|
+
"White",
|
|
193
|
+
]
|
|
194
|
+
),
|
|
195
|
+
help="Image color (color, Monochrome, Red, Orange, Yellow, Green, Blue, Purple, Pink, Brown, Black, Gray, Teal, White).",
|
|
196
|
+
)
|
|
197
|
+
@click.option(
|
|
198
|
+
"-type", "--type_image", default=None, type=click.Choice(["photo", "clipart", "gif", "transparent", "line"]), help="Image type (photo, clipart, gif, transparent, line)."
|
|
199
|
+
)
|
|
200
|
+
@click.option("-l", "--layout", default=None, type=click.Choice(["Square", "Tall", "Wide"]), help="Image layout (Square, Tall, Wide).")
|
|
201
|
+
@click.option(
|
|
202
|
+
"-lic",
|
|
203
|
+
"--license_image",
|
|
204
|
+
default=None,
|
|
205
|
+
type=click.Choice(["any", "Public", "Share", "Modify", "ModifyCommercially"]),
|
|
206
|
+
help="Image license (any, Public, Share, Modify, ModifyCommercially).",
|
|
207
|
+
)
|
|
208
|
+
@click.option("-m", "--max_results", default=90, help="Maximum number of results to retrieve (default: 90).")
|
|
209
|
+
@click.option("-p", "--proxy", default=None, help="Proxy to send requests (e.g., socks5://localhost:9150)")
|
|
210
|
+
def images(
|
|
211
|
+
keywords,
|
|
212
|
+
region,
|
|
213
|
+
safesearch,
|
|
214
|
+
timelimit,
|
|
215
|
+
size,
|
|
216
|
+
color,
|
|
217
|
+
type_image,
|
|
218
|
+
layout,
|
|
219
|
+
license_image,
|
|
220
|
+
max_results,
|
|
221
|
+
proxy,
|
|
222
|
+
):
|
|
223
|
+
"""Performs an images search using DuckDuckGo API with a rich UI."""
|
|
224
|
+
data = WEBS(proxy=proxy).images(
|
|
225
|
+
keywords=keywords,
|
|
226
|
+
region=region,
|
|
227
|
+
safesearch=safesearch,
|
|
228
|
+
timelimit=timelimit,
|
|
229
|
+
size=size,
|
|
230
|
+
color=color,
|
|
231
|
+
type_image=type_image,
|
|
232
|
+
layout=layout,
|
|
233
|
+
license_image=license_image,
|
|
234
|
+
max_results=max_results,
|
|
235
|
+
)
|
|
236
|
+
_print_data(data)
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
@cli.command()
|
|
240
|
+
@click.option("-k", "--keywords", required=True, help="Keywords for videos search.")
|
|
241
|
+
@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.")
|
|
242
|
+
@click.option("-s", "--safesearch", default="moderate", type=click.Choice(["on", "moderate", "off"]), help="Safe search level.")
|
|
243
|
+
@click.option("-t", "--timelimit", default=None, type=click.Choice(["d", "w", "m"]), help="Time limit (d: day, w: week, m: month).")
|
|
244
|
+
@click.option("-res", "--resolution", default=None, type=click.Choice(["high", "standart"]), help="Video resolution (high, standart).")
|
|
245
|
+
@click.option("-d", "--duration", default=None, type=click.Choice(["short", "medium", "long"]), help="Video duration (short, medium, long).")
|
|
246
|
+
@click.option("-lic", "--license_videos", default=None, type=click.Choice(["creativeCommon", "youtube"]), help="Video license (creativeCommon, youtube).")
|
|
247
|
+
@click.option("-m", "--max_results", default=50, help="Maximum number of results to retrieve (default: 50).")
|
|
248
|
+
@click.option("-p", "--proxy", default=None, help="Proxy to send requests (e.g., socks5://localhost:9150)")
|
|
249
|
+
def videos(keywords, region, safesearch, timelimit, resolution, duration, license_videos, max_results, proxy):
|
|
250
|
+
"""Performs a videos search using DuckDuckGo API with a rich UI."""
|
|
251
|
+
data = WEBS(proxy=proxy).videos(
|
|
252
|
+
keywords=keywords,
|
|
253
|
+
region=region,
|
|
254
|
+
safesearch=safesearch,
|
|
255
|
+
timelimit=timelimit,
|
|
256
|
+
resolution=resolution,
|
|
257
|
+
duration=duration,
|
|
258
|
+
license_videos=license_videos,
|
|
259
|
+
max_results=max_results,
|
|
260
|
+
)
|
|
261
|
+
_print_data(data)
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
@cli.command()
|
|
265
|
+
@click.option("-k", "--keywords", required=True, help="Keywords for news search.")
|
|
266
|
+
@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.")
|
|
267
|
+
@click.option("-s", "--safesearch", default="moderate", type=click.Choice(["on", "moderate", "off"]), help="Safe search level.")
|
|
268
|
+
@click.option("-t", "--timelimit", default=None, type=click.Choice(["d", "w", "m", "y"]), help="Time limit (d: day, w: week, m: month, y: year).")
|
|
269
|
+
@click.option("-m", "--max_results", default=25, help="Maximum number of results to retrieve (default: 25).")
|
|
270
|
+
@click.option("-p", "--proxy", default=None, help="Proxy to send requests (e.g., socks5://localhost:9150)")
|
|
271
|
+
def news(keywords, region, safesearch, timelimit, max_results, proxy):
|
|
272
|
+
"""Performs a news search using DuckDuckGo API with a rich UI."""
|
|
273
|
+
data = WEBS(proxy=proxy).news(
|
|
274
|
+
keywords=keywords, region=region, safesearch=safesearch, timelimit=timelimit, max_results=max_results
|
|
275
|
+
)
|
|
276
|
+
_print_data(data)
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
@cli.command()
|
|
280
|
+
@click.option("-k", "--keywords", required=True, help="Keywords for maps search.")
|
|
281
|
+
@click.option("-p", "--place", default=None, help="Simplified search - if set, the other parameters are not used.")
|
|
282
|
+
@click.option("-s", "--street", default=None, help="House number/street.")
|
|
283
|
+
@click.option("-c", "--city", default=None, help="City of search.")
|
|
284
|
+
@click.option("-county", "--county", default=None, help="County of search.")
|
|
285
|
+
@click.option("-state", "--state", default=None, help="State of search.")
|
|
286
|
+
@click.option("-country", "--country", default=None, help="Country of search.")
|
|
287
|
+
@click.option("-post", "--postalcode", default=None, help="Postal code of search.")
|
|
288
|
+
@click.option("-lat", "--latitude", default=None, help="Geographic coordinate (north-south position).")
|
|
289
|
+
@click.option("-lon", "--longitude", default=None, help="Geographic coordinate (east-west position); if latitude and longitude are set, the other parameters are not used.")
|
|
290
|
+
@click.option("-r", "--radius", default=0, help="Expand the search square by the distance in kilometers.")
|
|
291
|
+
@click.option("-m", "--max_results", default=50, help="Number of results (default: 50).")
|
|
292
|
+
@click.option("-p", "--proxy", default=None, help="Proxy to send requests (e.g., socks5://localhost:9150)")
|
|
293
|
+
def maps(
|
|
294
|
+
keywords,
|
|
295
|
+
place,
|
|
296
|
+
street,
|
|
297
|
+
city,
|
|
298
|
+
county,
|
|
299
|
+
state,
|
|
300
|
+
country,
|
|
301
|
+
postalcode,
|
|
302
|
+
latitude,
|
|
303
|
+
longitude,
|
|
304
|
+
radius,
|
|
305
|
+
max_results,
|
|
306
|
+
proxy,
|
|
307
|
+
):
|
|
308
|
+
"""Performs a maps search using DuckDuckGo API with a rich UI."""
|
|
309
|
+
data = WEBS(proxy=proxy).maps(
|
|
310
|
+
keywords=keywords,
|
|
311
|
+
place=place,
|
|
312
|
+
street=street,
|
|
313
|
+
city=city,
|
|
314
|
+
county=county,
|
|
315
|
+
state=state,
|
|
316
|
+
country=country,
|
|
317
|
+
postalcode=postalcode,
|
|
318
|
+
latitude=latitude,
|
|
319
|
+
longitude=longitude,
|
|
320
|
+
radius=radius,
|
|
321
|
+
max_results=max_results,
|
|
322
|
+
)
|
|
323
|
+
_print_data(data)
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
@cli.command()
|
|
327
|
+
@click.option("-k", "--keywords", required=True, help="Text for translation.")
|
|
328
|
+
@click.option("-f", "--from_", help="Language to translate from (defaults automatically).")
|
|
329
|
+
@click.option("-t", "--to", default="en", help="Language to translate to (default: 'en').")
|
|
330
|
+
@click.option("-p", "--proxy", default=None, help="Proxy to send requests (e.g., socks5://localhost:9150)")
|
|
331
|
+
def translate(keywords, from_, to, proxy):
|
|
332
|
+
"""Performs translation using DuckDuckGo API with a rich UI."""
|
|
333
|
+
data = WEBS(proxy=proxy).translate(keywords=keywords, from_=from_, to=to)
|
|
334
|
+
_print_data(data)
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
@cli.command()
|
|
338
|
+
@click.option("-k", "--keywords", required=True, help="Keywords for query.")
|
|
339
|
+
@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.")
|
|
340
|
+
@click.option("-p", "--proxy", default=None, help="Proxy to send requests (e.g., socks5://localhost:9150)")
|
|
341
|
+
def suggestions(keywords, region, proxy):
|
|
342
|
+
"""Performs a suggestions search using DuckDuckGo API with a rich UI."""
|
|
343
|
+
data = WEBS(proxy=proxy).suggestions(keywords=keywords, region=region)
|
|
344
|
+
_print_data(data)
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
@cli.command()
|
|
348
|
+
@click.option("--proxy", help="Proxy to use for requests", default=None)
|
|
349
|
+
def interactive(proxy):
|
|
350
|
+
"""Start an interactive search session with AI-powered responses."""
|
|
351
|
+
interactive_session()
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
if __name__ == "__main__":
|
|
347
355
|
cli(prog_name="WEBS")
|