webscout 6.3__py3-none-any.whl → 6.5__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 +0 -197
- webscout/AIutel.py +441 -1130
- webscout/DWEBS.py +189 -35
- webscout/{YTdownloader.py → Extra/YTToolkit/YTdownloader.py} +990 -1103
- webscout/Extra/YTToolkit/__init__.py +3 -0
- webscout/{transcriber.py → Extra/YTToolkit/transcriber.py} +479 -551
- webscout/Extra/YTToolkit/ytapi/__init__.py +6 -0
- webscout/Extra/YTToolkit/ytapi/channel.py +307 -0
- webscout/Extra/YTToolkit/ytapi/errors.py +13 -0
- webscout/Extra/YTToolkit/ytapi/extras.py +45 -0
- webscout/Extra/YTToolkit/ytapi/https.py +88 -0
- webscout/Extra/YTToolkit/ytapi/patterns.py +61 -0
- webscout/Extra/YTToolkit/ytapi/playlist.py +59 -0
- webscout/Extra/YTToolkit/ytapi/pool.py +8 -0
- webscout/Extra/YTToolkit/ytapi/query.py +37 -0
- webscout/Extra/YTToolkit/ytapi/stream.py +60 -0
- webscout/Extra/YTToolkit/ytapi/utils.py +62 -0
- webscout/Extra/YTToolkit/ytapi/video.py +102 -0
- webscout/Extra/__init__.py +3 -1
- webscout/Extra/autocoder/__init__.py +9 -0
- webscout/Extra/autocoder/autocoder_utiles.py +121 -0
- webscout/Extra/autocoder/rawdog.py +680 -0
- webscout/Extra/autollama.py +246 -195
- webscout/Extra/gguf.py +81 -56
- webscout/Extra/markdownlite/__init__.py +862 -0
- webscout/Extra/weather_ascii.py +2 -2
- webscout/LLM.py +206 -43
- webscout/Litlogger/__init__.py +681 -0
- webscout/Provider/DARKAI.py +1 -1
- webscout/Provider/EDITEE.py +1 -1
- webscout/Provider/NinjaChat.py +1 -1
- webscout/Provider/PI.py +120 -35
- webscout/Provider/Perplexity.py +590 -598
- webscout/Provider/Reka.py +0 -1
- 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 +2 -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/TTS/__init__.py +5 -1
- webscout/Provider/TTS/deepgram.py +183 -0
- webscout/Provider/TTS/elevenlabs.py +137 -0
- webscout/Provider/TTS/gesserit.py +151 -0
- webscout/Provider/TTS/murfai.py +139 -0
- webscout/Provider/TTS/parler.py +134 -107
- webscout/Provider/TTS/streamElements.py +360 -275
- webscout/Provider/TTS/utils.py +280 -0
- webscout/Provider/TTS/voicepod.py +116 -116
- webscout/Provider/__init__.py +8 -1
- webscout/Provider/askmyai.py +2 -2
- webscout/Provider/cerebras.py +227 -219
- webscout/Provider/llama3mitril.py +0 -1
- webscout/Provider/meta.py +794 -779
- webscout/Provider/mhystical.py +176 -0
- webscout/Provider/perplexitylabs.py +265 -0
- webscout/Provider/twitterclone.py +251 -245
- webscout/Provider/typegpt.py +358 -0
- webscout/__init__.py +9 -8
- webscout/__main__.py +5 -5
- webscout/cli.py +252 -280
- webscout/conversation.py +227 -0
- webscout/exceptions.py +161 -29
- webscout/litagent/__init__.py +172 -0
- webscout/litprinter/__init__.py +832 -0
- webscout/optimizers.py +270 -0
- webscout/prompt_manager.py +279 -0
- webscout/scout/__init__.py +11 -0
- webscout/scout/core.py +884 -0
- webscout/scout/element.py +459 -0
- webscout/scout/parsers/__init__.py +69 -0
- webscout/scout/parsers/html5lib_parser.py +172 -0
- webscout/scout/parsers/html_parser.py +236 -0
- webscout/scout/parsers/lxml_parser.py +178 -0
- webscout/scout/utils.py +38 -0
- webscout/swiftcli/__init__.py +810 -0
- webscout/update_checker.py +125 -0
- webscout/version.py +1 -1
- webscout/zeroart/__init__.py +55 -0
- webscout/zeroart/base.py +61 -0
- webscout/zeroart/effects.py +99 -0
- webscout/zeroart/fonts.py +816 -0
- webscout/zerodir/__init__.py +225 -0
- {webscout-6.3.dist-info → webscout-6.5.dist-info}/METADATA +37 -112
- webscout-6.5.dist-info/RECORD +179 -0
- webscout/Agents/Onlinesearcher.py +0 -182
- webscout/Agents/__init__.py +0 -2
- webscout/Agents/functioncall.py +0 -248
- webscout/Bing_search.py +0 -154
- webscout/Provider/TTI/AIuncensoredimage.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/Provider/TTI/talkai.py +0 -116
- webscout/g4f.py +0 -666
- webscout/models.py +0 -23
- webscout/requestsHTMLfix.py +0 -775
- webscout/webai.py +0 -2590
- webscout-6.3.dist-info/RECORD +0 -124
- {webscout-6.3.dist-info → webscout-6.5.dist-info}/LICENSE.md +0 -0
- {webscout-6.3.dist-info → webscout-6.5.dist-info}/WHEEL +0 -0
- {webscout-6.3.dist-info → webscout-6.5.dist-info}/entry_points.txt +0 -0
- {webscout-6.3.dist-info → webscout-6.5.dist-info}/top_level.txt +0 -0
webscout/cli.py
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
import csv
|
|
2
|
-
import logging
|
|
3
1
|
import os
|
|
2
|
+
import sys
|
|
4
3
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
5
4
|
from datetime import datetime
|
|
6
5
|
from urllib.parse import unquote
|
|
7
6
|
from pathlib import Path
|
|
8
|
-
import
|
|
7
|
+
from .swiftcli import CLI, option, argument, group
|
|
9
8
|
from curl_cffi import requests
|
|
10
9
|
import pyreqwest_impersonate as pri
|
|
11
10
|
from .webscout_search import WEBS
|
|
12
11
|
from .utils import json_dumps, json_loads
|
|
13
12
|
from .version import __version__
|
|
14
|
-
from .
|
|
15
|
-
|
|
16
|
-
# Import rich for panel interface
|
|
13
|
+
from .Litlogger import LitLogger, LogFormat, ColorScheme
|
|
14
|
+
from rich.console import Console
|
|
17
15
|
from rich.panel import Panel
|
|
18
16
|
from rich.markdown import Markdown
|
|
19
|
-
from rich.console import Console
|
|
20
17
|
from rich.table import Table
|
|
21
18
|
from rich.style import Style
|
|
22
19
|
from rich.text import Text
|
|
@@ -26,7 +23,12 @@ from rich.prompt import Prompt, Confirm
|
|
|
26
23
|
from rich.columns import Columns
|
|
27
24
|
from pyfiglet import figlet_format
|
|
28
25
|
|
|
29
|
-
logger =
|
|
26
|
+
logger = LitLogger(
|
|
27
|
+
name="webscout",
|
|
28
|
+
format=LogFormat.MODERN_EMOJI,
|
|
29
|
+
color_scheme=ColorScheme.CYBERPUNK,
|
|
30
|
+
console_output=True
|
|
31
|
+
)
|
|
30
32
|
|
|
31
33
|
COLORS = {
|
|
32
34
|
0: "black",
|
|
@@ -60,296 +62,266 @@ def _print_data(data):
|
|
|
60
62
|
if v:
|
|
61
63
|
width = 300 if k in ("content", "href", "image", "source", "thumbnail", "url") else 78
|
|
62
64
|
k = "language" if k == "detected_language" else k
|
|
63
|
-
text =
|
|
64
|
-
|
|
65
|
-
).replace("\n", "\n\n")
|
|
65
|
+
text = Text(f"{v}", style="white")
|
|
66
|
+
text = text.wrap(width=width, initial_indent="", subsequent_indent=" " * 18, preserve_paragraphs=True)
|
|
66
67
|
else:
|
|
67
|
-
text = v
|
|
68
|
+
text = Text(v, style="white")
|
|
68
69
|
table.add_row(k, text)
|
|
69
70
|
|
|
70
71
|
# Only the Panel has the title now
|
|
71
72
|
console.print(Panel(table, title=f"Result {i}", expand=False, style="green on black"))
|
|
72
73
|
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
74
|
|
|
75
|
+
# Initialize CLI app
|
|
76
|
+
app = CLI(name="webscout", help="Search the web with a rich UI", version=__version__)
|
|
101
77
|
|
|
102
|
-
@
|
|
78
|
+
@app.command()
|
|
103
79
|
def version():
|
|
104
|
-
"""
|
|
80
|
+
"""Show the version of webscout."""
|
|
105
81
|
console = Console()
|
|
106
|
-
console.print(
|
|
82
|
+
console.print(f"[bold green]webscout[/bold green] version: {__version__}")
|
|
107
83
|
|
|
108
|
-
|
|
109
|
-
@
|
|
110
|
-
@
|
|
111
|
-
def chat(proxy):
|
|
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"):
|
|
112
88
|
"""Interactive AI chat using DuckDuckGo's AI."""
|
|
113
|
-
|
|
114
|
-
client = WEBS(proxy=proxy)
|
|
115
|
-
|
|
89
|
+
webs = WEBS(proxy=proxy)
|
|
116
90
|
console = Console()
|
|
117
|
-
|
|
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
|
-
"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)")
|
|
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")
|
|
210
164
|
def images(
|
|
211
|
-
keywords,
|
|
212
|
-
region,
|
|
213
|
-
safesearch,
|
|
214
|
-
timelimit,
|
|
215
|
-
size,
|
|
216
|
-
color,
|
|
217
|
-
|
|
218
|
-
layout,
|
|
219
|
-
|
|
220
|
-
max_results,
|
|
221
|
-
proxy,
|
|
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,
|
|
222
176
|
):
|
|
223
|
-
"""
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
region
|
|
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
|
-
timelimit
|
|
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
|
-
@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)")
|
|
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")
|
|
293
244
|
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,
|
|
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,
|
|
307
258
|
):
|
|
308
|
-
"""
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
@
|
|
330
|
-
@
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
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):
|
|
350
310
|
"""Start an interactive search session with AI-powered responses."""
|
|
351
|
-
|
|
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
|
|
352
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)
|
|
353
325
|
|
|
354
326
|
if __name__ == "__main__":
|
|
355
|
-
|
|
327
|
+
main()
|