webscout 1.0.0__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/__init__.py +18 -0
- webscout/__main__.py +5 -0
- webscout/cli.py +432 -0
- webscout/exceptions.py +2 -0
- webscout/models.py +23 -0
- webscout/utils.py +48 -0
- webscout/version.py +1 -0
- webscout/webscout_search.py +65 -0
- webscout/webscout_search_async.py +861 -0
- webscout-1.0.0.dist-info/LICENSE.md +21 -0
- webscout-1.0.0.dist-info/METADATA +627 -0
- webscout-1.0.0.dist-info/RECORD +15 -0
- webscout-1.0.0.dist-info/WHEEL +5 -0
- webscout-1.0.0.dist-info/entry_points.txt +2 -0
- webscout-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 HelpingAI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,627 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: webscout
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Search for words, documents, images, news, maps, and text translation using the DuckDuckGo.com search engine.
|
|
5
|
+
Home-page: https://github.com/HelpingAI/webscout
|
|
6
|
+
Author: deedy5
|
|
7
|
+
Author-email: koulabhay25@gmail.com
|
|
8
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
19
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE.md
|
|
23
|
+
Requires-Dist: docstring-inheritance >=2.1.2
|
|
24
|
+
Requires-Dist: click >=8.1.7
|
|
25
|
+
Requires-Dist: curl-cffi >=0.6.0b7
|
|
26
|
+
Requires-Dist: lxml >=4.9.3
|
|
27
|
+
Requires-Dist: nest-asyncio >=1.6.0
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: ruff >=0.1.6 ; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest >=7.4.2 ; extra == 'dev'
|
|
31
|
+
|
|
32
|
+
Search for words, documents, images, videos, news, maps and text translation using the DuckDuckGo.com search engine. Downloading files and images to a local hard drive.
|
|
33
|
+
|
|
34
|
+
**⚠️ Warning: use AsyncDDGS in asynchronous code**
|
|
35
|
+
|
|
36
|
+
## Table of Contents
|
|
37
|
+
- [Table of Contents](#table-of-contents)
|
|
38
|
+
- [Install](#install)
|
|
39
|
+
- [CLI version](#cli-version)
|
|
40
|
+
- [Duckduckgo search operators](#duckduckgo-search-operators)
|
|
41
|
+
- [Regions](#regions)
|
|
42
|
+
- [DDGS and AsyncDDGS classes](#ddgs-and-asyncddgs-classes)
|
|
43
|
+
- [Proxies](#proxies)
|
|
44
|
+
- [Exceptions](#exceptions)
|
|
45
|
+
- [1. text() - text search by duckduckgo.com](#1-text---text-search-by-duckduckgocom)
|
|
46
|
+
- [2. answers() - instant answers by duckduckgo.com](#2-answers---instant-answers-by-duckduckgocom)
|
|
47
|
+
- [3. images() - image search by duckduckgo.com](#3-images---image-search-by-duckduckgocom)
|
|
48
|
+
- [4. videos() - video search by duckduckgo.com](#4-videos---video-search-by-duckduckgocom)
|
|
49
|
+
- [5. news() - news search by duckduckgo.com](#5-news---news-search-by-duckduckgocom)
|
|
50
|
+
- [6. maps() - map search by duckduckgo.com](#6-maps---map-search-by-duckduckgocom)
|
|
51
|
+
- [7. translate() - translation by duckduckgo.com](#7-translate---translation-by-duckduckgocom)
|
|
52
|
+
- [8. suggestions() - suggestions by duckduckgo.com](#8-suggestions---suggestions-by-duckduckgocom)
|
|
53
|
+
|
|
54
|
+
## Install
|
|
55
|
+
```python
|
|
56
|
+
pip install -U webscout
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## CLI version
|
|
60
|
+
|
|
61
|
+
```python3
|
|
62
|
+
ddgs --help
|
|
63
|
+
```
|
|
64
|
+
or
|
|
65
|
+
```python3
|
|
66
|
+
python -m webscout --help
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
CLI examples:
|
|
70
|
+
```python3
|
|
71
|
+
# text search
|
|
72
|
+
ddgs text -k "ayrton senna"
|
|
73
|
+
# text search via proxy (example: Tor Browser)
|
|
74
|
+
ddgs text -k "china is a global threat" -p socks5://localhost:9150
|
|
75
|
+
# find and download pdf files
|
|
76
|
+
ddgs text -k "russia filetype:pdf" -m 50 -d
|
|
77
|
+
# find in es-es region and download pdf files via proxy (example: Tor browser)
|
|
78
|
+
ddgs text -k "embajada a tamorlán filetype:pdf" -r es-es -m 50 -d -p socks5://localhost:9150
|
|
79
|
+
# find and download xls files from a specific site
|
|
80
|
+
ddgs text -k "sanctions filetype:xls site:gov.ua" -m 50 -d
|
|
81
|
+
# find and download any doc(x) files from a specific site
|
|
82
|
+
ddgs text -k "filetype:doc site:mos.ru" -m 50 -d
|
|
83
|
+
# find and download images
|
|
84
|
+
ddgs images -k "yuri kuklachev cat theatre" -m 500 -s off -d
|
|
85
|
+
# find in br-br region and download images via proxy (example: Tor browser) in 10 threads
|
|
86
|
+
ddgs images -k "rio carnival" -r br-br -s off -m 500 -d -th 10 -p socks5://localhost:9150
|
|
87
|
+
# get latest news
|
|
88
|
+
ddgs news -k "ukraine war" -s off -t d -m 10
|
|
89
|
+
# get last day's news and save it to a csv file
|
|
90
|
+
ddgs news -k "hubble telescope" -t d -m 50 -o csv
|
|
91
|
+
# get answers and save to a json file
|
|
92
|
+
ddgs answers -k holocaust -o json
|
|
93
|
+
```
|
|
94
|
+
[Go To TOP](#TOP)
|
|
95
|
+
|
|
96
|
+
## Duckduckgo search operators
|
|
97
|
+
|
|
98
|
+
| Keywords example | Result|
|
|
99
|
+
| --- | --- |
|
|
100
|
+
| cats dogs | Results about cats or dogs |
|
|
101
|
+
| "cats and dogs" | Results for exact term "cats and dogs". If no results are found, related results are shown. |
|
|
102
|
+
| cats -dogs | Fewer dogs in results |
|
|
103
|
+
| cats +dogs | More dogs in results |
|
|
104
|
+
| cats filetype:pdf | PDFs about cats. Supported file types: pdf, doc(x), xls(x), ppt(x), html |
|
|
105
|
+
| dogs site:example.com | Pages about dogs from example.com |
|
|
106
|
+
| cats -site:example.com | Pages about cats, excluding example.com |
|
|
107
|
+
| intitle:dogs | Page title includes the word "dogs" |
|
|
108
|
+
| inurl:cats | Page url includes the word "cats" |
|
|
109
|
+
|
|
110
|
+
[Go To TOP](#TOP)
|
|
111
|
+
|
|
112
|
+
## Regions
|
|
113
|
+
<details>
|
|
114
|
+
<summary>expand</summary>
|
|
115
|
+
|
|
116
|
+
xa-ar for Arabia
|
|
117
|
+
xa-en for Arabia (en)
|
|
118
|
+
ar-es for Argentina
|
|
119
|
+
au-en for Australia
|
|
120
|
+
at-de for Austria
|
|
121
|
+
be-fr for Belgium (fr)
|
|
122
|
+
be-nl for Belgium (nl)
|
|
123
|
+
br-pt for Brazil
|
|
124
|
+
bg-bg for Bulgaria
|
|
125
|
+
ca-en for Canada
|
|
126
|
+
ca-fr for Canada (fr)
|
|
127
|
+
ct-ca for Catalan
|
|
128
|
+
cl-es for Chile
|
|
129
|
+
cn-zh for China
|
|
130
|
+
co-es for Colombia
|
|
131
|
+
hr-hr for Croatia
|
|
132
|
+
cz-cs for Czech Republic
|
|
133
|
+
dk-da for Denmark
|
|
134
|
+
ee-et for Estonia
|
|
135
|
+
fi-fi for Finland
|
|
136
|
+
fr-fr for France
|
|
137
|
+
de-de for Germany
|
|
138
|
+
gr-el for Greece
|
|
139
|
+
hk-tzh for Hong Kong
|
|
140
|
+
hu-hu for Hungary
|
|
141
|
+
in-en for India
|
|
142
|
+
id-id for Indonesia
|
|
143
|
+
id-en for Indonesia (en)
|
|
144
|
+
ie-en for Ireland
|
|
145
|
+
il-he for Israel
|
|
146
|
+
it-it for Italy
|
|
147
|
+
jp-jp for Japan
|
|
148
|
+
kr-kr for Korea
|
|
149
|
+
lv-lv for Latvia
|
|
150
|
+
lt-lt for Lithuania
|
|
151
|
+
xl-es for Latin America
|
|
152
|
+
my-ms for Malaysia
|
|
153
|
+
my-en for Malaysia (en)
|
|
154
|
+
mx-es for Mexico
|
|
155
|
+
nl-nl for Netherlands
|
|
156
|
+
nz-en for New Zealand
|
|
157
|
+
no-no for Norway
|
|
158
|
+
pe-es for Peru
|
|
159
|
+
ph-en for Philippines
|
|
160
|
+
ph-tl for Philippines (tl)
|
|
161
|
+
pl-pl for Poland
|
|
162
|
+
pt-pt for Portugal
|
|
163
|
+
ro-ro for Romania
|
|
164
|
+
ru-ru for Russia
|
|
165
|
+
sg-en for Singapore
|
|
166
|
+
sk-sk for Slovak Republic
|
|
167
|
+
sl-sl for Slovenia
|
|
168
|
+
za-en for South Africa
|
|
169
|
+
es-es for Spain
|
|
170
|
+
se-sv for Sweden
|
|
171
|
+
ch-de for Switzerland (de)
|
|
172
|
+
ch-fr for Switzerland (fr)
|
|
173
|
+
ch-it for Switzerland (it)
|
|
174
|
+
tw-tzh for Taiwan
|
|
175
|
+
th-th for Thailand
|
|
176
|
+
tr-tr for Turkey
|
|
177
|
+
ua-uk for Ukraine
|
|
178
|
+
uk-en for United Kingdom
|
|
179
|
+
us-en for United States
|
|
180
|
+
ue-es for United States (es)
|
|
181
|
+
ve-es for Venezuela
|
|
182
|
+
vn-vi for Vietnam
|
|
183
|
+
wt-wt for No region
|
|
184
|
+
___
|
|
185
|
+
</details>
|
|
186
|
+
|
|
187
|
+
[Go To TOP](#TOP)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
## DDGS and AsyncDDGS classes
|
|
191
|
+
|
|
192
|
+
The DDGS and AsyncDDGS classes are used to retrieve search results from DuckDuckGo.com.
|
|
193
|
+
To use the AsyncDDGS class, you can perform asynchronous operations using Python's asyncio library.
|
|
194
|
+
To initialize an instance of the DDGS or AsyncDDGS classes, you can provide the following optional arguments:
|
|
195
|
+
```python3
|
|
196
|
+
class DDGS:
|
|
197
|
+
"""webscout class to get search results from duckduckgo.com
|
|
198
|
+
|
|
199
|
+
Args:
|
|
200
|
+
headers (dict, optional): Dictionary of headers for the HTTP client. Defaults to None.
|
|
201
|
+
proxies (Union[dict, str], optional): Proxies for the HTTP client (can be dict or str). Defaults to None.
|
|
202
|
+
timeout (int, optional): Timeout value for the HTTP client. Defaults to 10.
|
|
203
|
+
"""
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Here is an example of initializing the DDGS class:
|
|
207
|
+
```python3
|
|
208
|
+
from webscout import DDGS
|
|
209
|
+
|
|
210
|
+
with DDGS() as ddgs:
|
|
211
|
+
results = [r for r in ddgs.text("python programming", max_results=5)]
|
|
212
|
+
print(results)
|
|
213
|
+
```
|
|
214
|
+
Here is an example of initializing the AsyncDDGS class:
|
|
215
|
+
```python3
|
|
216
|
+
import asyncio
|
|
217
|
+
import logging
|
|
218
|
+
import sys
|
|
219
|
+
from itertools import chain
|
|
220
|
+
from random import shuffle
|
|
221
|
+
|
|
222
|
+
import requests
|
|
223
|
+
from webscout import AsyncDDGS
|
|
224
|
+
|
|
225
|
+
# bypass curl-cffi NotImplementedError in windows https://curl-cffi.readthedocs.io/en/latest/faq/
|
|
226
|
+
if sys.platform.lower().startswith("win"):
|
|
227
|
+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
|
228
|
+
|
|
229
|
+
def get_words():
|
|
230
|
+
word_site = "https://www.mit.edu/~ecprice/wordlist.10000"
|
|
231
|
+
resp = requests.get(word_site)
|
|
232
|
+
words = resp.text.splitlines()
|
|
233
|
+
return words
|
|
234
|
+
|
|
235
|
+
async def aget_results(word):
|
|
236
|
+
async with AsyncDDGS(proxies=proxies) as ddgs:
|
|
237
|
+
results = [r async for r in ddgs.text(word, max_results=None)]
|
|
238
|
+
return results
|
|
239
|
+
|
|
240
|
+
async def main():
|
|
241
|
+
words = get_words()
|
|
242
|
+
shuffle(words)
|
|
243
|
+
tasks = []
|
|
244
|
+
for word in words[:10]:
|
|
245
|
+
tasks.append(aget_results(word))
|
|
246
|
+
results = await asyncio.gather(*tasks)
|
|
247
|
+
print(f"Done")
|
|
248
|
+
for r in chain.from_iterable(results):
|
|
249
|
+
print(r)
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
if __name__ == "__main__":
|
|
253
|
+
logging.basicConfig(level=logging.DEBUG)
|
|
254
|
+
asyncio.run(main())
|
|
255
|
+
```
|
|
256
|
+
It is important to note that the DDGS and AsyncDDGS classes should always be used as a context manager (with statement).
|
|
257
|
+
This ensures proper resource management and cleanup, as the context manager will automatically handle opening and closing the HTTP client connection.
|
|
258
|
+
|
|
259
|
+
[Go To TOP](#TOP)
|
|
260
|
+
|
|
261
|
+
## Proxies
|
|
262
|
+
Proxy can be specified as a dictionary or just a string
|
|
263
|
+
```python
|
|
264
|
+
proxies = {"http": "socks5://localhost:9150", "https": "socks5://localhost:9150"}
|
|
265
|
+
proxies = "socks5://localhost:9150"
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
*1. The easiest way. Launch the Tor Browser*
|
|
269
|
+
```python3
|
|
270
|
+
from webscout import DDGS
|
|
271
|
+
|
|
272
|
+
with DDGS(proxies="socks5://localhost:9150", timeout=20) as ddgs:
|
|
273
|
+
for r in ddgs.text("something you need", max_results=50):
|
|
274
|
+
print(r)
|
|
275
|
+
```
|
|
276
|
+
*2. Use any proxy server* (*example with [iproyal residential proxies](https://iproyal.com?r=residential_proxies)*)
|
|
277
|
+
```python3
|
|
278
|
+
from webscout import DDGS
|
|
279
|
+
|
|
280
|
+
with DDGS(proxies="socks5://user:password@geo.iproyal.com:32325", timeout=20) as ddgs:
|
|
281
|
+
for r in ddgs.text("something you need", max_results=50):
|
|
282
|
+
print(r)
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
[Go To TOP](#TOP)
|
|
286
|
+
|
|
287
|
+
## Exceptions
|
|
288
|
+
|
|
289
|
+
Exceptions:
|
|
290
|
+
- `DuckDuckGoSearchException`: Raised when there is a generic exception during the API request.
|
|
291
|
+
|
|
292
|
+
[Go To TOP](#TOP)
|
|
293
|
+
|
|
294
|
+
## 1. text() - text search by duckduckgo.com
|
|
295
|
+
|
|
296
|
+
```python
|
|
297
|
+
def text(
|
|
298
|
+
keywords: str,
|
|
299
|
+
region: str = "wt-wt",
|
|
300
|
+
safesearch: str = "moderate",
|
|
301
|
+
timelimit: Optional[str] = None,
|
|
302
|
+
backend: str = "api",
|
|
303
|
+
max_results: Optional[int] = None,
|
|
304
|
+
) -> Iterator[Dict[str, Optional[str]]]:
|
|
305
|
+
"""webscout text search generator. Query params: https://duckduckgo.com/params
|
|
306
|
+
|
|
307
|
+
Args:
|
|
308
|
+
keywords: keywords for query.
|
|
309
|
+
region: wt-wt, us-en, uk-en, ru-ru, etc. Defaults to "wt-wt".
|
|
310
|
+
safesearch: on, moderate, off. Defaults to "moderate".
|
|
311
|
+
timelimit: d, w, m, y. Defaults to None.
|
|
312
|
+
backend: api, html, lite. Defaults to api.
|
|
313
|
+
api - collect data from https://duckduckgo.com,
|
|
314
|
+
html - collect data from https://html.duckduckgo.com,
|
|
315
|
+
lite - collect data from https://lite.duckduckgo.com.
|
|
316
|
+
max_results: max number of results. If None, returns results only from the first response. Defaults to None.
|
|
317
|
+
Yields:
|
|
318
|
+
dict with search results.
|
|
319
|
+
|
|
320
|
+
"""
|
|
321
|
+
```
|
|
322
|
+
***Example***
|
|
323
|
+
```python
|
|
324
|
+
from webscout import DDGS
|
|
325
|
+
|
|
326
|
+
with DDGS() as ddgs:
|
|
327
|
+
for r in ddgs.text('live free or die', region='wt-wt', safesearch='off', timelimit='y', max_results=10):
|
|
328
|
+
print(r)
|
|
329
|
+
|
|
330
|
+
# Searching for pdf files
|
|
331
|
+
with DDGS() as ddgs:
|
|
332
|
+
for r in ddgs.text('russia filetype:pdf', region='wt-wt', safesearch='off', timelimit='y', max_results=10):
|
|
333
|
+
print(r)
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
[Go To TOP](#TOP)
|
|
337
|
+
|
|
338
|
+
## 2. answers() - instant answers by duckduckgo.com
|
|
339
|
+
|
|
340
|
+
```python
|
|
341
|
+
def answers(keywords: str) -> Iterator[Dict[str, Optional[str]]]::
|
|
342
|
+
"""webscout instant answers. Query params: https://duckduckgo.com/params
|
|
343
|
+
|
|
344
|
+
Args:
|
|
345
|
+
keywords: keywords for query.
|
|
346
|
+
|
|
347
|
+
Yields:
|
|
348
|
+
dict with instant answers results.
|
|
349
|
+
|
|
350
|
+
"""
|
|
351
|
+
```
|
|
352
|
+
***Example***
|
|
353
|
+
```python
|
|
354
|
+
from webscout import DDGS
|
|
355
|
+
|
|
356
|
+
with DDGS() as ddgs:
|
|
357
|
+
for r in ddgs.answers("sun"):
|
|
358
|
+
print(r)
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
[Go To TOP](#TOP)
|
|
362
|
+
|
|
363
|
+
## 3. images() - image search by duckduckgo.com
|
|
364
|
+
|
|
365
|
+
```python
|
|
366
|
+
def images(
|
|
367
|
+
keywords: str,
|
|
368
|
+
region: str = "wt-wt",
|
|
369
|
+
safesearch: str = "moderate",
|
|
370
|
+
timelimit: Optional[str] = None,
|
|
371
|
+
size: Optional[str] = None,
|
|
372
|
+
color: Optional[str] = None,
|
|
373
|
+
type_image: Optional[str] = None,
|
|
374
|
+
layout: Optional[str] = None,
|
|
375
|
+
license_image: Optional[str] = None,
|
|
376
|
+
max_results: Optional[int] = None,
|
|
377
|
+
) -> Iterator[Dict[str, Optional[str]]]:
|
|
378
|
+
"""webscout images search. Query params: https://duckduckgo.com/params
|
|
379
|
+
|
|
380
|
+
Args:
|
|
381
|
+
keywords: keywords for query.
|
|
382
|
+
region: wt-wt, us-en, uk-en, ru-ru, etc. Defaults to "wt-wt".
|
|
383
|
+
safesearch: on, moderate, off. Defaults to "moderate".
|
|
384
|
+
timelimit: Day, Week, Month, Year. Defaults to None.
|
|
385
|
+
size: Small, Medium, Large, Wallpaper. Defaults to None.
|
|
386
|
+
color: color, Monochrome, Red, Orange, Yellow, Green, Blue,
|
|
387
|
+
Purple, Pink, Brown, Black, Gray, Teal, White. Defaults to None.
|
|
388
|
+
type_image: photo, clipart, gif, transparent, line.
|
|
389
|
+
Defaults to None.
|
|
390
|
+
layout: Square, Tall, Wide. Defaults to None.
|
|
391
|
+
license_image: any (All Creative Commons), Public (PublicDomain),
|
|
392
|
+
Share (Free to Share and Use), ShareCommercially (Free to Share and Use Commercially),
|
|
393
|
+
Modify (Free to Modify, Share, and Use), ModifyCommercially (Free to Modify, Share, and
|
|
394
|
+
Use Commercially). Defaults to None.
|
|
395
|
+
max_results: max number of results. If None, returns results only from the first response. Defaults to None.
|
|
396
|
+
|
|
397
|
+
Yields:
|
|
398
|
+
dict with image search results.
|
|
399
|
+
|
|
400
|
+
"""
|
|
401
|
+
```
|
|
402
|
+
***Example***
|
|
403
|
+
```python
|
|
404
|
+
from webscout import DDGS
|
|
405
|
+
|
|
406
|
+
with DDGS() as ddgs:
|
|
407
|
+
keywords = 'butterfly'
|
|
408
|
+
ddgs_images_gen = ddgs.images(
|
|
409
|
+
keywords,
|
|
410
|
+
region="wt-wt",
|
|
411
|
+
safesearch="off",
|
|
412
|
+
size=None,
|
|
413
|
+
color="Monochrome",
|
|
414
|
+
type_image=None,
|
|
415
|
+
layout=None,
|
|
416
|
+
license_image=None,
|
|
417
|
+
max_results=100,
|
|
418
|
+
)
|
|
419
|
+
for r in ddgs_images_gen:
|
|
420
|
+
print(r)
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
[Go To TOP](#TOP)
|
|
424
|
+
|
|
425
|
+
## 4. videos() - video search by duckduckgo.com
|
|
426
|
+
|
|
427
|
+
```python
|
|
428
|
+
def videos(
|
|
429
|
+
keywords: str,
|
|
430
|
+
region: str = "wt-wt",
|
|
431
|
+
safesearch: str = "moderate",
|
|
432
|
+
timelimit: Optional[str] = None,
|
|
433
|
+
resolution: Optional[str] = None,
|
|
434
|
+
duration: Optional[str] = None,
|
|
435
|
+
license_videos: Optional[str] = None,
|
|
436
|
+
max_results: Optional[int] = None,
|
|
437
|
+
) -> Iterator[Dict[str, Optional[str]]]:
|
|
438
|
+
"""webscout videos search. Query params: https://duckduckgo.com/params
|
|
439
|
+
|
|
440
|
+
Args:
|
|
441
|
+
keywords: keywords for query.
|
|
442
|
+
region: wt-wt, us-en, uk-en, ru-ru, etc. Defaults to "wt-wt".
|
|
443
|
+
safesearch: on, moderate, off. Defaults to "moderate".
|
|
444
|
+
timelimit: d, w, m. Defaults to None.
|
|
445
|
+
resolution: high, standart. Defaults to None.
|
|
446
|
+
duration: short, medium, long. Defaults to None.
|
|
447
|
+
license_videos: creativeCommon, youtube. Defaults to None.
|
|
448
|
+
max_results: max number of results. If None, returns results only from the first response. Defaults to None.
|
|
449
|
+
|
|
450
|
+
Yields:
|
|
451
|
+
dict with videos search results
|
|
452
|
+
|
|
453
|
+
"""
|
|
454
|
+
```
|
|
455
|
+
***Example***
|
|
456
|
+
```python
|
|
457
|
+
from webscout import DDGS
|
|
458
|
+
|
|
459
|
+
with DDGS() as ddgs:
|
|
460
|
+
keywords = 'tesla'
|
|
461
|
+
ddgs_videos_gen = ddgs.videos(
|
|
462
|
+
keywords,
|
|
463
|
+
region="wt-wt",
|
|
464
|
+
safesearch="off",
|
|
465
|
+
timelimit="w",
|
|
466
|
+
resolution="high",
|
|
467
|
+
duration="medium",
|
|
468
|
+
max_results=100,
|
|
469
|
+
)
|
|
470
|
+
for r in ddgs_videos_gen:
|
|
471
|
+
print(r)
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
[Go To TOP](#TOP)
|
|
475
|
+
|
|
476
|
+
## 5. news() - news search by duckduckgo.com
|
|
477
|
+
|
|
478
|
+
```python
|
|
479
|
+
def news(
|
|
480
|
+
keywords: str,
|
|
481
|
+
region: str = "wt-wt",
|
|
482
|
+
safesearch: str = "moderate",
|
|
483
|
+
timelimit: Optional[str] = None,
|
|
484
|
+
max_results: Optional[int] = None,
|
|
485
|
+
) -> Iterator[Dict[str, Optional[str]]]:
|
|
486
|
+
"""webscout news search. Query params: https://duckduckgo.com/params
|
|
487
|
+
|
|
488
|
+
Args:
|
|
489
|
+
keywords: keywords for query.
|
|
490
|
+
region: wt-wt, us-en, uk-en, ru-ru, etc. Defaults to "wt-wt".
|
|
491
|
+
safesearch: on, moderate, off. Defaults to "moderate".
|
|
492
|
+
timelimit: d, w, m. Defaults to None.
|
|
493
|
+
max_results: max number of results. If None, returns results only from the first response. Defaults to None.
|
|
494
|
+
|
|
495
|
+
Yields:
|
|
496
|
+
dict with news search results.
|
|
497
|
+
|
|
498
|
+
"""
|
|
499
|
+
```
|
|
500
|
+
***Example***
|
|
501
|
+
```python
|
|
502
|
+
from webscout import DDGS
|
|
503
|
+
|
|
504
|
+
with DDGS() as ddgs:
|
|
505
|
+
keywords = 'holiday'
|
|
506
|
+
ddgs_news_gen = ddgs.news(
|
|
507
|
+
keywords,
|
|
508
|
+
region="wt-wt",
|
|
509
|
+
safesearch="off",
|
|
510
|
+
timelimit="m",
|
|
511
|
+
max_results=20
|
|
512
|
+
)
|
|
513
|
+
for r in ddgs_news_gen:
|
|
514
|
+
print(r)
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
[Go To TOP](#TOP)
|
|
518
|
+
|
|
519
|
+
## 6. maps() - map search by duckduckgo.com
|
|
520
|
+
|
|
521
|
+
```python
|
|
522
|
+
def maps(
|
|
523
|
+
keywords,
|
|
524
|
+
place: Optional[str] = None,
|
|
525
|
+
street: Optional[str] = None,
|
|
526
|
+
city: Optional[str] = None,
|
|
527
|
+
county: Optional[str] = None,
|
|
528
|
+
state: Optional[str] = None,
|
|
529
|
+
country: Optional[str] = None,
|
|
530
|
+
postalcode: Optional[str] = None,
|
|
531
|
+
latitude: Optional[str] = None,
|
|
532
|
+
longitude: Optional[str] = None,
|
|
533
|
+
radius: int = 0,
|
|
534
|
+
max_results: Optional[int] = None,
|
|
535
|
+
) -> Iterator[Dict[str, Optional[str]]]:
|
|
536
|
+
"""webscout maps search. Query params: https://duckduckgo.com/params
|
|
537
|
+
|
|
538
|
+
Args:
|
|
539
|
+
keywords: keywords for query
|
|
540
|
+
place: if set, the other parameters are not used. Defaults to None.
|
|
541
|
+
street: house number/street. Defaults to None.
|
|
542
|
+
city: city of search. Defaults to None.
|
|
543
|
+
county: county of search. Defaults to None.
|
|
544
|
+
state: state of search. Defaults to None.
|
|
545
|
+
country: country of search. Defaults to None.
|
|
546
|
+
postalcode: postalcode of search. Defaults to None.
|
|
547
|
+
latitude: geographic coordinate (north–south position). Defaults to None.
|
|
548
|
+
longitude: geographic coordinate (east–west position); if latitude and
|
|
549
|
+
longitude are set, the other parameters are not used. Defaults to None.
|
|
550
|
+
radius: expand the search square by the distance in kilometers. Defaults to 0.
|
|
551
|
+
max_results: max number of results. If None, returns results only from the first response. Defaults to None.
|
|
552
|
+
|
|
553
|
+
Yields:
|
|
554
|
+
dict with maps search results
|
|
555
|
+
|
|
556
|
+
"""
|
|
557
|
+
```
|
|
558
|
+
***Example***
|
|
559
|
+
```python
|
|
560
|
+
from webscout import DDGS
|
|
561
|
+
|
|
562
|
+
with DDGS() as ddgs:
|
|
563
|
+
for r in ddgs.maps("school", place="anantnag", max_results=50):
|
|
564
|
+
print(r)
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
[Go To TOP](#TOP)
|
|
568
|
+
|
|
569
|
+
## 7. translate() - translation by duckduckgo.com
|
|
570
|
+
|
|
571
|
+
```python
|
|
572
|
+
def translate(
|
|
573
|
+
self,
|
|
574
|
+
keywords: str,
|
|
575
|
+
from_: Optional[str] = None,
|
|
576
|
+
to: str = "en",
|
|
577
|
+
) -> Optional[Dict[str, Optional[str]]]:
|
|
578
|
+
"""webscout translate
|
|
579
|
+
|
|
580
|
+
Args:
|
|
581
|
+
keywords: string or a list of strings to translate
|
|
582
|
+
from_: translate from (defaults automatically). Defaults to None.
|
|
583
|
+
to: what language to translate. Defaults to "en".
|
|
584
|
+
|
|
585
|
+
Returns:
|
|
586
|
+
dict with translated keywords.
|
|
587
|
+
"""
|
|
588
|
+
```
|
|
589
|
+
***Example***
|
|
590
|
+
```python
|
|
591
|
+
from webscout import DDGS
|
|
592
|
+
|
|
593
|
+
with DDGS() as ddgs:
|
|
594
|
+
keywords = 'school'
|
|
595
|
+
r = ddgs.translate(keywords, to="de")
|
|
596
|
+
print(r)
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
[Go To TOP](#TOP)
|
|
600
|
+
|
|
601
|
+
## 8. suggestions() - suggestions by duckduckgo.com
|
|
602
|
+
|
|
603
|
+
```python
|
|
604
|
+
def suggestions(
|
|
605
|
+
keywords,
|
|
606
|
+
region: str = "wt-wt",
|
|
607
|
+
) -> Iterator[Dict[str, Optional[str]]]:
|
|
608
|
+
"""webscout suggestions. Query params: https://duckduckgo.com/params
|
|
609
|
+
|
|
610
|
+
Args:
|
|
611
|
+
keywords: keywords for query.
|
|
612
|
+
region: wt-wt, us-en, uk-en, ru-ru, etc. Defaults to "wt-wt".
|
|
613
|
+
|
|
614
|
+
Yields:
|
|
615
|
+
dict with suggestions results.
|
|
616
|
+
"""
|
|
617
|
+
```
|
|
618
|
+
***Example***
|
|
619
|
+
```python3
|
|
620
|
+
from webscout import DDGS
|
|
621
|
+
|
|
622
|
+
with DDGS() as ddgs:
|
|
623
|
+
for r in ddgs.suggestions("fly"):
|
|
624
|
+
print(r)
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
[Go To TOP](#TOP)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
webscout/__init__.py,sha256=zHNzosf3eGFKZElLcJY4g97QLNHF6a8frP5leUd4BPY,547
|
|
2
|
+
webscout/__main__.py,sha256=JdZY7xWYnoQGBZkv2N4VpMDdcPHA16i-Hod7Z1ULev8,135
|
|
3
|
+
webscout/cli.py,sha256=9R8OHJdSVS_koqGLJm70GFwWYQzqgTxuI_zt77JG_p8,17757
|
|
4
|
+
webscout/exceptions.py,sha256=GSidNXKbT3wjrny3hSb9s9t3OeLxU0Rv3IHyn-JSi6M,91
|
|
5
|
+
webscout/models.py,sha256=5iQIdtedT18YuTZ3npoG7kLMwcrKwhQ7928dl_7qZW0,692
|
|
6
|
+
webscout/utils.py,sha256=sIZ466_XgoLcd6IC-GgwzU1cSo2WwfEhKe1FKMMYImw,1658
|
|
7
|
+
webscout/version.py,sha256=pqFP1kZLzWI6kvJ-NjY-bhEQKT2UvH1B18Z6p3x9wXA,64
|
|
8
|
+
webscout/webscout_search.py,sha256=4GkRW7ruRHJAxsRzYHkwSi63ege4Swms--zrVUQNOJI,2640
|
|
9
|
+
webscout/webscout_search_async.py,sha256=LbrSMBCyplBspJagbrSQ6yjtScXrRIHNO5HZTOtasoI,35186
|
|
10
|
+
webscout-1.0.0.dist-info/LICENSE.md,sha256=ple694nFBJxLq83VmOoXLaKHCuN6Zmx4BbcMMLjAWmc,1087
|
|
11
|
+
webscout-1.0.0.dist-info/METADATA,sha256=JlIIZGvMCaPLa9hViDPxMLh6JipkzS5n5Y_tyK2gpa8,19673
|
|
12
|
+
webscout-1.0.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
13
|
+
webscout-1.0.0.dist-info/entry_points.txt,sha256=0RXrvIkLYLKfJnTn3_5Iv139Wc8qh_AUVhfIzqmZns8,42
|
|
14
|
+
webscout-1.0.0.dist-info/top_level.txt,sha256=nYIw7OKBQDr_Z33IzZUKidRD3zQEo8jOJYkMVMeN334,9
|
|
15
|
+
webscout-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
webscout
|