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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

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