webscout 1.0.4__tar.gz → 1.0.8__tar.gz

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.

@@ -0,0 +1,50 @@
1
+ ****************************************
2
+ **** HelpingAI Simplified Universal License ****
3
+ ****************************************
4
+
5
+ Version 1.0
6
+
7
+ ### Introduction
8
+
9
+ This HelpingAI Simplified Universal License (HSUL) governs HelpingAI's content, including computer programs, scripts, datasets, documents, images, audio recordings, videos, and other digital assets. The HSUL provides simple, universal terms for accessing, modifying, and sharing resources while embracing ethical development practices.
10
+
11
+ ### Grant of Rights
12
+
13
+ Under the HSUL, HelpingAI authorizes you to copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Content, subject to the terms and conditions detailed in this document.
14
+
15
+ ### Conditions
16
+
17
+ To qualify for the rights granted in section 1, you must strictly adhere to the following conditions:
18
+
19
+ 2.1. **Redistributions of Source Code.**
20
+ If you redistribute the Source Code, you must include the entire HSUL with your distribution. Furthermore, you must add prominent notifications in all affected files stating:
21
+
22
+ > "This Work is released under the HelpingAI Simplified Universal License v1.0."
23
+
24
+ 2.2. **Binary Form Redistributions.**
25
+ If you distribute Binaries generated from the Source Code, you must ensure the inclusion of the following statement in your distribution:
26
+
27
+ > "This Work is based upon the HelpingAI Simplified Universally Licensed Work, under the HelpingAI Simplified Universal License v1.0."
28
+
29
+ 2.3. **Notification of Changes.**
30
+ Clearly indicate any alterations you introduce to the Source Code or Documentation via prominent comments detailing the nature and scope of the change(s). Reference the date and originator of the modifications.
31
+
32
+ 2.4. **Branding Attribution.**
33
+ Do not remove or alter any HelpingAI branding, logos, or notices included in the Content without explicit prior consent from HelpingAI.
34
+
35
+ 2.5. **Exclusion of Warranty.**
36
+ The Content is delivered "AS IS," bereft of any implicit guarantee, including — though not constrained to — warranties pertaining to marketability, applicability for a particular purpose, and non-infringement.
37
+
38
+ 2.6. **Limitation of Liability.**
39
+ To the maximum extent allowed by law, neither HelpingAI nor any contributor shall bear responsibility for any loss, personal injury, property damage, indirect, special, incidental, or consequential damages stemming from or relating to the Content or its employment.
40
+
41
+ 2.7. **Governing Law.**
42
+ This HSUL shall be managed and construed according to the laws of the jurisdiction where HelpingAI primarily operates.
43
+
44
+ ### Definitions
45
+
46
+ 3.1. **"Source Code"** signifies the preferred form for editing the Content, typically represented by human-readable programming languages, scripts, or documentation formats.
47
+
48
+ 3.2. **"Binaries"** denote compiled forms of the Source Code, executables, libraries, or similar artifacts built from the Source Code.
49
+
50
+ By leveraging this Content, you confirm your approval of the HSUL and pledge to honor its terms and conditions. If you disagree with the HSUL's rules, refrain from engaging with the Content.
@@ -0,0 +1,453 @@
1
+ Metadata-Version: 2.1
2
+ Name: webscout
3
+ Version: 1.0.8
4
+ Summary: Search for words, documents, images, videos, news, maps and text translation using the DuckDuckGo.com, yep.com, phind.com and you.com Also containes AI models
5
+ Author: OEvortex
6
+ Author-email: helpingai5@gmail.com
7
+ License: HelpingAI Simplified Universal License
8
+ Project-URL: Documentation, https://github.com/OE-LUCIFER/Webscout/wiki
9
+ Project-URL: Source, https://github.com/OE-LUCIFER/Webscout
10
+ Project-URL: Tracker, https://github.com/OE-LUCIFER/Webscout/issues
11
+ Project-URL: YouTube, https://youtube.com/@OEvortex
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: Other/Proprietary License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: Implementation :: CPython
21
+ Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE.md
25
+ Requires-Dist: docstring_inheritance>=2.1.2
26
+ Requires-Dist: click>=8.1.7
27
+ Requires-Dist: curl_cffi>=0.6.0b7
28
+ Requires-Dist: lxml>=5.1.0
29
+ Requires-Dist: nest-asyncio>=1.6.0
30
+ Requires-Dist: selenium>=4.1.3
31
+ Requires-Dist: tqdm>=4.64.0
32
+ Requires-Dist: webdriver-manager>=3.5.4
33
+ Requires-Dist: halo>=0.0.31
34
+ Requires-Dist: g4f>=0.2.2.3
35
+ Provides-Extra: dev
36
+ Requires-Dist: ruff>=0.1.6; extra == "dev"
37
+ Requires-Dist: pytest>=7.4.2; extra == "dev"
38
+
39
+ Search for words, documents, images, videos, news, maps and text translation using the DuckDuckGo.com, yep.com, phind.com and you.com
40
+ Also containes AI models that you can use
41
+ **⚠️ Warning: use AsyncWEBS in asynchronous code**
42
+
43
+ ## Table of Contents
44
+ - [Table of Contents](#table-of-contents)
45
+ - [Install](#install)
46
+ - [CLI version](#cli-version)
47
+ - [CLI version of AI](#cli-version-of-ai)
48
+ - [Regions](#regions)
49
+ - [WEBS and AsyncWEBS classes](#webs-and-asyncwebs-classes)
50
+ - [Exceptions](#exceptions)
51
+ - [usage](#usage)
52
+ - [1. `text()` - text search by DuckDuckGo.com and Yep.com](#1-text---text-search-by-duckduckgocom-and-yepcom)
53
+ - [2. `answers()` - instant answers by DuckDuckGo.com and Yep.com](#2-answers---instant-answers-by-duckduckgocom-and-yepcom)
54
+ - [3. `images()` - image search by DuckDuckGo.com and Yep.com](#3-images---image-search-by-duckduckgocom-and-yepcom)
55
+ - [4. `videos()` - video search by DuckDuckGo.com](#4-videos---video-search-by-duckduckgocom)
56
+ - [5. `news()` - news search by DuckDuckGo.com and yep.com](#5-news---news-search-by-duckduckgocom-and-yepcom)
57
+ - [6. `maps()` - map search by DuckDuckGo.com and](#6-maps---map-search-by-duckduckgocom-and)
58
+ - [7. `translate()` - translation by DuckDuckGo.com and Yep.com](#7-translate---translation-by-duckduckgocom-and-yepcom)
59
+ - [8. `suggestions()` - suggestions by DuckDuckGo.com and Yep.com](#8-suggestions---suggestions-by-duckduckgocom-and-yepcom)
60
+ - [9. `PhindSearch` - Search using Phind.com](#9-phindsearch---search-using-phindcom)
61
+ - [10. `YepChat` - Chat with mistral 8x7b powered by yepchat](#10-yepchat---chat-with-mistral-8x7b-powered-by-yepchat)
62
+ - [11. `You.com` - search with you.com](#11-youcom---search-with-youcom)
63
+ - [12. `Gemini` - search with google gemini](#12-gemini---search-with-google-gemini)
64
+ - [Version History](#version-history)
65
+ - [v1.0.7](#v107)
66
+ - [v1.0.6](#v106)
67
+
68
+ ## Install
69
+ ```python
70
+ pip install -U webscout
71
+ ```
72
+
73
+ ## CLI version
74
+
75
+ ```python3
76
+ python -m webscout --help
77
+ ```
78
+ ## CLI version of AI
79
+
80
+ ```python3
81
+ python -m webscout.AI phindsearch --query "your_query_here"
82
+ ```
83
+
84
+ ```python
85
+ python -m webscout.AI yepchat --message "your_message_here"
86
+ ```
87
+
88
+ ```python
89
+ python -m webscout.AI youchat --prompt "your_prompt_here"
90
+ ```
91
+
92
+ ```python
93
+ python -m webscout.AI gemini --message "tell me about gemma 7b"
94
+ ```
95
+
96
+ [Go To TOP](#TOP)
97
+
98
+ ## Regions
99
+ <details>
100
+ <summary>expand</summary>
101
+
102
+ xa-ar for Arabia
103
+ xa-en for Arabia (en)
104
+ ar-es for Argentina
105
+ au-en for Australia
106
+ at-de for Austria
107
+ be-fr for Belgium (fr)
108
+ be-nl for Belgium (nl)
109
+ br-pt for Brazil
110
+ bg-bg for Bulgaria
111
+ ca-en for Canada
112
+ ca-fr for Canada (fr)
113
+ ct-ca for Catalan
114
+ cl-es for Chile
115
+ cn-zh for China
116
+ co-es for Colombia
117
+ hr-hr for Croatia
118
+ cz-cs for Czech Republic
119
+ dk-da for Denmark
120
+ ee-et for Estonia
121
+ fi-fi for Finland
122
+ fr-fr for France
123
+ de-de for Germany
124
+ gr-el for Greece
125
+ hk-tzh for Hong Kong
126
+ hu-hu for Hungary
127
+ in-en for India
128
+ id-id for Indonesia
129
+ id-en for Indonesia (en)
130
+ ie-en for Ireland
131
+ il-he for Israel
132
+ it-it for Italy
133
+ jp-jp for Japan
134
+ kr-kr for Korea
135
+ lv-lv for Latvia
136
+ lt-lt for Lithuania
137
+ xl-es for Latin America
138
+ my-ms for Malaysia
139
+ my-en for Malaysia (en)
140
+ mx-es for Mexico
141
+ nl-nl for Netherlands
142
+ nz-en for New Zealand
143
+ no-no for Norway
144
+ pe-es for Peru
145
+ ph-en for Philippines
146
+ ph-tl for Philippines (tl)
147
+ pl-pl for Poland
148
+ pt-pt for Portugal
149
+ ro-ro for Romania
150
+ ru-ru for Russia
151
+ sg-en for Singapore
152
+ sk-sk for Slovak Republic
153
+ sl-sl for Slovenia
154
+ za-en for South Africa
155
+ es-es for Spain
156
+ se-sv for Sweden
157
+ ch-de for Switzerland (de)
158
+ ch-fr for Switzerland (fr)
159
+ ch-it for Switzerland (it)
160
+ tw-tzh for Taiwan
161
+ th-th for Thailand
162
+ tr-tr for Turkey
163
+ ua-uk for Ukraine
164
+ uk-en for United Kingdom
165
+ us-en for United States
166
+ ue-es for United States (es)
167
+ ve-es for Venezuela
168
+ vn-vi for Vietnam
169
+ wt-wt for No region
170
+ ___
171
+ </details>
172
+
173
+ [Go To TOP](#TOP)
174
+
175
+
176
+ ## WEBS and AsyncWEBS classes
177
+
178
+ The WEBS and AsyncWEBS classes are used to retrieve search results from DuckDuckGo.com and yep.com periodically.
179
+ To use the AsyncWEBS class, you can perform asynchronous operations using Python's asyncio library.
180
+ To initialize an instance of the WEBS or AsyncWEBS classes, you can provide the following optional arguments:
181
+
182
+ Here is an example of initializing the WEBS class:
183
+ ```python3
184
+ from webscout import WEBS
185
+
186
+ # Instantiating the WEBS class from webscout module
187
+ WEBS_instance = WEBS()
188
+
189
+ # Fetching text results for the query "python programming" with a maximum of 5 results
190
+ results = [result for result in WEBS_instance.text("python programming", max_results=5)]
191
+
192
+ # Displaying the obtained results
193
+ print(results)
194
+ ```
195
+ Here is an example of initializing the AsyncWEBS class:
196
+ ```python3
197
+ import asyncio
198
+ import logging
199
+ import sys
200
+ from itertools import chain
201
+ from random import shuffle
202
+
203
+ import requests
204
+ from webscout import AsyncWEBS
205
+
206
+ # bypass curl-cffi NotImplementedError in windows https://curl-cffi.readthedocs.io/en/latest/faq/
207
+ if sys.platform.lower().startswith("win"):
208
+ asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
209
+
210
+ def get_words():
211
+ word_site = "https://www.mit.edu/~ecprice/wordlist.10000"
212
+ resp = requests.get(word_site)
213
+ words = resp.text.splitlines()
214
+ return words
215
+
216
+ async def aget_results(word):
217
+ async with AsyncWEBS(proxies=proxies) as WEBS:
218
+ results = [r async for r in WEBS.text(word, max_results=None)]
219
+ return results
220
+
221
+ async def main():
222
+ words = get_words()
223
+ shuffle(words)
224
+ tasks = []
225
+ for word in words[:10]:
226
+ tasks.append(aget_results(word))
227
+ results = await asyncio.gather(*tasks)
228
+ print(f"Done")
229
+ for r in chain.from_iterable(results):
230
+ print(r)
231
+
232
+
233
+ if __name__ == "__main__":
234
+ logging.basicConfig(level=logging.DEBUG)
235
+ asyncio.run(main())
236
+ ```
237
+ It is important to note that the WEBS and AsyncWEBS classes should always be used as a context manager (with statement).
238
+ This ensures proper resource management and cleanup, as the context manager will automatically handle opening and closing the HTTP client connection.
239
+
240
+ ## Exceptions
241
+
242
+ Exceptions:
243
+ - `WebscoutE`: Raised when there is a generic exception during the API request.
244
+
245
+ ## usage
246
+ Here are the rewritten Python scripts for accessing various functionalities using the WEBS class from the webscout module, in HelpingAI style, for DuckDuckGo.com and Yep.com without explicitly specifying the search engine:
247
+
248
+ ### 1. `text()` - text search by DuckDuckGo.com and Yep.com
249
+
250
+ ```python
251
+ from webscout import WEBS
252
+
253
+ # Text search for 'live free or die' using DuckDuckGo.com and Yep.com
254
+ with WEBS() as WEBS:
255
+ for r in WEBS.text('live free or die', region='wt-wt', safesearch='off', timelimit='y', max_results=10):
256
+ print(r)
257
+
258
+ for r in WEBS.text('live free or die', region='wt-wt', safesearch='off', timelimit='y', max_results=10):
259
+ print(r)
260
+ ```
261
+
262
+ ### 2. `answers()` - instant answers by DuckDuckGo.com and Yep.com
263
+
264
+ ```python
265
+ from webscout import WEBS
266
+
267
+ # Instant answers for the query "sun" using DuckDuckGo.com and Yep.com
268
+ with WEBS() as WEBS:
269
+ for r in WEBS.answers("sun"):
270
+ print(r)
271
+ ```
272
+
273
+ ### 3. `images()` - image search by DuckDuckGo.com and Yep.com
274
+
275
+ ```python
276
+ from webscout import WEBS
277
+
278
+ # Image search for the keyword 'butterfly' using DuckDuckGo.com and Yep.com
279
+ with WEBS() as WEBS:
280
+ keywords = 'butterfly'
281
+ WEBS_images_gen = WEBS.images(
282
+ keywords,
283
+ region="wt-wt",
284
+ safesearch="off",
285
+ size=None,
286
+ color="Monochrome",
287
+ type_image=None,
288
+ layout=None,
289
+ license_image=None,
290
+ max_results=100,
291
+ )
292
+ for r in WEBS_images_gen:
293
+ print(r)
294
+ ```
295
+
296
+ ### 4. `videos()` - video search by DuckDuckGo.com
297
+
298
+ ```python
299
+ from webscout import WEBS
300
+
301
+ # Video search for the keyword 'tesla' using DuckDuckGo.com
302
+ with WEBS() as WEBS:
303
+ keywords = 'tesla'
304
+ WEBS_videos_gen = WEBS.videos(
305
+ keywords,
306
+ region="wt-wt",
307
+ safesearch="off",
308
+ timelimit="w",
309
+ resolution="high",
310
+ duration="medium",
311
+ max_results=100,
312
+ )
313
+ for r in WEBS_videos_gen:
314
+ print(r)
315
+ ```
316
+
317
+ ### 5. `news()` - news search by DuckDuckGo.com and yep.com
318
+
319
+ ```python
320
+ from webscout import WEBS
321
+
322
+ # News search for the keyword 'holiday' using DuckDuckGo.com and yep.com
323
+ with WEBS() as WEBS:
324
+ keywords = 'holiday'
325
+ WEBS_news_gen = WEBS.news(
326
+ keywords,
327
+ region="wt-wt",
328
+ safesearch="off",
329
+ timelimit="m",
330
+ max_results=20
331
+ )
332
+ for r in WEBS_news_gen:
333
+ print(r)
334
+ ```
335
+
336
+ ### 6. `maps()` - map search by DuckDuckGo.com and
337
+
338
+ ```python
339
+ from webscout import WEBS
340
+
341
+ # Map search for the keyword 'school' in 'anantnag' using DuckDuckGo.com
342
+ with WEBS() as WEBS:
343
+ for r in WEBS.maps("school", place="anantnag", max_results=50):
344
+ print(r)
345
+ ```
346
+
347
+ ### 7. `translate()` - translation by DuckDuckGo.com and Yep.com
348
+
349
+ ```python
350
+ from webscout import WEBS
351
+
352
+ # Translation of the keyword 'school' to German ('hi') using DuckDuckGo.com and Yep.com
353
+ with WEBS() as WEBS:
354
+ keywords = 'school'
355
+ r = WEBS.translate(keywords, to="hi")
356
+ print(r)
357
+ ```
358
+
359
+ ### 8. `suggestions()` - suggestions by DuckDuckGo.com and Yep.com
360
+
361
+ ```python
362
+ from webscout import WEBS
363
+
364
+ # Suggestions for the keyword 'fly' using DuckDuckGo.com and Yep
365
+ #
366
+
367
+ .com
368
+ with WEBS() as WEBS:
369
+ for r in WEBS.suggestions("fly"):
370
+ print(r)
371
+ ```
372
+
373
+ ### 9. `PhindSearch` - Search using Phind.com
374
+ Thanks to Empyros for PhindSearch function
375
+ ```python
376
+ from webscout.AI import PhindSearch
377
+
378
+ query = 'Webscout pypi'
379
+
380
+ # Create an instance of WEBSAI with the query
381
+ WEBSAI = PhindSearch(query)
382
+
383
+ WEBSAI.search()
384
+ ```
385
+ ### 10. `YepChat` - Chat with mistral 8x7b powered by yepchat
386
+ Thanks To Divyansh Shukla for This code
387
+ ```python
388
+ from webscout.AI import YepChat
389
+
390
+ def main():
391
+ # Initialize the YepChat class with your message
392
+ yep_chat = YepChat(message="who is pm of india")
393
+
394
+ # Send the request and process the response
395
+ response = yep_chat.send_request()
396
+ processed_response = yep_chat.process_response(response)
397
+
398
+ # Print the processed response
399
+ print(processed_response)
400
+
401
+ if __name__ == "__main__":
402
+ main()
403
+ ```
404
+
405
+ ### 11. `You.com` - search with you.com
406
+ ```python
407
+ from webscout.AI import youChat
408
+
409
+ # Instantiate the youchat class
410
+ youChat = youChat()
411
+
412
+ while True:
413
+ # Ask the user for a prompt
414
+ prompt = input("💡 Enter a prompt (or type 'exit' to quit): ")
415
+
416
+ # Exit condition
417
+ if prompt.lower() == 'exit':
418
+ break
419
+
420
+ # Generate a completion based on the prompt
421
+ try:
422
+ completion = youChat.create(prompt)
423
+ print("💬:", completion)
424
+ except Exception as e:
425
+ print("⚠️ An error occurred:", e)
426
+ ```
427
+
428
+ ### 12. `Gemini` - search with google gemini
429
+
430
+ ```python
431
+ from webscout.AI import Gemini
432
+
433
+ # Create an instance of the Gemini class
434
+ gemini = Gemini()
435
+
436
+ # Use the chat method to send a message to the Gemini assistant
437
+ response = gemini.chat("Your message here")
438
+
439
+ # Print the response from the Gemini assistant
440
+ print(response)
441
+ ```
442
+
443
+ ## Version History
444
+
445
+ ### v1.0.7
446
+ - Added gemini as webscout.AI
447
+
448
+ ### v1.0.6
449
+ - Added yep.com as a search engine
450
+ - Fixed an error related to translation functionality
451
+ - Introduced Phind AI as webscout.AI
452
+ - Included YepChat as webscout.AI
453
+ - Integrated You.com as webscout.AI