webscout 8.3.7__py3-none-any.whl → 2025.10.11__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 +250 -250
- webscout/AIbase.py +379 -379
- webscout/AIutel.py +60 -60
- webscout/Bard.py +1012 -1012
- webscout/Bing_search.py +417 -417
- webscout/DWEBS.py +529 -529
- webscout/Extra/Act.md +309 -309
- webscout/Extra/GitToolkit/__init__.py +10 -10
- webscout/Extra/GitToolkit/gitapi/README.md +110 -110
- webscout/Extra/GitToolkit/gitapi/__init__.py +11 -11
- webscout/Extra/GitToolkit/gitapi/repository.py +195 -195
- webscout/Extra/GitToolkit/gitapi/user.py +96 -96
- webscout/Extra/GitToolkit/gitapi/utils.py +61 -61
- webscout/Extra/YTToolkit/README.md +375 -375
- webscout/Extra/YTToolkit/YTdownloader.py +956 -956
- webscout/Extra/YTToolkit/__init__.py +2 -2
- webscout/Extra/YTToolkit/transcriber.py +475 -475
- webscout/Extra/YTToolkit/ytapi/README.md +44 -44
- webscout/Extra/YTToolkit/ytapi/__init__.py +6 -6
- webscout/Extra/YTToolkit/ytapi/channel.py +307 -307
- webscout/Extra/YTToolkit/ytapi/errors.py +13 -13
- webscout/Extra/YTToolkit/ytapi/extras.py +118 -118
- webscout/Extra/YTToolkit/ytapi/https.py +88 -88
- webscout/Extra/YTToolkit/ytapi/patterns.py +61 -61
- webscout/Extra/YTToolkit/ytapi/playlist.py +58 -58
- webscout/Extra/YTToolkit/ytapi/pool.py +7 -7
- webscout/Extra/YTToolkit/ytapi/query.py +39 -39
- webscout/Extra/YTToolkit/ytapi/stream.py +62 -62
- webscout/Extra/YTToolkit/ytapi/utils.py +62 -62
- webscout/Extra/YTToolkit/ytapi/video.py +232 -232
- webscout/Extra/autocoder/__init__.py +9 -9
- webscout/Extra/autocoder/autocoder.py +1105 -1105
- webscout/Extra/autocoder/autocoder_utiles.py +332 -332
- webscout/Extra/gguf.md +429 -429
- webscout/Extra/gguf.py +1213 -1213
- webscout/Extra/tempmail/README.md +487 -487
- webscout/Extra/tempmail/__init__.py +27 -27
- webscout/Extra/tempmail/async_utils.py +140 -140
- webscout/Extra/tempmail/base.py +160 -160
- webscout/Extra/tempmail/cli.py +186 -186
- webscout/Extra/tempmail/emailnator.py +84 -84
- webscout/Extra/tempmail/mail_tm.py +360 -360
- webscout/Extra/tempmail/temp_mail_io.py +291 -291
- webscout/Extra/weather.md +281 -281
- webscout/Extra/weather.py +193 -193
- webscout/Litlogger/README.md +10 -10
- webscout/Litlogger/__init__.py +15 -15
- webscout/Litlogger/formats.py +13 -13
- webscout/Litlogger/handlers.py +121 -121
- webscout/Litlogger/levels.py +13 -13
- webscout/Litlogger/logger.py +134 -134
- webscout/Provider/AISEARCH/Perplexity.py +332 -332
- webscout/Provider/AISEARCH/README.md +279 -279
- webscout/Provider/AISEARCH/__init__.py +16 -1
- webscout/Provider/AISEARCH/felo_search.py +206 -206
- webscout/Provider/AISEARCH/genspark_search.py +323 -323
- webscout/Provider/AISEARCH/hika_search.py +185 -185
- webscout/Provider/AISEARCH/iask_search.py +410 -410
- webscout/Provider/AISEARCH/monica_search.py +219 -219
- webscout/Provider/AISEARCH/scira_search.py +316 -316
- webscout/Provider/AISEARCH/stellar_search.py +177 -177
- webscout/Provider/AISEARCH/webpilotai_search.py +255 -255
- webscout/Provider/Aitopia.py +314 -314
- webscout/Provider/Apriel.py +306 -0
- webscout/Provider/ChatGPTClone.py +236 -236
- webscout/Provider/ChatSandbox.py +343 -343
- webscout/Provider/Cloudflare.py +324 -324
- webscout/Provider/Cohere.py +208 -208
- webscout/Provider/Deepinfra.py +370 -366
- webscout/Provider/ExaAI.py +260 -260
- webscout/Provider/ExaChat.py +308 -308
- webscout/Provider/Flowith.py +221 -221
- webscout/Provider/GMI.py +293 -0
- webscout/Provider/Gemini.py +164 -164
- webscout/Provider/GeminiProxy.py +167 -167
- webscout/Provider/GithubChat.py +371 -372
- webscout/Provider/Groq.py +800 -800
- webscout/Provider/HeckAI.py +383 -383
- webscout/Provider/Jadve.py +282 -282
- webscout/Provider/K2Think.py +307 -307
- webscout/Provider/Koboldai.py +205 -205
- webscout/Provider/LambdaChat.py +423 -423
- webscout/Provider/Nemotron.py +244 -244
- webscout/Provider/Netwrck.py +248 -248
- webscout/Provider/OLLAMA.py +395 -395
- webscout/Provider/OPENAI/Cloudflare.py +393 -393
- webscout/Provider/OPENAI/FalconH1.py +451 -451
- webscout/Provider/OPENAI/FreeGemini.py +296 -296
- webscout/Provider/OPENAI/K2Think.py +431 -431
- webscout/Provider/OPENAI/NEMOTRON.py +240 -240
- webscout/Provider/OPENAI/PI.py +427 -427
- webscout/Provider/OPENAI/README.md +959 -959
- webscout/Provider/OPENAI/TogetherAI.py +345 -345
- webscout/Provider/OPENAI/TwoAI.py +465 -465
- webscout/Provider/OPENAI/__init__.py +33 -18
- webscout/Provider/OPENAI/base.py +248 -248
- webscout/Provider/OPENAI/chatglm.py +528 -0
- webscout/Provider/OPENAI/chatgpt.py +592 -592
- webscout/Provider/OPENAI/chatgptclone.py +521 -521
- webscout/Provider/OPENAI/chatsandbox.py +202 -202
- webscout/Provider/OPENAI/deepinfra.py +318 -314
- webscout/Provider/OPENAI/e2b.py +1665 -1665
- webscout/Provider/OPENAI/exaai.py +420 -420
- webscout/Provider/OPENAI/exachat.py +452 -452
- webscout/Provider/OPENAI/friendli.py +232 -232
- webscout/Provider/OPENAI/{refact.py → gmi.py} +324 -274
- webscout/Provider/OPENAI/groq.py +364 -364
- webscout/Provider/OPENAI/heckai.py +314 -314
- webscout/Provider/OPENAI/llmchatco.py +337 -337
- webscout/Provider/OPENAI/netwrck.py +355 -355
- webscout/Provider/OPENAI/oivscode.py +290 -290
- webscout/Provider/OPENAI/opkfc.py +518 -518
- webscout/Provider/OPENAI/pydantic_imports.py +1 -1
- webscout/Provider/OPENAI/scirachat.py +535 -535
- webscout/Provider/OPENAI/sonus.py +308 -308
- webscout/Provider/OPENAI/standardinput.py +442 -442
- webscout/Provider/OPENAI/textpollinations.py +340 -340
- webscout/Provider/OPENAI/toolbaz.py +419 -416
- webscout/Provider/OPENAI/typefully.py +362 -362
- webscout/Provider/OPENAI/utils.py +295 -295
- webscout/Provider/OPENAI/venice.py +436 -436
- webscout/Provider/OPENAI/wisecat.py +387 -387
- webscout/Provider/OPENAI/writecream.py +166 -166
- webscout/Provider/OPENAI/x0gpt.py +378 -378
- webscout/Provider/OPENAI/yep.py +389 -389
- webscout/Provider/OpenGPT.py +230 -230
- webscout/Provider/Openai.py +243 -243
- webscout/Provider/PI.py +405 -405
- webscout/Provider/Perplexitylabs.py +430 -430
- webscout/Provider/QwenLM.py +272 -272
- webscout/Provider/STT/__init__.py +16 -1
- webscout/Provider/Sambanova.py +257 -257
- webscout/Provider/StandardInput.py +309 -309
- webscout/Provider/TTI/README.md +82 -82
- webscout/Provider/TTI/__init__.py +33 -18
- webscout/Provider/TTI/aiarta.py +413 -413
- webscout/Provider/TTI/base.py +136 -136
- webscout/Provider/TTI/bing.py +243 -243
- webscout/Provider/TTI/gpt1image.py +149 -149
- webscout/Provider/TTI/imagen.py +196 -196
- webscout/Provider/TTI/infip.py +211 -211
- webscout/Provider/TTI/magicstudio.py +232 -232
- webscout/Provider/TTI/monochat.py +219 -219
- webscout/Provider/TTI/piclumen.py +214 -214
- webscout/Provider/TTI/pixelmuse.py +232 -232
- webscout/Provider/TTI/pollinations.py +232 -232
- webscout/Provider/TTI/together.py +288 -288
- webscout/Provider/TTI/utils.py +12 -12
- webscout/Provider/TTI/venice.py +367 -367
- webscout/Provider/TTS/README.md +192 -192
- webscout/Provider/TTS/__init__.py +33 -18
- webscout/Provider/TTS/parler.py +110 -110
- webscout/Provider/TTS/streamElements.py +333 -333
- webscout/Provider/TTS/utils.py +280 -280
- webscout/Provider/TeachAnything.py +237 -237
- webscout/Provider/TextPollinationsAI.py +310 -310
- webscout/Provider/TogetherAI.py +356 -356
- webscout/Provider/TwoAI.py +312 -312
- webscout/Provider/TypliAI.py +311 -311
- webscout/Provider/UNFINISHED/ChatHub.py +208 -208
- webscout/Provider/UNFINISHED/ChutesAI.py +313 -313
- webscout/Provider/UNFINISHED/GizAI.py +294 -294
- webscout/Provider/UNFINISHED/Marcus.py +198 -198
- webscout/Provider/UNFINISHED/Qodo.py +477 -477
- webscout/Provider/UNFINISHED/VercelAIGateway.py +338 -338
- webscout/Provider/UNFINISHED/XenAI.py +324 -324
- webscout/Provider/UNFINISHED/Youchat.py +330 -330
- webscout/Provider/UNFINISHED/liner.py +334 -0
- webscout/Provider/UNFINISHED/liner_api_request.py +262 -262
- webscout/Provider/UNFINISHED/puterjs.py +634 -634
- webscout/Provider/UNFINISHED/samurai.py +223 -223
- webscout/Provider/UNFINISHED/test_lmarena.py +119 -119
- webscout/Provider/Venice.py +250 -250
- webscout/Provider/VercelAI.py +256 -256
- webscout/Provider/WiseCat.py +231 -231
- webscout/Provider/WrDoChat.py +366 -366
- webscout/Provider/__init__.py +33 -18
- webscout/Provider/ai4chat.py +174 -174
- webscout/Provider/akashgpt.py +331 -331
- webscout/Provider/cerebras.py +446 -446
- webscout/Provider/chatglm.py +394 -301
- webscout/Provider/cleeai.py +211 -211
- webscout/Provider/elmo.py +282 -282
- webscout/Provider/geminiapi.py +208 -208
- webscout/Provider/granite.py +261 -261
- webscout/Provider/hermes.py +263 -263
- webscout/Provider/julius.py +223 -223
- webscout/Provider/learnfastai.py +309 -309
- webscout/Provider/llama3mitril.py +214 -214
- webscout/Provider/llmchat.py +243 -243
- webscout/Provider/llmchatco.py +290 -290
- webscout/Provider/meta.py +801 -801
- webscout/Provider/oivscode.py +309 -309
- webscout/Provider/scira_chat.py +383 -383
- webscout/Provider/searchchat.py +292 -292
- webscout/Provider/sonus.py +258 -258
- webscout/Provider/toolbaz.py +370 -367
- webscout/Provider/turboseek.py +273 -273
- webscout/Provider/typefully.py +207 -207
- webscout/Provider/yep.py +372 -372
- webscout/__init__.py +30 -31
- webscout/__main__.py +5 -5
- webscout/auth/api_key_manager.py +189 -189
- webscout/auth/config.py +175 -175
- webscout/auth/models.py +185 -185
- webscout/auth/routes.py +664 -664
- webscout/auth/simple_logger.py +236 -236
- webscout/cli.py +523 -523
- webscout/conversation.py +438 -438
- webscout/exceptions.py +361 -361
- webscout/litagent/Readme.md +298 -298
- webscout/litagent/__init__.py +28 -28
- webscout/litagent/agent.py +581 -581
- webscout/litagent/constants.py +59 -59
- webscout/litprinter/__init__.py +58 -58
- webscout/models.py +181 -181
- webscout/optimizers.py +419 -419
- webscout/prompt_manager.py +288 -288
- webscout/sanitize.py +1078 -1078
- webscout/scout/README.md +401 -401
- webscout/scout/__init__.py +8 -8
- webscout/scout/core/__init__.py +6 -6
- webscout/scout/core/crawler.py +297 -297
- webscout/scout/core/scout.py +706 -706
- webscout/scout/core/search_result.py +95 -95
- webscout/scout/core/text_analyzer.py +62 -62
- webscout/scout/core/text_utils.py +277 -277
- webscout/scout/core/web_analyzer.py +51 -51
- webscout/scout/element.py +599 -599
- webscout/scout/parsers/__init__.py +69 -69
- webscout/scout/parsers/html5lib_parser.py +172 -172
- webscout/scout/parsers/html_parser.py +236 -236
- webscout/scout/parsers/lxml_parser.py +178 -178
- webscout/scout/utils.py +37 -37
- webscout/swiftcli/Readme.md +323 -323
- webscout/swiftcli/__init__.py +95 -95
- webscout/swiftcli/core/__init__.py +7 -7
- webscout/swiftcli/core/cli.py +308 -308
- webscout/swiftcli/core/context.py +104 -104
- webscout/swiftcli/core/group.py +241 -241
- webscout/swiftcli/decorators/__init__.py +28 -28
- webscout/swiftcli/decorators/command.py +221 -221
- webscout/swiftcli/decorators/options.py +220 -220
- webscout/swiftcli/decorators/output.py +302 -302
- webscout/swiftcli/exceptions.py +21 -21
- webscout/swiftcli/plugins/__init__.py +9 -9
- webscout/swiftcli/plugins/base.py +135 -135
- webscout/swiftcli/plugins/manager.py +269 -269
- webscout/swiftcli/utils/__init__.py +59 -59
- webscout/swiftcli/utils/formatting.py +252 -252
- webscout/swiftcli/utils/parsing.py +267 -267
- webscout/update_checker.py +117 -117
- webscout/version.py +1 -1
- webscout/webscout_search.py +1183 -1183
- webscout/webscout_search_async.py +649 -649
- webscout/yep_search.py +346 -346
- webscout/zeroart/README.md +89 -89
- webscout/zeroart/__init__.py +134 -134
- webscout/zeroart/base.py +66 -66
- webscout/zeroart/effects.py +100 -100
- webscout/zeroart/fonts.py +1238 -1238
- {webscout-8.3.7.dist-info → webscout-2025.10.11.dist-info}/METADATA +937 -937
- webscout-2025.10.11.dist-info/RECORD +300 -0
- webscout/Provider/AISEARCH/DeepFind.py +0 -254
- webscout/Provider/OPENAI/Qwen3.py +0 -303
- webscout/Provider/OPENAI/qodo.py +0 -630
- webscout/Provider/OPENAI/xenai.py +0 -514
- webscout/tempid.py +0 -134
- webscout-8.3.7.dist-info/RECORD +0 -301
- {webscout-8.3.7.dist-info → webscout-2025.10.11.dist-info}/WHEEL +0 -0
- {webscout-8.3.7.dist-info → webscout-2025.10.11.dist-info}/entry_points.txt +0 -0
- {webscout-8.3.7.dist-info → webscout-2025.10.11.dist-info}/licenses/LICENSE.md +0 -0
- {webscout-8.3.7.dist-info → webscout-2025.10.11.dist-info}/top_level.txt +0 -0
webscout/cli.py
CHANGED
|
@@ -1,524 +1,524 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
from .swiftcli import CLI, option
|
|
3
|
-
from .webscout_search import WEBS # Import the WEBS class from webscout_search
|
|
4
|
-
from .DWEBS import GoogleSearch # Import GoogleSearch from DWEBS
|
|
5
|
-
from .yep_search import YepSearch # Import YepSearch from yep_search
|
|
6
|
-
from .version import __version__
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def _print_data(data):
|
|
10
|
-
"""Prints data in a simple formatted way."""
|
|
11
|
-
if data:
|
|
12
|
-
for i, e in enumerate(data, start=1):
|
|
13
|
-
print(f"\nResult {i}:")
|
|
14
|
-
print("-" * 50)
|
|
15
|
-
for k, v in e.items():
|
|
16
|
-
if v:
|
|
17
|
-
k = "language" if k == "detected_language" else k
|
|
18
|
-
print(f"{k:15}: {v}")
|
|
19
|
-
print("-" * 50)
|
|
20
|
-
|
|
21
|
-
def _print_weather(data):
|
|
22
|
-
"""Prints weather data in a clean format."""
|
|
23
|
-
current = data["current"]
|
|
24
|
-
|
|
25
|
-
print(f"\nCurrent Weather in {data['location']}:")
|
|
26
|
-
print("-" * 50)
|
|
27
|
-
print(f"Temperature: {current['temperature_c']}°C")
|
|
28
|
-
print(f"Feels Like: {current['feels_like_c']}°C")
|
|
29
|
-
print(f"Humidity: {current['humidity']}%")
|
|
30
|
-
print(f"Wind: {current['wind_speed_ms']} m/s")
|
|
31
|
-
print(f"Direction: {current['wind_direction']}°")
|
|
32
|
-
print("-" * 50)
|
|
33
|
-
|
|
34
|
-
print("\n5-Day Forecast:")
|
|
35
|
-
print("-" * 50)
|
|
36
|
-
print(f"{'Date':10} {'Condition':15} {'High':8} {'Low':8}")
|
|
37
|
-
print("-" * 50)
|
|
38
|
-
|
|
39
|
-
for day in data["daily_forecast"][:5]:
|
|
40
|
-
print(f"{day['date']:10} {day['condition']:15} {day['max_temp_c']:8.1f}°C {day['min_temp_c']:8.1f}°C")
|
|
41
|
-
print("-" * 50)
|
|
42
|
-
|
|
43
|
-
# Initialize CLI app
|
|
44
|
-
app = CLI(name="webscout", help="Search the web with a simple UI", version=__version__)
|
|
45
|
-
|
|
46
|
-
@app.command()
|
|
47
|
-
def version():
|
|
48
|
-
"""Show the version of webscout."""
|
|
49
|
-
print(f"webscout version: {__version__}")
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
@app.command()
|
|
54
|
-
@option("--keywords", "-k", help="Search keywords", required=True)
|
|
55
|
-
@option("--region", "-r", help="Region for search results", default="wt-wt")
|
|
56
|
-
@option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
|
|
57
|
-
@option("--timelimit", "-t", help="Time limit for results", default=None)
|
|
58
|
-
@option("--backend", "-b", help="Search backend to use", default="api")
|
|
59
|
-
@option("--max-results", "-m", help="Maximum number of results", type=int, default=25)
|
|
60
|
-
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
61
|
-
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
|
|
62
|
-
def text(keywords: str, region: str, safesearch: str, timelimit: str, backend: str, max_results: int, proxy: str = None, timeout: int = 10):
|
|
63
|
-
"""Perform a text search using DuckDuckGo API."""
|
|
64
|
-
webs = WEBS(proxy=proxy, timeout=timeout)
|
|
65
|
-
try:
|
|
66
|
-
results = webs.text(keywords, region, safesearch, timelimit, backend, max_results)
|
|
67
|
-
_print_data(results)
|
|
68
|
-
except Exception as e:
|
|
69
|
-
raise e
|
|
70
|
-
|
|
71
|
-
@app.command()
|
|
72
|
-
@option("--keywords", "-k", help="Search keywords", required=True)
|
|
73
|
-
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
74
|
-
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
|
|
75
|
-
def answers(keywords: str, proxy: str = None, timeout: int = 10):
|
|
76
|
-
"""Perform an answers search using DuckDuckGo API."""
|
|
77
|
-
webs = WEBS(proxy=proxy, timeout=timeout)
|
|
78
|
-
try:
|
|
79
|
-
results = webs.answers(keywords)
|
|
80
|
-
_print_data(results)
|
|
81
|
-
except Exception as e:
|
|
82
|
-
raise e
|
|
83
|
-
|
|
84
|
-
@app.command()
|
|
85
|
-
@option("--keywords", "-k", help="Search keywords", required=True)
|
|
86
|
-
@option("--region", "-r", help="Region for search results", default="wt-wt")
|
|
87
|
-
@option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
|
|
88
|
-
@option("--timelimit", "-t", help="Time limit for results", default=None)
|
|
89
|
-
@option("--size", "-size", help="Image size", default=None)
|
|
90
|
-
@option("--color", "-c", help="Image color", default=None)
|
|
91
|
-
@option("--type", "-type", help="Image type", default=None)
|
|
92
|
-
@option("--layout", "-l", help="Image layout", default=None)
|
|
93
|
-
@option("--license", "-lic", help="Image license", default=None)
|
|
94
|
-
@option("--max-results", "-m", help="Maximum number of results", type=int, default=90)
|
|
95
|
-
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
96
|
-
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
|
|
97
|
-
def images(
|
|
98
|
-
keywords: str,
|
|
99
|
-
region: str,
|
|
100
|
-
safesearch: str,
|
|
101
|
-
timelimit: str,
|
|
102
|
-
size: str,
|
|
103
|
-
color: str,
|
|
104
|
-
type: str,
|
|
105
|
-
layout: str,
|
|
106
|
-
license: str,
|
|
107
|
-
max_results: int,
|
|
108
|
-
proxy: str = None,
|
|
109
|
-
timeout: int = 10,
|
|
110
|
-
):
|
|
111
|
-
"""Perform an images search using DuckDuckGo API."""
|
|
112
|
-
webs = WEBS(proxy=proxy, timeout=timeout)
|
|
113
|
-
try:
|
|
114
|
-
results = webs.images(keywords, region, safesearch, timelimit, size, color, type, layout, license, max_results)
|
|
115
|
-
_print_data(results)
|
|
116
|
-
except Exception as e:
|
|
117
|
-
raise e
|
|
118
|
-
|
|
119
|
-
@app.command()
|
|
120
|
-
@option("--keywords", "-k", help="Search keywords", required=True)
|
|
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("--resolution", "-res", help="Video resolution", default=None)
|
|
125
|
-
@option("--duration", "-d", help="Video duration", default=None)
|
|
126
|
-
@option("--license", "-lic", help="Video license", default=None)
|
|
127
|
-
@option("--max-results", "-m", help="Maximum number of results", type=int, default=50)
|
|
128
|
-
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
129
|
-
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
|
|
130
|
-
def videos(
|
|
131
|
-
keywords: str,
|
|
132
|
-
region: str,
|
|
133
|
-
safesearch: str,
|
|
134
|
-
timelimit: str,
|
|
135
|
-
resolution: str,
|
|
136
|
-
duration: str,
|
|
137
|
-
license: str,
|
|
138
|
-
max_results: int,
|
|
139
|
-
proxy: str = None,
|
|
140
|
-
timeout: int = 10,
|
|
141
|
-
):
|
|
142
|
-
"""Perform a videos search using DuckDuckGo API."""
|
|
143
|
-
webs = WEBS(proxy=proxy, timeout=timeout)
|
|
144
|
-
try:
|
|
145
|
-
results = webs.videos(keywords, region, safesearch, timelimit, resolution, duration, license, max_results)
|
|
146
|
-
_print_data(results)
|
|
147
|
-
except Exception as e:
|
|
148
|
-
raise e
|
|
149
|
-
|
|
150
|
-
@app.command()
|
|
151
|
-
@option("--keywords", "-k", help="Search keywords", required=True)
|
|
152
|
-
@option("--region", "-r", help="Region for search results", default="wt-wt")
|
|
153
|
-
@option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
|
|
154
|
-
@option("--timelimit", "-t", help="Time limit for results", default=None)
|
|
155
|
-
@option("--max-results", "-m", help="Maximum number of results", type=int, default=25)
|
|
156
|
-
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
157
|
-
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
|
|
158
|
-
def news(keywords: str, region: str, safesearch: str, timelimit: str, max_results: int, proxy: str = None, timeout: int = 10):
|
|
159
|
-
"""Perform a news search using DuckDuckGo API."""
|
|
160
|
-
webs = WEBS(proxy=proxy, timeout=timeout)
|
|
161
|
-
try:
|
|
162
|
-
results = webs.news(keywords, region, safesearch, timelimit, max_results)
|
|
163
|
-
_print_data(results)
|
|
164
|
-
except Exception as e:
|
|
165
|
-
raise e
|
|
166
|
-
|
|
167
|
-
@app.command()
|
|
168
|
-
@option("--keywords", "-k", help="Search keywords", required=True)
|
|
169
|
-
@option("--place", "-p", help="Simplified search - if set, the other parameters are not used")
|
|
170
|
-
@option("--street", "-s", help="House number/street")
|
|
171
|
-
@option("--city", "-c", help="City of search")
|
|
172
|
-
@option("--county", "-county", help="County of search")
|
|
173
|
-
@option("--state", "-state", help="State of search")
|
|
174
|
-
@option("--country", "-country", help="Country of search")
|
|
175
|
-
@option("--postalcode", "-post", help="Postal code of search")
|
|
176
|
-
@option("--latitude", "-lat", help="Geographic coordinate (north-south position)")
|
|
177
|
-
@option("--longitude", "-lon", help="Geographic coordinate (east-west position); if latitude and longitude are set, the other parameters are not used")
|
|
178
|
-
@option("--radius", "-r", help="Expand the search square by the distance in kilometers", type=int, default=0)
|
|
179
|
-
@option("--max-results", "-m", help="Number of results", type=int, default=50)
|
|
180
|
-
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
181
|
-
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
|
|
182
|
-
def maps(
|
|
183
|
-
keywords: str,
|
|
184
|
-
place: str,
|
|
185
|
-
street: str,
|
|
186
|
-
city: str,
|
|
187
|
-
county: str,
|
|
188
|
-
state: str,
|
|
189
|
-
country: str,
|
|
190
|
-
postalcode: str,
|
|
191
|
-
latitude: str,
|
|
192
|
-
longitude: str,
|
|
193
|
-
radius: int,
|
|
194
|
-
max_results: int,
|
|
195
|
-
proxy: str = None,
|
|
196
|
-
timeout: int = 10,
|
|
197
|
-
):
|
|
198
|
-
"""Perform a maps search using DuckDuckGo API."""
|
|
199
|
-
webs = WEBS(proxy=proxy, timeout=timeout)
|
|
200
|
-
try:
|
|
201
|
-
results = webs.maps(
|
|
202
|
-
keywords,
|
|
203
|
-
place,
|
|
204
|
-
street,
|
|
205
|
-
city,
|
|
206
|
-
county,
|
|
207
|
-
state,
|
|
208
|
-
country,
|
|
209
|
-
postalcode,
|
|
210
|
-
latitude,
|
|
211
|
-
longitude,
|
|
212
|
-
radius,
|
|
213
|
-
max_results,
|
|
214
|
-
)
|
|
215
|
-
_print_data(results)
|
|
216
|
-
except Exception as e:
|
|
217
|
-
raise e
|
|
218
|
-
|
|
219
|
-
@app.command()
|
|
220
|
-
@option("--keywords", "-k", help="Text for translation", required=True)
|
|
221
|
-
@option("--from", "-f", help="Language to translate from (defaults automatically)")
|
|
222
|
-
@option("--to", "-t", help="Language to translate to (default: 'en')", default="en")
|
|
223
|
-
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
224
|
-
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
|
|
225
|
-
def translate(keywords: str, from_: str, to: str, proxy: str = None, timeout: int = 10):
|
|
226
|
-
"""Perform translation using DuckDuckGo API."""
|
|
227
|
-
webs = WEBS(proxy=proxy, timeout=timeout)
|
|
228
|
-
try:
|
|
229
|
-
results = webs.translate(keywords, from_, to)
|
|
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("--region", "-r", help="Region for search results", default="wt-wt")
|
|
237
|
-
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
238
|
-
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
|
|
239
|
-
def suggestions(keywords: str, region: str, proxy: str = None, timeout: int = 10):
|
|
240
|
-
"""Perform a suggestions search using DuckDuckGo API."""
|
|
241
|
-
webs = WEBS(proxy=proxy, timeout=timeout)
|
|
242
|
-
try:
|
|
243
|
-
results = webs.suggestions(keywords, region)
|
|
244
|
-
_print_data(results)
|
|
245
|
-
except Exception as e:
|
|
246
|
-
raise e
|
|
247
|
-
|
|
248
|
-
@app.command()
|
|
249
|
-
@option("--location", "-l", help="Location to get weather for", required=True)
|
|
250
|
-
@option("--language", "-lang", help="Language code (e.g. 'en', 'es')", default="en")
|
|
251
|
-
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
252
|
-
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
|
|
253
|
-
def weather(location: str, language: str, proxy: str = None, timeout: int = 10):
|
|
254
|
-
"""Get weather information for a location from DuckDuckGo."""
|
|
255
|
-
webs = WEBS(proxy=proxy, timeout=timeout)
|
|
256
|
-
try:
|
|
257
|
-
results = webs.weather(location, language)
|
|
258
|
-
_print_weather(results)
|
|
259
|
-
except Exception as e:
|
|
260
|
-
raise e
|
|
261
|
-
|
|
262
|
-
@app.command()
|
|
263
|
-
@option("--keywords", "-k", help="Search keywords", required=True)
|
|
264
|
-
@option("--region", "-r", help="Region for search results (ISO country code)", default="all")
|
|
265
|
-
@option("--safesearch", "-s", help="SafeSearch setting (on, moderate, off)", default="moderate")
|
|
266
|
-
@option("--max-results", "-m", help="Maximum number of results", type=int, default=10)
|
|
267
|
-
@option("--start-num", "-start", help="Starting position for pagination", type=int, default=0)
|
|
268
|
-
@option("--unique", "-u", help="Filter duplicate results", type=bool, default=True)
|
|
269
|
-
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
|
|
270
|
-
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
271
|
-
@option("--impersonate", "-i", help="Browser to impersonate", default="chrome110")
|
|
272
|
-
def google_text(
|
|
273
|
-
keywords: str,
|
|
274
|
-
region: str,
|
|
275
|
-
safesearch: str,
|
|
276
|
-
max_results: int,
|
|
277
|
-
start_num: int,
|
|
278
|
-
unique: bool,
|
|
279
|
-
timeout: int = 10,
|
|
280
|
-
proxy: str = None,
|
|
281
|
-
impersonate: str = "chrome110"
|
|
282
|
-
):
|
|
283
|
-
"""Perform a text search using Google Search."""
|
|
284
|
-
google = GoogleSearch(
|
|
285
|
-
timeout=timeout,
|
|
286
|
-
proxies={"https": proxy, "http": proxy} if proxy else None,
|
|
287
|
-
verify=True,
|
|
288
|
-
lang="en",
|
|
289
|
-
sleep_interval=0.0,
|
|
290
|
-
impersonate=impersonate
|
|
291
|
-
)
|
|
292
|
-
|
|
293
|
-
try:
|
|
294
|
-
results = google.text(
|
|
295
|
-
keywords=keywords,
|
|
296
|
-
region=region,
|
|
297
|
-
safesearch=safesearch,
|
|
298
|
-
max_results=max_results,
|
|
299
|
-
start_num=start_num,
|
|
300
|
-
unique=unique
|
|
301
|
-
)
|
|
302
|
-
|
|
303
|
-
# Convert SearchResult objects to dictionaries for printing
|
|
304
|
-
formatted_results = []
|
|
305
|
-
for result in results:
|
|
306
|
-
result_dict = {
|
|
307
|
-
"title": result.title,
|
|
308
|
-
"url": result.url,
|
|
309
|
-
"description": result.description,
|
|
310
|
-
}
|
|
311
|
-
# Add any metadata to the result dictionary
|
|
312
|
-
for k, v in result.metadata.items():
|
|
313
|
-
result_dict[k] = v
|
|
314
|
-
|
|
315
|
-
formatted_results.append(result_dict)
|
|
316
|
-
|
|
317
|
-
_print_data(formatted_results)
|
|
318
|
-
except Exception as e:
|
|
319
|
-
raise e
|
|
320
|
-
|
|
321
|
-
@app.command()
|
|
322
|
-
@option("--keywords", "-k", help="Search keywords", required=True)
|
|
323
|
-
@option("--region", "-r", help="Region for search results (ISO country code)", default="all")
|
|
324
|
-
@option("--safesearch", "-s", help="SafeSearch setting (on, moderate, off)", default="moderate")
|
|
325
|
-
@option("--max-results", "-m", help="Maximum number of results", type=int, default=10)
|
|
326
|
-
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
|
|
327
|
-
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
328
|
-
@option("--impersonate", "-i", help="Browser to impersonate", default="chrome110")
|
|
329
|
-
def google_news(
|
|
330
|
-
keywords: str,
|
|
331
|
-
region: str,
|
|
332
|
-
safesearch: str,
|
|
333
|
-
max_results: int,
|
|
334
|
-
timeout: int = 10,
|
|
335
|
-
proxy: str = None,
|
|
336
|
-
impersonate: str = "chrome110"
|
|
337
|
-
):
|
|
338
|
-
"""Perform a news search using Google Search."""
|
|
339
|
-
google = GoogleSearch(
|
|
340
|
-
timeout=timeout,
|
|
341
|
-
proxies={"https": proxy, "http": proxy} if proxy else None,
|
|
342
|
-
verify=True,
|
|
343
|
-
lang="en",
|
|
344
|
-
sleep_interval=0.0,
|
|
345
|
-
impersonate=impersonate
|
|
346
|
-
)
|
|
347
|
-
|
|
348
|
-
try:
|
|
349
|
-
results = google.news(
|
|
350
|
-
keywords=keywords,
|
|
351
|
-
region=region,
|
|
352
|
-
safesearch=safesearch,
|
|
353
|
-
max_results=max_results
|
|
354
|
-
)
|
|
355
|
-
|
|
356
|
-
# Convert SearchResult objects to dictionaries for printing
|
|
357
|
-
formatted_results = []
|
|
358
|
-
for result in results:
|
|
359
|
-
result_dict = {
|
|
360
|
-
"title": result.title,
|
|
361
|
-
"url": result.url,
|
|
362
|
-
"description": result.description,
|
|
363
|
-
}
|
|
364
|
-
# Add any metadata to the result dictionary
|
|
365
|
-
for k, v in result.metadata.items():
|
|
366
|
-
result_dict[k] = v
|
|
367
|
-
|
|
368
|
-
formatted_results.append(result_dict)
|
|
369
|
-
|
|
370
|
-
_print_data(formatted_results)
|
|
371
|
-
except Exception as e:
|
|
372
|
-
raise e
|
|
373
|
-
|
|
374
|
-
@app.command()
|
|
375
|
-
@option("--query", "-q", help="Search query", required=True)
|
|
376
|
-
@option("--region", "-r", help="Region for suggestions (ISO country code)", default="all")
|
|
377
|
-
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
|
|
378
|
-
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
379
|
-
@option("--impersonate", "-i", help="Browser to impersonate", default="chrome110")
|
|
380
|
-
def google_suggestions(
|
|
381
|
-
query: str,
|
|
382
|
-
region: str,
|
|
383
|
-
timeout: int = 10,
|
|
384
|
-
proxy: str = None,
|
|
385
|
-
impersonate: str = "chrome110"
|
|
386
|
-
):
|
|
387
|
-
"""Get search suggestions from Google Search."""
|
|
388
|
-
google = GoogleSearch(
|
|
389
|
-
timeout=timeout,
|
|
390
|
-
proxies={"https": proxy, "http": proxy} if proxy else None,
|
|
391
|
-
verify=True,
|
|
392
|
-
lang="en",
|
|
393
|
-
sleep_interval=0.0,
|
|
394
|
-
impersonate=impersonate
|
|
395
|
-
)
|
|
396
|
-
|
|
397
|
-
try:
|
|
398
|
-
results = google.suggestions(query=query, region=region)
|
|
399
|
-
|
|
400
|
-
# Format suggestions for printing
|
|
401
|
-
formatted_results = []
|
|
402
|
-
for i, suggestion in enumerate(results, 1):
|
|
403
|
-
formatted_results.append({"position": i, "suggestion": suggestion})
|
|
404
|
-
|
|
405
|
-
_print_data(formatted_results)
|
|
406
|
-
except Exception as e:
|
|
407
|
-
raise e
|
|
408
|
-
|
|
409
|
-
@app.command()
|
|
410
|
-
@option("--keywords", "-k", help="Search keywords", required=True)
|
|
411
|
-
@option("--region", "-r", help="Region for search results", default="all")
|
|
412
|
-
@option("--safesearch", "-s", help="SafeSearch setting (on, moderate, off)", default="moderate")
|
|
413
|
-
@option("--max-results", "-m", help="Maximum number of results", type=int, default=10)
|
|
414
|
-
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=20)
|
|
415
|
-
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
416
|
-
@option("--impersonate", "-i", help="Browser to impersonate", default="chrome110")
|
|
417
|
-
def yep_text(
|
|
418
|
-
keywords: str,
|
|
419
|
-
region: str,
|
|
420
|
-
safesearch: str,
|
|
421
|
-
max_results: int,
|
|
422
|
-
timeout: int = 20,
|
|
423
|
-
proxy: str = None,
|
|
424
|
-
impersonate: str = "chrome110"
|
|
425
|
-
):
|
|
426
|
-
"""Perform a text search using Yep Search."""
|
|
427
|
-
yep = YepSearch(
|
|
428
|
-
timeout=timeout,
|
|
429
|
-
proxies={"https": proxy, "http": proxy} if proxy else None,
|
|
430
|
-
verify=True,
|
|
431
|
-
impersonate=impersonate
|
|
432
|
-
)
|
|
433
|
-
|
|
434
|
-
try:
|
|
435
|
-
results = yep.text(
|
|
436
|
-
keywords=keywords,
|
|
437
|
-
region=region,
|
|
438
|
-
safesearch=safesearch,
|
|
439
|
-
max_results=max_results
|
|
440
|
-
)
|
|
441
|
-
|
|
442
|
-
_print_data(results)
|
|
443
|
-
except Exception as e:
|
|
444
|
-
raise e
|
|
445
|
-
|
|
446
|
-
@app.command()
|
|
447
|
-
@option("--keywords", "-k", help="Search keywords", required=True)
|
|
448
|
-
@option("--region", "-r", help="Region for search results", default="all")
|
|
449
|
-
@option("--safesearch", "-s", help="SafeSearch setting (on, moderate, off)", default="moderate")
|
|
450
|
-
@option("--max-results", "-m", help="Maximum number of results", type=int, default=10)
|
|
451
|
-
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=20)
|
|
452
|
-
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
453
|
-
@option("--impersonate", "-i", help="Browser to impersonate", default="chrome110")
|
|
454
|
-
def yep_images(
|
|
455
|
-
keywords: str,
|
|
456
|
-
region: str,
|
|
457
|
-
safesearch: str,
|
|
458
|
-
max_results: int,
|
|
459
|
-
timeout: int = 20,
|
|
460
|
-
proxy: str = None,
|
|
461
|
-
impersonate: str = "chrome110"
|
|
462
|
-
):
|
|
463
|
-
"""Perform an image search using Yep Search."""
|
|
464
|
-
yep = YepSearch(
|
|
465
|
-
timeout=timeout,
|
|
466
|
-
proxies={"https": proxy, "http": proxy} if proxy else None,
|
|
467
|
-
verify=True,
|
|
468
|
-
impersonate=impersonate
|
|
469
|
-
)
|
|
470
|
-
|
|
471
|
-
try:
|
|
472
|
-
results = yep.images(
|
|
473
|
-
keywords=keywords,
|
|
474
|
-
region=region,
|
|
475
|
-
safesearch=safesearch,
|
|
476
|
-
max_results=max_results
|
|
477
|
-
)
|
|
478
|
-
|
|
479
|
-
_print_data(results)
|
|
480
|
-
except Exception as e:
|
|
481
|
-
raise e
|
|
482
|
-
|
|
483
|
-
@app.command()
|
|
484
|
-
@option("--query", "-q", help="Search query", required=True)
|
|
485
|
-
@option("--region", "-r", help="Region for suggestions", default="all")
|
|
486
|
-
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=20)
|
|
487
|
-
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
488
|
-
@option("--impersonate", "-i", help="Browser to impersonate", default="chrome110")
|
|
489
|
-
def yep_suggestions(
|
|
490
|
-
query: str,
|
|
491
|
-
region: str,
|
|
492
|
-
timeout: int = 20,
|
|
493
|
-
proxy: str = None,
|
|
494
|
-
impersonate: str = "chrome110"
|
|
495
|
-
):
|
|
496
|
-
"""Get search suggestions from Yep Search."""
|
|
497
|
-
yep = YepSearch(
|
|
498
|
-
timeout=timeout,
|
|
499
|
-
proxies={"https": proxy, "http": proxy} if proxy else None,
|
|
500
|
-
verify=True,
|
|
501
|
-
impersonate=impersonate
|
|
502
|
-
)
|
|
503
|
-
|
|
504
|
-
try:
|
|
505
|
-
results = yep.suggestions(query=query, region=region)
|
|
506
|
-
|
|
507
|
-
# Format suggestions for printing
|
|
508
|
-
formatted_results = []
|
|
509
|
-
for i, suggestion in enumerate(results, 1):
|
|
510
|
-
formatted_results.append({"position": i, "suggestion": suggestion})
|
|
511
|
-
|
|
512
|
-
_print_data(formatted_results)
|
|
513
|
-
except Exception as e:
|
|
514
|
-
raise e
|
|
515
|
-
|
|
516
|
-
def main():
|
|
517
|
-
"""Main entry point for the CLI."""
|
|
518
|
-
try:
|
|
519
|
-
app.run()
|
|
520
|
-
except Exception as e:
|
|
521
|
-
sys.exit(1)
|
|
522
|
-
|
|
523
|
-
if __name__ == "__main__":
|
|
1
|
+
import sys
|
|
2
|
+
from .swiftcli import CLI, option
|
|
3
|
+
from .webscout_search import WEBS # Import the WEBS class from webscout_search
|
|
4
|
+
from .DWEBS import GoogleSearch # Import GoogleSearch from DWEBS
|
|
5
|
+
from .yep_search import YepSearch # Import YepSearch from yep_search
|
|
6
|
+
from .version import __version__
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _print_data(data):
|
|
10
|
+
"""Prints data in a simple formatted way."""
|
|
11
|
+
if data:
|
|
12
|
+
for i, e in enumerate(data, start=1):
|
|
13
|
+
print(f"\nResult {i}:")
|
|
14
|
+
print("-" * 50)
|
|
15
|
+
for k, v in e.items():
|
|
16
|
+
if v:
|
|
17
|
+
k = "language" if k == "detected_language" else k
|
|
18
|
+
print(f"{k:15}: {v}")
|
|
19
|
+
print("-" * 50)
|
|
20
|
+
|
|
21
|
+
def _print_weather(data):
|
|
22
|
+
"""Prints weather data in a clean format."""
|
|
23
|
+
current = data["current"]
|
|
24
|
+
|
|
25
|
+
print(f"\nCurrent Weather in {data['location']}:")
|
|
26
|
+
print("-" * 50)
|
|
27
|
+
print(f"Temperature: {current['temperature_c']}°C")
|
|
28
|
+
print(f"Feels Like: {current['feels_like_c']}°C")
|
|
29
|
+
print(f"Humidity: {current['humidity']}%")
|
|
30
|
+
print(f"Wind: {current['wind_speed_ms']} m/s")
|
|
31
|
+
print(f"Direction: {current['wind_direction']}°")
|
|
32
|
+
print("-" * 50)
|
|
33
|
+
|
|
34
|
+
print("\n5-Day Forecast:")
|
|
35
|
+
print("-" * 50)
|
|
36
|
+
print(f"{'Date':10} {'Condition':15} {'High':8} {'Low':8}")
|
|
37
|
+
print("-" * 50)
|
|
38
|
+
|
|
39
|
+
for day in data["daily_forecast"][:5]:
|
|
40
|
+
print(f"{day['date']:10} {day['condition']:15} {day['max_temp_c']:8.1f}°C {day['min_temp_c']:8.1f}°C")
|
|
41
|
+
print("-" * 50)
|
|
42
|
+
|
|
43
|
+
# Initialize CLI app
|
|
44
|
+
app = CLI(name="webscout", help="Search the web with a simple UI", version=__version__)
|
|
45
|
+
|
|
46
|
+
@app.command()
|
|
47
|
+
def version():
|
|
48
|
+
"""Show the version of webscout."""
|
|
49
|
+
print(f"webscout version: {__version__}")
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@app.command()
|
|
54
|
+
@option("--keywords", "-k", help="Search keywords", required=True)
|
|
55
|
+
@option("--region", "-r", help="Region for search results", default="wt-wt")
|
|
56
|
+
@option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
|
|
57
|
+
@option("--timelimit", "-t", help="Time limit for results", default=None)
|
|
58
|
+
@option("--backend", "-b", help="Search backend to use", default="api")
|
|
59
|
+
@option("--max-results", "-m", help="Maximum number of results", type=int, default=25)
|
|
60
|
+
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
61
|
+
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
|
|
62
|
+
def text(keywords: str, region: str, safesearch: str, timelimit: str, backend: str, max_results: int, proxy: str = None, timeout: int = 10):
|
|
63
|
+
"""Perform a text search using DuckDuckGo API."""
|
|
64
|
+
webs = WEBS(proxy=proxy, timeout=timeout)
|
|
65
|
+
try:
|
|
66
|
+
results = webs.text(keywords, region, safesearch, timelimit, backend, max_results)
|
|
67
|
+
_print_data(results)
|
|
68
|
+
except Exception as e:
|
|
69
|
+
raise e
|
|
70
|
+
|
|
71
|
+
@app.command()
|
|
72
|
+
@option("--keywords", "-k", help="Search keywords", required=True)
|
|
73
|
+
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
74
|
+
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
|
|
75
|
+
def answers(keywords: str, proxy: str = None, timeout: int = 10):
|
|
76
|
+
"""Perform an answers search using DuckDuckGo API."""
|
|
77
|
+
webs = WEBS(proxy=proxy, timeout=timeout)
|
|
78
|
+
try:
|
|
79
|
+
results = webs.answers(keywords)
|
|
80
|
+
_print_data(results)
|
|
81
|
+
except Exception as e:
|
|
82
|
+
raise e
|
|
83
|
+
|
|
84
|
+
@app.command()
|
|
85
|
+
@option("--keywords", "-k", help="Search keywords", required=True)
|
|
86
|
+
@option("--region", "-r", help="Region for search results", default="wt-wt")
|
|
87
|
+
@option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
|
|
88
|
+
@option("--timelimit", "-t", help="Time limit for results", default=None)
|
|
89
|
+
@option("--size", "-size", help="Image size", default=None)
|
|
90
|
+
@option("--color", "-c", help="Image color", default=None)
|
|
91
|
+
@option("--type", "-type", help="Image type", default=None)
|
|
92
|
+
@option("--layout", "-l", help="Image layout", default=None)
|
|
93
|
+
@option("--license", "-lic", help="Image license", default=None)
|
|
94
|
+
@option("--max-results", "-m", help="Maximum number of results", type=int, default=90)
|
|
95
|
+
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
96
|
+
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
|
|
97
|
+
def images(
|
|
98
|
+
keywords: str,
|
|
99
|
+
region: str,
|
|
100
|
+
safesearch: str,
|
|
101
|
+
timelimit: str,
|
|
102
|
+
size: str,
|
|
103
|
+
color: str,
|
|
104
|
+
type: str,
|
|
105
|
+
layout: str,
|
|
106
|
+
license: str,
|
|
107
|
+
max_results: int,
|
|
108
|
+
proxy: str = None,
|
|
109
|
+
timeout: int = 10,
|
|
110
|
+
):
|
|
111
|
+
"""Perform an images search using DuckDuckGo API."""
|
|
112
|
+
webs = WEBS(proxy=proxy, timeout=timeout)
|
|
113
|
+
try:
|
|
114
|
+
results = webs.images(keywords, region, safesearch, timelimit, size, color, type, layout, license, max_results)
|
|
115
|
+
_print_data(results)
|
|
116
|
+
except Exception as e:
|
|
117
|
+
raise e
|
|
118
|
+
|
|
119
|
+
@app.command()
|
|
120
|
+
@option("--keywords", "-k", help="Search keywords", required=True)
|
|
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("--resolution", "-res", help="Video resolution", default=None)
|
|
125
|
+
@option("--duration", "-d", help="Video duration", default=None)
|
|
126
|
+
@option("--license", "-lic", help="Video license", default=None)
|
|
127
|
+
@option("--max-results", "-m", help="Maximum number of results", type=int, default=50)
|
|
128
|
+
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
129
|
+
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
|
|
130
|
+
def videos(
|
|
131
|
+
keywords: str,
|
|
132
|
+
region: str,
|
|
133
|
+
safesearch: str,
|
|
134
|
+
timelimit: str,
|
|
135
|
+
resolution: str,
|
|
136
|
+
duration: str,
|
|
137
|
+
license: str,
|
|
138
|
+
max_results: int,
|
|
139
|
+
proxy: str = None,
|
|
140
|
+
timeout: int = 10,
|
|
141
|
+
):
|
|
142
|
+
"""Perform a videos search using DuckDuckGo API."""
|
|
143
|
+
webs = WEBS(proxy=proxy, timeout=timeout)
|
|
144
|
+
try:
|
|
145
|
+
results = webs.videos(keywords, region, safesearch, timelimit, resolution, duration, license, max_results)
|
|
146
|
+
_print_data(results)
|
|
147
|
+
except Exception as e:
|
|
148
|
+
raise e
|
|
149
|
+
|
|
150
|
+
@app.command()
|
|
151
|
+
@option("--keywords", "-k", help="Search keywords", required=True)
|
|
152
|
+
@option("--region", "-r", help="Region for search results", default="wt-wt")
|
|
153
|
+
@option("--safesearch", "-s", help="SafeSearch setting", default="moderate")
|
|
154
|
+
@option("--timelimit", "-t", help="Time limit for results", default=None)
|
|
155
|
+
@option("--max-results", "-m", help="Maximum number of results", type=int, default=25)
|
|
156
|
+
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
157
|
+
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
|
|
158
|
+
def news(keywords: str, region: str, safesearch: str, timelimit: str, max_results: int, proxy: str = None, timeout: int = 10):
|
|
159
|
+
"""Perform a news search using DuckDuckGo API."""
|
|
160
|
+
webs = WEBS(proxy=proxy, timeout=timeout)
|
|
161
|
+
try:
|
|
162
|
+
results = webs.news(keywords, region, safesearch, timelimit, max_results)
|
|
163
|
+
_print_data(results)
|
|
164
|
+
except Exception as e:
|
|
165
|
+
raise e
|
|
166
|
+
|
|
167
|
+
@app.command()
|
|
168
|
+
@option("--keywords", "-k", help="Search keywords", required=True)
|
|
169
|
+
@option("--place", "-p", help="Simplified search - if set, the other parameters are not used")
|
|
170
|
+
@option("--street", "-s", help="House number/street")
|
|
171
|
+
@option("--city", "-c", help="City of search")
|
|
172
|
+
@option("--county", "-county", help="County of search")
|
|
173
|
+
@option("--state", "-state", help="State of search")
|
|
174
|
+
@option("--country", "-country", help="Country of search")
|
|
175
|
+
@option("--postalcode", "-post", help="Postal code of search")
|
|
176
|
+
@option("--latitude", "-lat", help="Geographic coordinate (north-south position)")
|
|
177
|
+
@option("--longitude", "-lon", help="Geographic coordinate (east-west position); if latitude and longitude are set, the other parameters are not used")
|
|
178
|
+
@option("--radius", "-r", help="Expand the search square by the distance in kilometers", type=int, default=0)
|
|
179
|
+
@option("--max-results", "-m", help="Number of results", type=int, default=50)
|
|
180
|
+
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
181
|
+
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
|
|
182
|
+
def maps(
|
|
183
|
+
keywords: str,
|
|
184
|
+
place: str,
|
|
185
|
+
street: str,
|
|
186
|
+
city: str,
|
|
187
|
+
county: str,
|
|
188
|
+
state: str,
|
|
189
|
+
country: str,
|
|
190
|
+
postalcode: str,
|
|
191
|
+
latitude: str,
|
|
192
|
+
longitude: str,
|
|
193
|
+
radius: int,
|
|
194
|
+
max_results: int,
|
|
195
|
+
proxy: str = None,
|
|
196
|
+
timeout: int = 10,
|
|
197
|
+
):
|
|
198
|
+
"""Perform a maps search using DuckDuckGo API."""
|
|
199
|
+
webs = WEBS(proxy=proxy, timeout=timeout)
|
|
200
|
+
try:
|
|
201
|
+
results = webs.maps(
|
|
202
|
+
keywords,
|
|
203
|
+
place,
|
|
204
|
+
street,
|
|
205
|
+
city,
|
|
206
|
+
county,
|
|
207
|
+
state,
|
|
208
|
+
country,
|
|
209
|
+
postalcode,
|
|
210
|
+
latitude,
|
|
211
|
+
longitude,
|
|
212
|
+
radius,
|
|
213
|
+
max_results,
|
|
214
|
+
)
|
|
215
|
+
_print_data(results)
|
|
216
|
+
except Exception as e:
|
|
217
|
+
raise e
|
|
218
|
+
|
|
219
|
+
@app.command()
|
|
220
|
+
@option("--keywords", "-k", help="Text for translation", required=True)
|
|
221
|
+
@option("--from", "-f", help="Language to translate from (defaults automatically)")
|
|
222
|
+
@option("--to", "-t", help="Language to translate to (default: 'en')", default="en")
|
|
223
|
+
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
224
|
+
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
|
|
225
|
+
def translate(keywords: str, from_: str, to: str, proxy: str = None, timeout: int = 10):
|
|
226
|
+
"""Perform translation using DuckDuckGo API."""
|
|
227
|
+
webs = WEBS(proxy=proxy, timeout=timeout)
|
|
228
|
+
try:
|
|
229
|
+
results = webs.translate(keywords, from_, to)
|
|
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("--region", "-r", help="Region for search results", default="wt-wt")
|
|
237
|
+
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
238
|
+
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
|
|
239
|
+
def suggestions(keywords: str, region: str, proxy: str = None, timeout: int = 10):
|
|
240
|
+
"""Perform a suggestions search using DuckDuckGo API."""
|
|
241
|
+
webs = WEBS(proxy=proxy, timeout=timeout)
|
|
242
|
+
try:
|
|
243
|
+
results = webs.suggestions(keywords, region)
|
|
244
|
+
_print_data(results)
|
|
245
|
+
except Exception as e:
|
|
246
|
+
raise e
|
|
247
|
+
|
|
248
|
+
@app.command()
|
|
249
|
+
@option("--location", "-l", help="Location to get weather for", required=True)
|
|
250
|
+
@option("--language", "-lang", help="Language code (e.g. 'en', 'es')", default="en")
|
|
251
|
+
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
252
|
+
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
|
|
253
|
+
def weather(location: str, language: str, proxy: str = None, timeout: int = 10):
|
|
254
|
+
"""Get weather information for a location from DuckDuckGo."""
|
|
255
|
+
webs = WEBS(proxy=proxy, timeout=timeout)
|
|
256
|
+
try:
|
|
257
|
+
results = webs.weather(location, language)
|
|
258
|
+
_print_weather(results)
|
|
259
|
+
except Exception as e:
|
|
260
|
+
raise e
|
|
261
|
+
|
|
262
|
+
@app.command()
|
|
263
|
+
@option("--keywords", "-k", help="Search keywords", required=True)
|
|
264
|
+
@option("--region", "-r", help="Region for search results (ISO country code)", default="all")
|
|
265
|
+
@option("--safesearch", "-s", help="SafeSearch setting (on, moderate, off)", default="moderate")
|
|
266
|
+
@option("--max-results", "-m", help="Maximum number of results", type=int, default=10)
|
|
267
|
+
@option("--start-num", "-start", help="Starting position for pagination", type=int, default=0)
|
|
268
|
+
@option("--unique", "-u", help="Filter duplicate results", type=bool, default=True)
|
|
269
|
+
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
|
|
270
|
+
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
271
|
+
@option("--impersonate", "-i", help="Browser to impersonate", default="chrome110")
|
|
272
|
+
def google_text(
|
|
273
|
+
keywords: str,
|
|
274
|
+
region: str,
|
|
275
|
+
safesearch: str,
|
|
276
|
+
max_results: int,
|
|
277
|
+
start_num: int,
|
|
278
|
+
unique: bool,
|
|
279
|
+
timeout: int = 10,
|
|
280
|
+
proxy: str = None,
|
|
281
|
+
impersonate: str = "chrome110"
|
|
282
|
+
):
|
|
283
|
+
"""Perform a text search using Google Search."""
|
|
284
|
+
google = GoogleSearch(
|
|
285
|
+
timeout=timeout,
|
|
286
|
+
proxies={"https": proxy, "http": proxy} if proxy else None,
|
|
287
|
+
verify=True,
|
|
288
|
+
lang="en",
|
|
289
|
+
sleep_interval=0.0,
|
|
290
|
+
impersonate=impersonate
|
|
291
|
+
)
|
|
292
|
+
|
|
293
|
+
try:
|
|
294
|
+
results = google.text(
|
|
295
|
+
keywords=keywords,
|
|
296
|
+
region=region,
|
|
297
|
+
safesearch=safesearch,
|
|
298
|
+
max_results=max_results,
|
|
299
|
+
start_num=start_num,
|
|
300
|
+
unique=unique
|
|
301
|
+
)
|
|
302
|
+
|
|
303
|
+
# Convert SearchResult objects to dictionaries for printing
|
|
304
|
+
formatted_results = []
|
|
305
|
+
for result in results:
|
|
306
|
+
result_dict = {
|
|
307
|
+
"title": result.title,
|
|
308
|
+
"url": result.url,
|
|
309
|
+
"description": result.description,
|
|
310
|
+
}
|
|
311
|
+
# Add any metadata to the result dictionary
|
|
312
|
+
for k, v in result.metadata.items():
|
|
313
|
+
result_dict[k] = v
|
|
314
|
+
|
|
315
|
+
formatted_results.append(result_dict)
|
|
316
|
+
|
|
317
|
+
_print_data(formatted_results)
|
|
318
|
+
except Exception as e:
|
|
319
|
+
raise e
|
|
320
|
+
|
|
321
|
+
@app.command()
|
|
322
|
+
@option("--keywords", "-k", help="Search keywords", required=True)
|
|
323
|
+
@option("--region", "-r", help="Region for search results (ISO country code)", default="all")
|
|
324
|
+
@option("--safesearch", "-s", help="SafeSearch setting (on, moderate, off)", default="moderate")
|
|
325
|
+
@option("--max-results", "-m", help="Maximum number of results", type=int, default=10)
|
|
326
|
+
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
|
|
327
|
+
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
328
|
+
@option("--impersonate", "-i", help="Browser to impersonate", default="chrome110")
|
|
329
|
+
def google_news(
|
|
330
|
+
keywords: str,
|
|
331
|
+
region: str,
|
|
332
|
+
safesearch: str,
|
|
333
|
+
max_results: int,
|
|
334
|
+
timeout: int = 10,
|
|
335
|
+
proxy: str = None,
|
|
336
|
+
impersonate: str = "chrome110"
|
|
337
|
+
):
|
|
338
|
+
"""Perform a news search using Google Search."""
|
|
339
|
+
google = GoogleSearch(
|
|
340
|
+
timeout=timeout,
|
|
341
|
+
proxies={"https": proxy, "http": proxy} if proxy else None,
|
|
342
|
+
verify=True,
|
|
343
|
+
lang="en",
|
|
344
|
+
sleep_interval=0.0,
|
|
345
|
+
impersonate=impersonate
|
|
346
|
+
)
|
|
347
|
+
|
|
348
|
+
try:
|
|
349
|
+
results = google.news(
|
|
350
|
+
keywords=keywords,
|
|
351
|
+
region=region,
|
|
352
|
+
safesearch=safesearch,
|
|
353
|
+
max_results=max_results
|
|
354
|
+
)
|
|
355
|
+
|
|
356
|
+
# Convert SearchResult objects to dictionaries for printing
|
|
357
|
+
formatted_results = []
|
|
358
|
+
for result in results:
|
|
359
|
+
result_dict = {
|
|
360
|
+
"title": result.title,
|
|
361
|
+
"url": result.url,
|
|
362
|
+
"description": result.description,
|
|
363
|
+
}
|
|
364
|
+
# Add any metadata to the result dictionary
|
|
365
|
+
for k, v in result.metadata.items():
|
|
366
|
+
result_dict[k] = v
|
|
367
|
+
|
|
368
|
+
formatted_results.append(result_dict)
|
|
369
|
+
|
|
370
|
+
_print_data(formatted_results)
|
|
371
|
+
except Exception as e:
|
|
372
|
+
raise e
|
|
373
|
+
|
|
374
|
+
@app.command()
|
|
375
|
+
@option("--query", "-q", help="Search query", required=True)
|
|
376
|
+
@option("--region", "-r", help="Region for suggestions (ISO country code)", default="all")
|
|
377
|
+
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=10)
|
|
378
|
+
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
379
|
+
@option("--impersonate", "-i", help="Browser to impersonate", default="chrome110")
|
|
380
|
+
def google_suggestions(
|
|
381
|
+
query: str,
|
|
382
|
+
region: str,
|
|
383
|
+
timeout: int = 10,
|
|
384
|
+
proxy: str = None,
|
|
385
|
+
impersonate: str = "chrome110"
|
|
386
|
+
):
|
|
387
|
+
"""Get search suggestions from Google Search."""
|
|
388
|
+
google = GoogleSearch(
|
|
389
|
+
timeout=timeout,
|
|
390
|
+
proxies={"https": proxy, "http": proxy} if proxy else None,
|
|
391
|
+
verify=True,
|
|
392
|
+
lang="en",
|
|
393
|
+
sleep_interval=0.0,
|
|
394
|
+
impersonate=impersonate
|
|
395
|
+
)
|
|
396
|
+
|
|
397
|
+
try:
|
|
398
|
+
results = google.suggestions(query=query, region=region)
|
|
399
|
+
|
|
400
|
+
# Format suggestions for printing
|
|
401
|
+
formatted_results = []
|
|
402
|
+
for i, suggestion in enumerate(results, 1):
|
|
403
|
+
formatted_results.append({"position": i, "suggestion": suggestion})
|
|
404
|
+
|
|
405
|
+
_print_data(formatted_results)
|
|
406
|
+
except Exception as e:
|
|
407
|
+
raise e
|
|
408
|
+
|
|
409
|
+
@app.command()
|
|
410
|
+
@option("--keywords", "-k", help="Search keywords", required=True)
|
|
411
|
+
@option("--region", "-r", help="Region for search results", default="all")
|
|
412
|
+
@option("--safesearch", "-s", help="SafeSearch setting (on, moderate, off)", default="moderate")
|
|
413
|
+
@option("--max-results", "-m", help="Maximum number of results", type=int, default=10)
|
|
414
|
+
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=20)
|
|
415
|
+
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
416
|
+
@option("--impersonate", "-i", help="Browser to impersonate", default="chrome110")
|
|
417
|
+
def yep_text(
|
|
418
|
+
keywords: str,
|
|
419
|
+
region: str,
|
|
420
|
+
safesearch: str,
|
|
421
|
+
max_results: int,
|
|
422
|
+
timeout: int = 20,
|
|
423
|
+
proxy: str = None,
|
|
424
|
+
impersonate: str = "chrome110"
|
|
425
|
+
):
|
|
426
|
+
"""Perform a text search using Yep Search."""
|
|
427
|
+
yep = YepSearch(
|
|
428
|
+
timeout=timeout,
|
|
429
|
+
proxies={"https": proxy, "http": proxy} if proxy else None,
|
|
430
|
+
verify=True,
|
|
431
|
+
impersonate=impersonate
|
|
432
|
+
)
|
|
433
|
+
|
|
434
|
+
try:
|
|
435
|
+
results = yep.text(
|
|
436
|
+
keywords=keywords,
|
|
437
|
+
region=region,
|
|
438
|
+
safesearch=safesearch,
|
|
439
|
+
max_results=max_results
|
|
440
|
+
)
|
|
441
|
+
|
|
442
|
+
_print_data(results)
|
|
443
|
+
except Exception as e:
|
|
444
|
+
raise e
|
|
445
|
+
|
|
446
|
+
@app.command()
|
|
447
|
+
@option("--keywords", "-k", help="Search keywords", required=True)
|
|
448
|
+
@option("--region", "-r", help="Region for search results", default="all")
|
|
449
|
+
@option("--safesearch", "-s", help="SafeSearch setting (on, moderate, off)", default="moderate")
|
|
450
|
+
@option("--max-results", "-m", help="Maximum number of results", type=int, default=10)
|
|
451
|
+
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=20)
|
|
452
|
+
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
453
|
+
@option("--impersonate", "-i", help="Browser to impersonate", default="chrome110")
|
|
454
|
+
def yep_images(
|
|
455
|
+
keywords: str,
|
|
456
|
+
region: str,
|
|
457
|
+
safesearch: str,
|
|
458
|
+
max_results: int,
|
|
459
|
+
timeout: int = 20,
|
|
460
|
+
proxy: str = None,
|
|
461
|
+
impersonate: str = "chrome110"
|
|
462
|
+
):
|
|
463
|
+
"""Perform an image search using Yep Search."""
|
|
464
|
+
yep = YepSearch(
|
|
465
|
+
timeout=timeout,
|
|
466
|
+
proxies={"https": proxy, "http": proxy} if proxy else None,
|
|
467
|
+
verify=True,
|
|
468
|
+
impersonate=impersonate
|
|
469
|
+
)
|
|
470
|
+
|
|
471
|
+
try:
|
|
472
|
+
results = yep.images(
|
|
473
|
+
keywords=keywords,
|
|
474
|
+
region=region,
|
|
475
|
+
safesearch=safesearch,
|
|
476
|
+
max_results=max_results
|
|
477
|
+
)
|
|
478
|
+
|
|
479
|
+
_print_data(results)
|
|
480
|
+
except Exception as e:
|
|
481
|
+
raise e
|
|
482
|
+
|
|
483
|
+
@app.command()
|
|
484
|
+
@option("--query", "-q", help="Search query", required=True)
|
|
485
|
+
@option("--region", "-r", help="Region for suggestions", default="all")
|
|
486
|
+
@option("--timeout", "-timeout", help="Timeout value for requests", type=int, default=20)
|
|
487
|
+
@option("--proxy", "-p", help="Proxy URL to use for requests")
|
|
488
|
+
@option("--impersonate", "-i", help="Browser to impersonate", default="chrome110")
|
|
489
|
+
def yep_suggestions(
|
|
490
|
+
query: str,
|
|
491
|
+
region: str,
|
|
492
|
+
timeout: int = 20,
|
|
493
|
+
proxy: str = None,
|
|
494
|
+
impersonate: str = "chrome110"
|
|
495
|
+
):
|
|
496
|
+
"""Get search suggestions from Yep Search."""
|
|
497
|
+
yep = YepSearch(
|
|
498
|
+
timeout=timeout,
|
|
499
|
+
proxies={"https": proxy, "http": proxy} if proxy else None,
|
|
500
|
+
verify=True,
|
|
501
|
+
impersonate=impersonate
|
|
502
|
+
)
|
|
503
|
+
|
|
504
|
+
try:
|
|
505
|
+
results = yep.suggestions(query=query, region=region)
|
|
506
|
+
|
|
507
|
+
# Format suggestions for printing
|
|
508
|
+
formatted_results = []
|
|
509
|
+
for i, suggestion in enumerate(results, 1):
|
|
510
|
+
formatted_results.append({"position": i, "suggestion": suggestion})
|
|
511
|
+
|
|
512
|
+
_print_data(formatted_results)
|
|
513
|
+
except Exception as e:
|
|
514
|
+
raise e
|
|
515
|
+
|
|
516
|
+
def main():
|
|
517
|
+
"""Main entry point for the CLI."""
|
|
518
|
+
try:
|
|
519
|
+
app.run()
|
|
520
|
+
except Exception as e:
|
|
521
|
+
sys.exit(1)
|
|
522
|
+
|
|
523
|
+
if __name__ == "__main__":
|
|
524
524
|
main()
|