webscout 3.3__tar.gz → 3.4__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.
- {webscout-3.3 → webscout-3.4}/PKG-INFO +2 -2
- {webscout-3.3 → webscout-3.4}/README.md +1 -1
- {webscout-3.3 → webscout-3.4}/setup.py +1 -1
- {webscout-3.3 → webscout-3.4}/webscout/Local/_version.py +1 -1
- {webscout-3.3 → webscout-3.4}/webscout/Provider/__init__.py +2 -0
- {webscout-3.3 → webscout-3.4}/webscout/cli.py +17 -15
- {webscout-3.3 → webscout-3.4}/webscout/exceptions.py +1 -1
- webscout-3.4/webscout/version.py +2 -0
- {webscout-3.3 → webscout-3.4}/webscout/webscout_search.py +48 -39
- {webscout-3.3 → webscout-3.4}/webscout/webscout_search_async.py +11 -10
- {webscout-3.3 → webscout-3.4}/webscout.egg-info/PKG-INFO +2 -2
- webscout-3.3/webscout/version.py +0 -2
- {webscout-3.3 → webscout-3.4}/DeepWEBS/__init__.py +0 -0
- {webscout-3.3 → webscout-3.4}/DeepWEBS/documents/__init__.py +0 -0
- {webscout-3.3 → webscout-3.4}/DeepWEBS/documents/query_results_extractor.py +0 -0
- {webscout-3.3 → webscout-3.4}/DeepWEBS/documents/webpage_content_extractor.py +0 -0
- {webscout-3.3 → webscout-3.4}/DeepWEBS/networks/__init__.py +0 -0
- {webscout-3.3 → webscout-3.4}/DeepWEBS/networks/filepath_converter.py +0 -0
- {webscout-3.3 → webscout-3.4}/DeepWEBS/networks/google_searcher.py +0 -0
- {webscout-3.3 → webscout-3.4}/DeepWEBS/networks/network_configs.py +0 -0
- {webscout-3.3 → webscout-3.4}/DeepWEBS/networks/webpage_fetcher.py +0 -0
- {webscout-3.3 → webscout-3.4}/DeepWEBS/utilsdw/__init__.py +0 -0
- {webscout-3.3 → webscout-3.4}/DeepWEBS/utilsdw/enver.py +0 -0
- {webscout-3.3 → webscout-3.4}/DeepWEBS/utilsdw/logger.py +0 -0
- {webscout-3.3 → webscout-3.4}/LICENSE.md +0 -0
- {webscout-3.3 → webscout-3.4}/setup.cfg +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/AIauto.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/AIbase.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/AIutel.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/DWEBS.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/LLM.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Local/__init__.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Local/formats.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Local/model.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Local/rawdog.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Local/samplers.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Local/thread.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Local/utils.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Provider/BasedGPT.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Provider/Berlin4h.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Provider/Blackboxai.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Provider/ChatGPTUK.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Provider/Cohere.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Provider/Deepseek.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Provider/Gemini.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Provider/Groq.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Provider/Koboldai.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Provider/Leo.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Provider/Llama2.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Provider/OpenGPT.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Provider/Openai.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Provider/Perplexity.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Provider/Phind.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Provider/Poe.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Provider/Reka.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Provider/ThinkAnyAI.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Provider/Xjai.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Provider/Yepchat.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/Provider/Youchat.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/__init__.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/__main__.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/async_providers.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/g4f.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/models.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/tempid.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/transcriber.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/utils.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/voice.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout/webai.py +0 -0
- {webscout-3.3 → webscout-3.4}/webscout.egg-info/SOURCES.txt +0 -0
- {webscout-3.3 → webscout-3.4}/webscout.egg-info/dependency_links.txt +0 -0
- {webscout-3.3 → webscout-3.4}/webscout.egg-info/entry_points.txt +0 -0
- {webscout-3.3 → webscout-3.4}/webscout.egg-info/requires.txt +0 -0
- {webscout-3.3 → webscout-3.4}/webscout.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: webscout
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.4
|
|
4
4
|
Summary: Search for anything using Google, DuckDuckGo, phind.com, Contains AI models, can transcribe yt videos, temporary email and phone number generation, has TTS support, webai (terminal gpt and open interpreter) and offline LLMs
|
|
5
5
|
Author: OEvortex
|
|
6
6
|
Author-email: helpingai5@gmail.com
|
|
@@ -943,7 +943,7 @@ ___
|
|
|
943
943
|
### 0. `Duckchat` - chat with LLM
|
|
944
944
|
```python
|
|
945
945
|
from webscout import WEBS as w
|
|
946
|
-
R = w().chat("hello", model='claude-3-haiku') # GPT-3.5 Turbo
|
|
946
|
+
R = w().chat("hello", model='claude-3-haiku') # GPT-3.5 Turbo, mixtral-8x7b, llama-3-70b, claude-3-haiku
|
|
947
947
|
print(R)
|
|
948
948
|
```
|
|
949
949
|
### 1. `PhindSearch` - Search using Phind.com
|
|
@@ -878,7 +878,7 @@ ___
|
|
|
878
878
|
### 0. `Duckchat` - chat with LLM
|
|
879
879
|
```python
|
|
880
880
|
from webscout import WEBS as w
|
|
881
|
-
R = w().chat("hello", model='claude-3-haiku') # GPT-3.5 Turbo
|
|
881
|
+
R = w().chat("hello", model='claude-3-haiku') # GPT-3.5 Turbo, mixtral-8x7b, llama-3-70b, claude-3-haiku
|
|
882
882
|
print(R)
|
|
883
883
|
```
|
|
884
884
|
### 1. `PhindSearch` - Search using Phind.com
|
|
@@ -5,7 +5,7 @@ with open("README.md", encoding="utf-8") as f:
|
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name="webscout",
|
|
8
|
-
version="3.
|
|
8
|
+
version="3.4",
|
|
9
9
|
description="Search for anything using Google, DuckDuckGo, phind.com, Contains AI models, can transcribe yt videos, temporary email and phone number generation, has TTS support, webai (terminal gpt and open interpreter) and offline LLMs",
|
|
10
10
|
long_description=README,
|
|
11
11
|
long_description_content_type="text/markdown",
|
|
@@ -30,6 +30,7 @@ from .ChatGPTUK import ChatGPTUK
|
|
|
30
30
|
from .Poe import POE
|
|
31
31
|
from .BasedGPT import BasedGPT
|
|
32
32
|
from .Deepseek import DeepSeek
|
|
33
|
+
|
|
33
34
|
__all__ = [
|
|
34
35
|
'ThinkAnyAI',
|
|
35
36
|
'Xjai',
|
|
@@ -61,4 +62,5 @@ __all__ = [
|
|
|
61
62
|
'POE',
|
|
62
63
|
'BasedGPT',
|
|
63
64
|
'DeepSeek',
|
|
65
|
+
|
|
64
66
|
]
|
|
@@ -7,7 +7,7 @@ from urllib.parse import unquote
|
|
|
7
7
|
from pathlib import Path
|
|
8
8
|
import click
|
|
9
9
|
from curl_cffi import requests
|
|
10
|
-
|
|
10
|
+
import pyreqwest_impersonate as pri
|
|
11
11
|
from .webscout_search import WEBS
|
|
12
12
|
from .utils import json_dumps, json_loads
|
|
13
13
|
from .version import __version__
|
|
@@ -81,10 +81,10 @@ def _sanitize_keywords(keywords):
|
|
|
81
81
|
|
|
82
82
|
def _download_file(url, dir_path, filename, proxy):
|
|
83
83
|
try:
|
|
84
|
-
resp =
|
|
85
|
-
resp.
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
resp = pri.Client(proxy=proxy, impersonate="chrome_124", timeout=10, verify=False).get(url)
|
|
85
|
+
if resp.status_code == 200:
|
|
86
|
+
with open(os.path.join(dir_path, filename[:200]), "wb") as file:
|
|
87
|
+
file.write(resp.content)
|
|
88
88
|
except Exception as ex:
|
|
89
89
|
logger.debug(f"download_file url={url} {type(ex).__name__} {ex}")
|
|
90
90
|
|
|
@@ -93,7 +93,6 @@ def _download_results(keywords, results, images=False, proxy=None, threads=None)
|
|
|
93
93
|
path_type = "images" if images else "text"
|
|
94
94
|
path = f"{path_type}_{keywords}_{datetime.now():%Y%m%d_%H%M%S}"
|
|
95
95
|
os.makedirs(path, exist_ok=True)
|
|
96
|
-
proxy = {"http": proxy, "https": proxy}
|
|
97
96
|
|
|
98
97
|
threads = 10 if threads is None else threads
|
|
99
98
|
with ThreadPoolExecutor(max_workers=threads) as executor:
|
|
@@ -129,13 +128,15 @@ def safe_entry_point():
|
|
|
129
128
|
def version():
|
|
130
129
|
print(__version__)
|
|
131
130
|
return __version__
|
|
131
|
+
|
|
132
|
+
|
|
132
133
|
@cli.command()
|
|
133
134
|
@click.option("-s", "--save", is_flag=True, default=False, help="save the conversation in the json file")
|
|
134
135
|
@click.option("-p", "--proxy", default=None, help="the proxy to send requests, example: socks5://localhost:9150")
|
|
135
136
|
def chat(save, proxy):
|
|
136
137
|
"""CLI function to perform an interactive AI chat using DuckDuckGo API."""
|
|
137
138
|
cache_file = "WEBS_chat_conversation.json"
|
|
138
|
-
models = ["gpt-3.5", "claude-3-haiku"]
|
|
139
|
+
models = ["gpt-3.5", "claude-3-haiku", "llama-3-70b", "mixtral-8x7b"]
|
|
139
140
|
client = WEBS(proxy=proxy)
|
|
140
141
|
|
|
141
142
|
print("DuckDuckGo AI chat. Available models:")
|
|
@@ -167,6 +168,7 @@ def chat(save, proxy):
|
|
|
167
168
|
if "exit" in user_input.lower() or "quit" in user_input.lower():
|
|
168
169
|
break
|
|
169
170
|
|
|
171
|
+
|
|
170
172
|
@cli.command()
|
|
171
173
|
@click.option("-k", "--keywords", required=True, help="text search, keywords for query")
|
|
172
174
|
@click.option("-r", "--region", default="wt-wt", help="wt-wt, us-en, ru-ru, etc. -region https://duckduckgo.com/params")
|
|
@@ -180,7 +182,7 @@ def chat(save, proxy):
|
|
|
180
182
|
@click.option("-p", "--proxy", default=None, help="the proxy to send requests, example: socks5://localhost:9150")
|
|
181
183
|
def text(keywords, region, safesearch, timelimit, backend, output, download, threads, max_results, proxy):
|
|
182
184
|
"""CLI function to perform a text search using DuckDuckGo API."""
|
|
183
|
-
data = WEBS(
|
|
185
|
+
data = WEBS(proxy=proxy).text(
|
|
184
186
|
keywords=keywords,
|
|
185
187
|
region=region,
|
|
186
188
|
safesearch=safesearch,
|
|
@@ -206,7 +208,7 @@ def text(keywords, region, safesearch, timelimit, backend, output, download, thr
|
|
|
206
208
|
@click.option("-p", "--proxy", default=None, help="the proxy to send requests, example: socks5://localhost:9150")
|
|
207
209
|
def answers(keywords, output, proxy):
|
|
208
210
|
"""CLI function to perform a answers search using DuckDuckGo API."""
|
|
209
|
-
data = WEBS(
|
|
211
|
+
data = WEBS(proxy=proxy).answers(keywords=keywords)
|
|
210
212
|
filename = f"answers_{_sanitize_keywords(keywords)}_{datetime.now():%Y%m%d_%H%M%S}"
|
|
211
213
|
if output == "print":
|
|
212
214
|
_print_data(data)
|
|
@@ -277,7 +279,7 @@ def images(
|
|
|
277
279
|
proxy,
|
|
278
280
|
):
|
|
279
281
|
"""CLI function to perform a images search using DuckDuckGo API."""
|
|
280
|
-
data = WEBS(
|
|
282
|
+
data = WEBS(proxy=proxy).images(
|
|
281
283
|
keywords=keywords,
|
|
282
284
|
region=region,
|
|
283
285
|
safesearch=safesearch,
|
|
@@ -314,7 +316,7 @@ def images(
|
|
|
314
316
|
@click.option("-p", "--proxy", default=None, help="the proxy to send requests, example: socks5://localhost:9150")
|
|
315
317
|
def videos(keywords, region, safesearch, timelimit, resolution, duration, license_videos, max_results, output, proxy):
|
|
316
318
|
"""CLI function to perform a videos search using DuckDuckGo API."""
|
|
317
|
-
data = WEBS(
|
|
319
|
+
data = WEBS(proxy=proxy).videos(
|
|
318
320
|
keywords=keywords,
|
|
319
321
|
region=region,
|
|
320
322
|
safesearch=safesearch,
|
|
@@ -343,7 +345,7 @@ def videos(keywords, region, safesearch, timelimit, resolution, duration, licens
|
|
|
343
345
|
@click.option("-p", "--proxy", default=None, help="the proxy to send requests, example: socks5://localhost:9150")
|
|
344
346
|
def news(keywords, region, safesearch, timelimit, max_results, output, proxy):
|
|
345
347
|
"""CLI function to perform a news search using DuckDuckGo API."""
|
|
346
|
-
data = WEBS(
|
|
348
|
+
data = WEBS(proxy=proxy).news(
|
|
347
349
|
keywords=keywords, region=region, safesearch=safesearch, timelimit=timelimit, max_results=max_results
|
|
348
350
|
)
|
|
349
351
|
filename = f"news_{_sanitize_keywords(keywords)}_{datetime.now():%Y%m%d_%H%M%S}"
|
|
@@ -387,7 +389,7 @@ def maps(
|
|
|
387
389
|
proxy,
|
|
388
390
|
):
|
|
389
391
|
"""CLI function to perform a maps search using DuckDuckGo API."""
|
|
390
|
-
data = WEBS(
|
|
392
|
+
data = WEBS(proxy=proxy).maps(
|
|
391
393
|
keywords=keywords,
|
|
392
394
|
place=place,
|
|
393
395
|
street=street,
|
|
@@ -418,7 +420,7 @@ def maps(
|
|
|
418
420
|
@click.option("-p", "--proxy", default=None, help="the proxy to send requests, example: socks5://localhost:9150")
|
|
419
421
|
def translate(keywords, from_, to, output, proxy):
|
|
420
422
|
"""CLI function to perform translate using DuckDuckGo API."""
|
|
421
|
-
data = WEBS(
|
|
423
|
+
data = WEBS(proxy=proxy).translate(keywords=keywords, from_=from_, to=to)
|
|
422
424
|
filename = f"translate_{_sanitize_keywords(keywords)}_{datetime.now():%Y%m%d_%H%M%S}"
|
|
423
425
|
if output == "print":
|
|
424
426
|
_print_data(data)
|
|
@@ -435,7 +437,7 @@ def translate(keywords, from_, to, output, proxy):
|
|
|
435
437
|
@click.option("-p", "--proxy", default=None, help="the proxy to send requests, example: socks5://localhost:9150")
|
|
436
438
|
def suggestions(keywords, region, output, proxy):
|
|
437
439
|
"""CLI function to perform a suggestions search using DuckDuckGo API."""
|
|
438
|
-
data = WEBS(
|
|
440
|
+
data = WEBS(proxy=proxy).suggestions(keywords=keywords, region=region)
|
|
439
441
|
filename = f"suggestions_{_sanitize_keywords(keywords)}_{datetime.now():%Y%m%d_%H%M%S}"
|
|
440
442
|
if output == "print":
|
|
441
443
|
_print_data(data)
|
|
@@ -30,11 +30,11 @@ from .utils import (
|
|
|
30
30
|
json_loads,
|
|
31
31
|
)
|
|
32
32
|
|
|
33
|
-
logger = logging.getLogger("
|
|
33
|
+
logger = logging.getLogger("webscout.WEBS")
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
class WEBS:
|
|
37
|
-
"""
|
|
37
|
+
"""webscout class to get search results from duckduckgo.com."""
|
|
38
38
|
|
|
39
39
|
_executor: ThreadPoolExecutor = ThreadPoolExecutor()
|
|
40
40
|
|
|
@@ -121,16 +121,22 @@ class WEBS:
|
|
|
121
121
|
return _extract_vqd(resp_content, keywords)
|
|
122
122
|
|
|
123
123
|
def chat(self, keywords: str, model: str = "gpt-3.5") -> str:
|
|
124
|
-
"""Initiates a chat session with
|
|
124
|
+
"""Initiates a chat session with DuckDuckGo AI.
|
|
125
125
|
|
|
126
126
|
Args:
|
|
127
127
|
keywords (str): The initial message or question to send to the AI.
|
|
128
|
-
model (str): The model to use: "gpt-3.5", "claude-3-haiku"
|
|
128
|
+
model (str): The model to use: "gpt-3.5", "claude-3-haiku", "llama-3-70b", "mixtral-8x7b".
|
|
129
|
+
Defaults to "gpt-3.5".
|
|
129
130
|
|
|
130
131
|
Returns:
|
|
131
132
|
str: The response from the AI.
|
|
132
133
|
"""
|
|
133
|
-
models = {
|
|
134
|
+
models = {
|
|
135
|
+
"claude-3-haiku": "claude-3-haiku-20240307",
|
|
136
|
+
"gpt-3.5": "gpt-3.5-turbo-0125",
|
|
137
|
+
"llama-3-70b": "meta-llama/Llama-3-70b-chat-hf",
|
|
138
|
+
"mixtral-8x7b": "mistralai/Mixtral-8x7B-Instruct-v0.1",
|
|
139
|
+
}
|
|
134
140
|
# vqd
|
|
135
141
|
if not self._chat_vqd:
|
|
136
142
|
resp = self.client.get("https://duckduckgo.com/duckchat/v1/status", headers={"x-vqd-accept": "1"})
|
|
@@ -167,7 +173,7 @@ class WEBS:
|
|
|
167
173
|
backend: str = "api",
|
|
168
174
|
max_results: Optional[int] = None,
|
|
169
175
|
) -> List[Dict[str, str]]:
|
|
170
|
-
"""
|
|
176
|
+
"""DuckDuckGo text search. Query params: https://duckduckgo.com/params.
|
|
171
177
|
|
|
172
178
|
Args:
|
|
173
179
|
keywords: keywords for query.
|
|
@@ -184,7 +190,7 @@ class WEBS:
|
|
|
184
190
|
List of dictionaries with search results, or None if there was an error.
|
|
185
191
|
|
|
186
192
|
Raises:
|
|
187
|
-
WebscoutE: Base exception for
|
|
193
|
+
WebscoutE: Base exception for webscout errors.
|
|
188
194
|
RatelimitE: Inherits from WebscoutE, raised for exceeding API request rate limits.
|
|
189
195
|
TimeoutE: Inherits from WebscoutE, raised for API request timeouts.
|
|
190
196
|
"""
|
|
@@ -195,7 +201,7 @@ class WEBS:
|
|
|
195
201
|
if backend == "api":
|
|
196
202
|
results = self._text_api(keywords, region, safesearch, timelimit, max_results)
|
|
197
203
|
elif backend == "html":
|
|
198
|
-
results = self._text_html(keywords, region,
|
|
204
|
+
results = self._text_html(keywords, region, timelimit, max_results)
|
|
199
205
|
elif backend == "lite":
|
|
200
206
|
results = self._text_lite(keywords, region, timelimit, max_results)
|
|
201
207
|
return results
|
|
@@ -208,7 +214,7 @@ class WEBS:
|
|
|
208
214
|
timelimit: Optional[str] = None,
|
|
209
215
|
max_results: Optional[int] = None,
|
|
210
216
|
) -> List[Dict[str, str]]:
|
|
211
|
-
"""
|
|
217
|
+
"""DuckDuckGo text search. Query params: https://duckduckgo.com/params.
|
|
212
218
|
|
|
213
219
|
Args:
|
|
214
220
|
keywords: keywords for query.
|
|
@@ -221,7 +227,7 @@ class WEBS:
|
|
|
221
227
|
List of dictionaries with search results.
|
|
222
228
|
|
|
223
229
|
Raises:
|
|
224
|
-
WebscoutE: Base exception for
|
|
230
|
+
WebscoutE: Base exception for webscout errors.
|
|
225
231
|
RatelimitE: Inherits from WebscoutE, raised for exceeding API request rate limits.
|
|
226
232
|
TimeoutE: Inherits from WebscoutE, raised for API request timeouts.
|
|
227
233
|
"""
|
|
@@ -237,6 +243,7 @@ class WEBS:
|
|
|
237
243
|
"s": "0",
|
|
238
244
|
"df": "",
|
|
239
245
|
"vqd": vqd,
|
|
246
|
+
"bing_market": f"{region[3:]}-{region[:2].upper()}",
|
|
240
247
|
"ex": "",
|
|
241
248
|
}
|
|
242
249
|
safesearch = safesearch.lower()
|
|
@@ -273,7 +280,7 @@ class WEBS:
|
|
|
273
280
|
|
|
274
281
|
slist = [0]
|
|
275
282
|
if max_results:
|
|
276
|
-
max_results = min(max_results,
|
|
283
|
+
max_results = min(max_results, 2023)
|
|
277
284
|
slist.extend(range(23, max_results, 50))
|
|
278
285
|
try:
|
|
279
286
|
for r in self._executor.map(_text_api_page, slist):
|
|
@@ -287,16 +294,14 @@ class WEBS:
|
|
|
287
294
|
self,
|
|
288
295
|
keywords: str,
|
|
289
296
|
region: str = "wt-wt",
|
|
290
|
-
safesearch: str = "moderate",
|
|
291
297
|
timelimit: Optional[str] = None,
|
|
292
298
|
max_results: Optional[int] = None,
|
|
293
299
|
) -> List[Dict[str, str]]:
|
|
294
|
-
"""
|
|
300
|
+
"""DuckDuckGo text search. Query params: https://duckduckgo.com/params.
|
|
295
301
|
|
|
296
302
|
Args:
|
|
297
303
|
keywords: keywords for query.
|
|
298
304
|
region: wt-wt, us-en, uk-en, ru-ru, etc. Defaults to "wt-wt".
|
|
299
|
-
safesearch: on, moderate, off. Defaults to "moderate".
|
|
300
305
|
timelimit: d, w, m, y. Defaults to None.
|
|
301
306
|
max_results: max number of results. If None, returns results only from the first response. Defaults to None.
|
|
302
307
|
|
|
@@ -304,19 +309,20 @@ class WEBS:
|
|
|
304
309
|
List of dictionaries with search results.
|
|
305
310
|
|
|
306
311
|
Raises:
|
|
307
|
-
WebscoutE: Base exception for
|
|
312
|
+
WebscoutE: Base exception for webscout errors.
|
|
308
313
|
RatelimitE: Inherits from WebscoutE, raised for exceeding API request rate limits.
|
|
309
314
|
TimeoutE: Inherits from WebscoutE, raised for API request timeouts.
|
|
310
315
|
"""
|
|
311
316
|
assert keywords, "keywords is mandatory"
|
|
312
317
|
|
|
313
|
-
safesearch_base = {"on": "1", "moderate": "-1", "off": "-2"}
|
|
314
318
|
payload = {
|
|
315
319
|
"q": keywords,
|
|
316
|
-
"
|
|
317
|
-
"p": safesearch_base[safesearch.lower()],
|
|
320
|
+
"s": "0",
|
|
318
321
|
"o": "json",
|
|
319
322
|
"api": "d.js",
|
|
323
|
+
"vqd": "",
|
|
324
|
+
"kl": region,
|
|
325
|
+
"bing_market": region,
|
|
320
326
|
}
|
|
321
327
|
if timelimit:
|
|
322
328
|
payload["df"] = timelimit
|
|
@@ -364,7 +370,7 @@ class WEBS:
|
|
|
364
370
|
|
|
365
371
|
slist = [0]
|
|
366
372
|
if max_results:
|
|
367
|
-
max_results = min(max_results,
|
|
373
|
+
max_results = min(max_results, 2023)
|
|
368
374
|
slist.extend(range(23, max_results, 50))
|
|
369
375
|
try:
|
|
370
376
|
for r in self._executor.map(_text_html_page, slist):
|
|
@@ -381,7 +387,7 @@ class WEBS:
|
|
|
381
387
|
timelimit: Optional[str] = None,
|
|
382
388
|
max_results: Optional[int] = None,
|
|
383
389
|
) -> List[Dict[str, str]]:
|
|
384
|
-
"""
|
|
390
|
+
"""DuckDuckGo text search. Query params: https://duckduckgo.com/params.
|
|
385
391
|
|
|
386
392
|
Args:
|
|
387
393
|
keywords: keywords for query.
|
|
@@ -393,7 +399,7 @@ class WEBS:
|
|
|
393
399
|
List of dictionaries with search results.
|
|
394
400
|
|
|
395
401
|
Raises:
|
|
396
|
-
WebscoutE: Base exception for
|
|
402
|
+
WebscoutE: Base exception for webscout errors.
|
|
397
403
|
RatelimitE: Inherits from WebscoutE, raised for exceeding API request rate limits.
|
|
398
404
|
TimeoutE: Inherits from WebscoutE, raised for API request timeouts.
|
|
399
405
|
"""
|
|
@@ -401,9 +407,12 @@ class WEBS:
|
|
|
401
407
|
|
|
402
408
|
payload = {
|
|
403
409
|
"q": keywords,
|
|
410
|
+
"s": "0",
|
|
404
411
|
"o": "json",
|
|
405
412
|
"api": "d.js",
|
|
413
|
+
"vqd": "",
|
|
406
414
|
"kl": region,
|
|
415
|
+
"bing_market": region,
|
|
407
416
|
}
|
|
408
417
|
if timelimit:
|
|
409
418
|
payload["df"] = timelimit
|
|
@@ -455,7 +464,7 @@ class WEBS:
|
|
|
455
464
|
|
|
456
465
|
slist = [0]
|
|
457
466
|
if max_results:
|
|
458
|
-
max_results = min(max_results,
|
|
467
|
+
max_results = min(max_results, 2023)
|
|
459
468
|
slist.extend(range(23, max_results, 50))
|
|
460
469
|
try:
|
|
461
470
|
for r in self._executor.map(_text_lite_page, slist):
|
|
@@ -478,7 +487,7 @@ class WEBS:
|
|
|
478
487
|
license_image: Optional[str] = None,
|
|
479
488
|
max_results: Optional[int] = None,
|
|
480
489
|
) -> List[Dict[str, str]]:
|
|
481
|
-
"""
|
|
490
|
+
"""DuckDuckGo images search. Query params: https://duckduckgo.com/params.
|
|
482
491
|
|
|
483
492
|
Args:
|
|
484
493
|
keywords: keywords for query.
|
|
@@ -501,7 +510,7 @@ class WEBS:
|
|
|
501
510
|
List of dictionaries with images search results.
|
|
502
511
|
|
|
503
512
|
Raises:
|
|
504
|
-
WebscoutE: Base exception for
|
|
513
|
+
WebscoutE: Base exception for webscout errors.
|
|
505
514
|
RatelimitE: Inherits from WebscoutE, raised for exceeding API request rate limits.
|
|
506
515
|
TimeoutE: Inherits from WebscoutE, raised for API request timeouts.
|
|
507
516
|
"""
|
|
@@ -574,7 +583,7 @@ class WEBS:
|
|
|
574
583
|
license_videos: Optional[str] = None,
|
|
575
584
|
max_results: Optional[int] = None,
|
|
576
585
|
) -> List[Dict[str, str]]:
|
|
577
|
-
"""
|
|
586
|
+
"""DuckDuckGo videos search. Query params: https://duckduckgo.com/params.
|
|
578
587
|
|
|
579
588
|
Args:
|
|
580
589
|
keywords: keywords for query.
|
|
@@ -590,7 +599,7 @@ class WEBS:
|
|
|
590
599
|
List of dictionaries with videos search results.
|
|
591
600
|
|
|
592
601
|
Raises:
|
|
593
|
-
WebscoutE: Base exception for
|
|
602
|
+
WebscoutE: Base exception for webscout errors.
|
|
594
603
|
RatelimitE: Inherits from WebscoutE, raised for exceeding API request rate limits.
|
|
595
604
|
TimeoutE: Inherits from WebscoutE, raised for API request timeouts.
|
|
596
605
|
"""
|
|
@@ -631,7 +640,7 @@ class WEBS:
|
|
|
631
640
|
slist = [0]
|
|
632
641
|
if max_results:
|
|
633
642
|
max_results = min(max_results, 400)
|
|
634
|
-
slist.extend(range(
|
|
643
|
+
slist.extend(range(60, max_results, 60))
|
|
635
644
|
try:
|
|
636
645
|
for r in self._executor.map(_videos_page, slist):
|
|
637
646
|
results.extend(r)
|
|
@@ -648,7 +657,7 @@ class WEBS:
|
|
|
648
657
|
timelimit: Optional[str] = None,
|
|
649
658
|
max_results: Optional[int] = None,
|
|
650
659
|
) -> List[Dict[str, str]]:
|
|
651
|
-
"""
|
|
660
|
+
"""DuckDuckGo news search. Query params: https://duckduckgo.com/params.
|
|
652
661
|
|
|
653
662
|
Args:
|
|
654
663
|
keywords: keywords for query.
|
|
@@ -661,7 +670,7 @@ class WEBS:
|
|
|
661
670
|
List of dictionaries with news search results.
|
|
662
671
|
|
|
663
672
|
Raises:
|
|
664
|
-
WebscoutE: Base exception for
|
|
673
|
+
WebscoutE: Base exception for webscout errors.
|
|
665
674
|
RatelimitE: Inherits from WebscoutE, raised for exceeding API request rate limits.
|
|
666
675
|
TimeoutE: Inherits from WebscoutE, raised for API request timeouts.
|
|
667
676
|
"""
|
|
@@ -707,8 +716,8 @@ class WEBS:
|
|
|
707
716
|
|
|
708
717
|
slist = [0]
|
|
709
718
|
if max_results:
|
|
710
|
-
max_results = min(max_results,
|
|
711
|
-
slist.extend(range(
|
|
719
|
+
max_results = min(max_results, 120)
|
|
720
|
+
slist.extend(range(30, max_results, 30))
|
|
712
721
|
try:
|
|
713
722
|
for r in self._executor.map(_news_page, slist):
|
|
714
723
|
results.extend(r)
|
|
@@ -718,7 +727,7 @@ class WEBS:
|
|
|
718
727
|
return list(islice(results, max_results))
|
|
719
728
|
|
|
720
729
|
def answers(self, keywords: str) -> List[Dict[str, str]]:
|
|
721
|
-
"""
|
|
730
|
+
"""DuckDuckGo instant answers. Query params: https://duckduckgo.com/params.
|
|
722
731
|
|
|
723
732
|
Args:
|
|
724
733
|
keywords: keywords for query,
|
|
@@ -727,7 +736,7 @@ class WEBS:
|
|
|
727
736
|
List of dictionaries with instant answers results.
|
|
728
737
|
|
|
729
738
|
Raises:
|
|
730
|
-
WebscoutE: Base exception for
|
|
739
|
+
WebscoutE: Base exception for webscout errors.
|
|
731
740
|
RatelimitE: Inherits from WebscoutE, raised for exceeding API request rate limits.
|
|
732
741
|
TimeoutE: Inherits from WebscoutE, raised for API request timeouts.
|
|
733
742
|
"""
|
|
@@ -789,7 +798,7 @@ class WEBS:
|
|
|
789
798
|
return results
|
|
790
799
|
|
|
791
800
|
def suggestions(self, keywords: str, region: str = "wt-wt") -> List[Dict[str, str]]:
|
|
792
|
-
"""
|
|
801
|
+
"""DuckDuckGo suggestions. Query params: https://duckduckgo.com/params.
|
|
793
802
|
|
|
794
803
|
Args:
|
|
795
804
|
keywords: keywords for query.
|
|
@@ -799,7 +808,7 @@ class WEBS:
|
|
|
799
808
|
List of dictionaries with suggestions results.
|
|
800
809
|
|
|
801
810
|
Raises:
|
|
802
|
-
WebscoutE: Base exception for
|
|
811
|
+
WebscoutE: Base exception for webscout errors.
|
|
803
812
|
RatelimitE: Inherits from WebscoutE, raised for exceeding API request rate limits.
|
|
804
813
|
TimeoutE: Inherits from WebscoutE, raised for API request timeouts.
|
|
805
814
|
"""
|
|
@@ -828,7 +837,7 @@ class WEBS:
|
|
|
828
837
|
radius: int = 0,
|
|
829
838
|
max_results: Optional[int] = None,
|
|
830
839
|
) -> List[Dict[str, str]]:
|
|
831
|
-
"""
|
|
840
|
+
"""DuckDuckGo maps search. Query params: https://duckduckgo.com/params.
|
|
832
841
|
|
|
833
842
|
Args:
|
|
834
843
|
keywords: keywords for query
|
|
@@ -849,7 +858,7 @@ class WEBS:
|
|
|
849
858
|
List of dictionaries with maps search results, or None if there was an error.
|
|
850
859
|
|
|
851
860
|
Raises:
|
|
852
|
-
WebscoutE: Base exception for
|
|
861
|
+
WebscoutE: Base exception for webscout errors.
|
|
853
862
|
RatelimitE: Inherits from WebscoutE, raised for exceeding API request rate limits.
|
|
854
863
|
TimeoutE: Inherits from WebscoutE, raised for API request timeouts.
|
|
855
864
|
"""
|
|
@@ -1005,7 +1014,7 @@ class WEBS:
|
|
|
1005
1014
|
def translate(
|
|
1006
1015
|
self, keywords: Union[List[str], str], from_: Optional[str] = None, to: str = "en"
|
|
1007
1016
|
) -> List[Dict[str, str]]:
|
|
1008
|
-
"""
|
|
1017
|
+
"""DuckDuckGo translate.
|
|
1009
1018
|
|
|
1010
1019
|
Args:
|
|
1011
1020
|
keywords: string or list of strings to translate.
|
|
@@ -1016,7 +1025,7 @@ class WEBS:
|
|
|
1016
1025
|
List od dictionaries with translated keywords.
|
|
1017
1026
|
|
|
1018
1027
|
Raises:
|
|
1019
|
-
WebscoutE: Base exception for
|
|
1028
|
+
WebscoutE: Base exception for webscout errors.
|
|
1020
1029
|
RatelimitE: Inherits from WebscoutE, raised for exceeding API request rate limits.
|
|
1021
1030
|
TimeoutE: Inherits from WebscoutE, raised for API request timeouts.
|
|
1022
1031
|
"""
|
|
@@ -37,11 +37,12 @@ class AsyncWEBS(WEBS):
|
|
|
37
37
|
pass
|
|
38
38
|
|
|
39
39
|
async def achat(self, keywords: str, model: str = "gpt-3.5") -> str:
|
|
40
|
-
"""Initiates async chat session with
|
|
40
|
+
"""Initiates async chat session with DuckDuckGo AI.
|
|
41
41
|
|
|
42
42
|
Args:
|
|
43
43
|
keywords (str): The initial message or question to send to the AI.
|
|
44
|
-
model (str): The model to use: "gpt-3.5", "claude-3-haiku"
|
|
44
|
+
model (str): The model to use: "gpt-3.5", "claude-3-haiku", "llama-3-70b", "mixtral-8x7b".
|
|
45
|
+
Defaults to "gpt-3.5".
|
|
45
46
|
|
|
46
47
|
Returns:
|
|
47
48
|
str: The response from the AI.
|
|
@@ -58,7 +59,7 @@ class AsyncWEBS(WEBS):
|
|
|
58
59
|
backend: str = "api",
|
|
59
60
|
max_results: Optional[int] = None,
|
|
60
61
|
) -> List[Dict[str, str]]:
|
|
61
|
-
"""
|
|
62
|
+
"""DuckDuckGo async text search. Query params: https://duckduckgo.com/params.
|
|
62
63
|
|
|
63
64
|
Args:
|
|
64
65
|
keywords: keywords for query.
|
|
@@ -97,7 +98,7 @@ class AsyncWEBS(WEBS):
|
|
|
97
98
|
license_image: Optional[str] = None,
|
|
98
99
|
max_results: Optional[int] = None,
|
|
99
100
|
) -> List[Dict[str, str]]:
|
|
100
|
-
"""
|
|
101
|
+
"""DuckDuckGo async images search. Query params: https://duckduckgo.com/params.
|
|
101
102
|
|
|
102
103
|
Args:
|
|
103
104
|
keywords: keywords for query.
|
|
@@ -151,7 +152,7 @@ class AsyncWEBS(WEBS):
|
|
|
151
152
|
license_videos: Optional[str] = None,
|
|
152
153
|
max_results: Optional[int] = None,
|
|
153
154
|
) -> List[Dict[str, str]]:
|
|
154
|
-
"""
|
|
155
|
+
"""DuckDuckGo async videos search. Query params: https://duckduckgo.com/params.
|
|
155
156
|
|
|
156
157
|
Args:
|
|
157
158
|
keywords: keywords for query.
|
|
@@ -193,7 +194,7 @@ class AsyncWEBS(WEBS):
|
|
|
193
194
|
timelimit: Optional[str] = None,
|
|
194
195
|
max_results: Optional[int] = None,
|
|
195
196
|
) -> List[Dict[str, str]]:
|
|
196
|
-
"""
|
|
197
|
+
"""DuckDuckGo async news search. Query params: https://duckduckgo.com/params.
|
|
197
198
|
|
|
198
199
|
Args:
|
|
199
200
|
keywords: keywords for query.
|
|
@@ -225,7 +226,7 @@ class AsyncWEBS(WEBS):
|
|
|
225
226
|
self,
|
|
226
227
|
keywords: str,
|
|
227
228
|
) -> List[Dict[str, str]]:
|
|
228
|
-
"""
|
|
229
|
+
"""DuckDuckGo async instant answers. Query params: https://duckduckgo.com/params.
|
|
229
230
|
|
|
230
231
|
Args:
|
|
231
232
|
keywords: keywords for query,
|
|
@@ -250,7 +251,7 @@ class AsyncWEBS(WEBS):
|
|
|
250
251
|
keywords: str,
|
|
251
252
|
region: str = "wt-wt",
|
|
252
253
|
) -> List[Dict[str, str]]:
|
|
253
|
-
"""
|
|
254
|
+
"""DuckDuckGo async suggestions. Query params: https://duckduckgo.com/params.
|
|
254
255
|
|
|
255
256
|
Args:
|
|
256
257
|
keywords: keywords for query.
|
|
@@ -287,7 +288,7 @@ class AsyncWEBS(WEBS):
|
|
|
287
288
|
radius: int = 0,
|
|
288
289
|
max_results: Optional[int] = None,
|
|
289
290
|
) -> List[Dict[str, str]]:
|
|
290
|
-
"""
|
|
291
|
+
"""DuckDuckGo async maps search. Query params: https://duckduckgo.com/params.
|
|
291
292
|
|
|
292
293
|
Args:
|
|
293
294
|
keywords: keywords for query
|
|
@@ -336,7 +337,7 @@ class AsyncWEBS(WEBS):
|
|
|
336
337
|
from_: Optional[str] = None,
|
|
337
338
|
to: str = "en",
|
|
338
339
|
) -> List[Dict[str, str]]:
|
|
339
|
-
"""
|
|
340
|
+
"""DuckDuckGo async translate.
|
|
340
341
|
|
|
341
342
|
Args:
|
|
342
343
|
keywords: string or list of strings to translate.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: webscout
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.4
|
|
4
4
|
Summary: Search for anything using Google, DuckDuckGo, phind.com, Contains AI models, can transcribe yt videos, temporary email and phone number generation, has TTS support, webai (terminal gpt and open interpreter) and offline LLMs
|
|
5
5
|
Author: OEvortex
|
|
6
6
|
Author-email: helpingai5@gmail.com
|
|
@@ -943,7 +943,7 @@ ___
|
|
|
943
943
|
### 0. `Duckchat` - chat with LLM
|
|
944
944
|
```python
|
|
945
945
|
from webscout import WEBS as w
|
|
946
|
-
R = w().chat("hello", model='claude-3-haiku') # GPT-3.5 Turbo
|
|
946
|
+
R = w().chat("hello", model='claude-3-haiku') # GPT-3.5 Turbo, mixtral-8x7b, llama-3-70b, claude-3-haiku
|
|
947
947
|
print(R)
|
|
948
948
|
```
|
|
949
949
|
### 1. `PhindSearch` - Search using Phind.com
|
webscout-3.3/webscout/version.py
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|