webscout 2025.10.14.1__py3-none-any.whl → 2025.10.16__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 (70) hide show
  1. webscout/Extra/YTToolkit/README.md +1 -1
  2. webscout/Extra/tempmail/README.md +3 -3
  3. webscout/Provider/OPENAI/README.md +1 -1
  4. webscout/Provider/TTI/bing.py +4 -4
  5. webscout/__init__.py +1 -1
  6. webscout/cli.py +0 -147
  7. webscout/client.py +4 -5
  8. webscout/litprinter/__init__.py +0 -42
  9. webscout/scout/README.md +59 -8
  10. webscout/scout/core/scout.py +62 -0
  11. webscout/scout/element.py +251 -45
  12. webscout/search/__init__.py +5 -8
  13. webscout/search/bing_main.py +42 -0
  14. webscout/search/engines/bing/__init__.py +1 -0
  15. webscout/search/engines/bing/base.py +33 -0
  16. webscout/search/engines/bing/images.py +108 -0
  17. webscout/search/engines/bing/news.py +91 -0
  18. webscout/search/engines/bing/suggestions.py +34 -0
  19. webscout/search/engines/bing/text.py +106 -0
  20. webscout/search/engines/duckduckgo/maps.py +13 -0
  21. webscout/search/engines/yahoo/__init__.py +41 -0
  22. webscout/search/engines/yahoo/answers.py +16 -0
  23. webscout/search/engines/yahoo/base.py +34 -0
  24. webscout/search/engines/yahoo/images.py +324 -0
  25. webscout/search/engines/yahoo/maps.py +16 -0
  26. webscout/search/engines/yahoo/news.py +258 -0
  27. webscout/search/engines/yahoo/suggestions.py +140 -0
  28. webscout/search/engines/yahoo/text.py +273 -0
  29. webscout/search/engines/yahoo/translate.py +16 -0
  30. webscout/search/engines/yahoo/videos.py +302 -0
  31. webscout/search/engines/yahoo/weather.py +220 -0
  32. webscout/search/http_client.py +1 -1
  33. webscout/search/yahoo_main.py +54 -0
  34. webscout/{auth → server}/__init__.py +2 -23
  35. webscout/server/config.py +84 -0
  36. webscout/{auth → server}/request_processing.py +3 -28
  37. webscout/{auth → server}/routes.py +14 -170
  38. webscout/server/schemas.py +23 -0
  39. webscout/{auth → server}/server.py +11 -43
  40. webscout/server/simple_logger.py +84 -0
  41. webscout/version.py +1 -1
  42. webscout/version.py.bak +1 -1
  43. webscout/zeroart/README.md +17 -9
  44. webscout/zeroart/__init__.py +78 -6
  45. webscout/zeroart/effects.py +51 -1
  46. webscout/zeroart/fonts.py +559 -1
  47. {webscout-2025.10.14.1.dist-info → webscout-2025.10.16.dist-info}/METADATA +15 -332
  48. {webscout-2025.10.14.1.dist-info → webscout-2025.10.16.dist-info}/RECORD +55 -48
  49. {webscout-2025.10.14.1.dist-info → webscout-2025.10.16.dist-info}/entry_points.txt +1 -1
  50. webscout/Bing_search.py +0 -417
  51. webscout/DWEBS.py +0 -529
  52. webscout/auth/api_key_manager.py +0 -189
  53. webscout/auth/auth_system.py +0 -85
  54. webscout/auth/config.py +0 -175
  55. webscout/auth/database.py +0 -755
  56. webscout/auth/middleware.py +0 -248
  57. webscout/auth/models.py +0 -185
  58. webscout/auth/rate_limiter.py +0 -254
  59. webscout/auth/schemas.py +0 -103
  60. webscout/auth/simple_logger.py +0 -236
  61. webscout/search/engines/bing.py +0 -84
  62. webscout/search/engines/bing_news.py +0 -52
  63. webscout/search/engines/yahoo.py +0 -65
  64. webscout/search/engines/yahoo_news.py +0 -64
  65. /webscout/{auth → server}/exceptions.py +0 -0
  66. /webscout/{auth → server}/providers.py +0 -0
  67. /webscout/{auth → server}/request_models.py +0 -0
  68. {webscout-2025.10.14.1.dist-info → webscout-2025.10.16.dist-info}/WHEEL +0 -0
  69. {webscout-2025.10.14.1.dist-info → webscout-2025.10.16.dist-info}/licenses/LICENSE.md +0 -0
  70. {webscout-2025.10.14.1.dist-info → webscout-2025.10.16.dist-info}/top_level.txt +0 -0
webscout/Bing_search.py DELETED
@@ -1,417 +0,0 @@
1
- """
2
- BingSearch - A Bing search library with advanced features
3
- """
4
- from time import sleep
5
- from curl_cffi.requests import Session
6
- from urllib.parse import urlencode, unquote, urlparse, parse_qs
7
- import base64
8
- from typing import List, Dict, Optional, Any
9
- from concurrent.futures import ThreadPoolExecutor
10
- from webscout.litagent import LitAgent
11
- class BingSearchResult:
12
- """Class to represent a Bing search result with metadata."""
13
- def __init__(self, url: str, title: str, description: str):
14
- self.url = url
15
- self.title = title
16
- self.description = description
17
- self.metadata: Dict[str, Any] = {}
18
-
19
- def __repr__(self) -> str:
20
- return f"BingSearchResult(url={self.url}, title={self.title}, description={self.description})"
21
-
22
- class BingImageResult:
23
- """Class to represent a Bing image search result."""
24
- def __init__(self, title: str, image: str, thumbnail: str, url: str, source: str):
25
- self.title = title
26
- self.image = image
27
- self.thumbnail = thumbnail
28
- self.url = url
29
- self.source = source
30
- def __repr__(self):
31
- return f"BingImageResult(title={self.title}, image={self.image}, url={self.url}, source={self.source})"
32
-
33
- class BingNewsResult:
34
- """Class to represent a Bing news search result."""
35
- def __init__(self, title: str, url: str, description: str, source: str = ""):
36
- self.title = title
37
- self.url = url
38
- self.description = description
39
- self.source = source
40
- def __repr__(self):
41
- return f"BingNewsResult(title={self.title}, url={self.url}, source={self.source})"
42
-
43
- class BingSearch:
44
- """Bing search implementation with configurable parameters and advanced features."""
45
- _executor: ThreadPoolExecutor = ThreadPoolExecutor()
46
-
47
- def __init__(
48
- self,
49
- timeout: int = 10,
50
- proxies: Optional[Dict[str, str]] = None,
51
- verify: bool = True,
52
- lang: str = "en-US",
53
- sleep_interval: float = 0.0,
54
- impersonate: str = "chrome110"
55
- ):
56
- self.timeout = timeout
57
- self.proxies = proxies if proxies else {}
58
- self.verify = verify
59
- self.lang = lang
60
- self.sleep_interval = sleep_interval
61
- self._base_url = "https://www.bing.com"
62
- self.session = Session(
63
- proxies=self.proxies,
64
- verify=self.verify,
65
- timeout=self.timeout,
66
- impersonate=impersonate
67
- )
68
- self.session.headers.update(LitAgent().generate_fingerprint())
69
-
70
- def _selectors(self, element):
71
- selectors = {
72
- 'url': 'h2 a',
73
- 'title': 'h2',
74
- 'text': 'p',
75
- 'links': 'ol#b_results > li.b_algo',
76
- 'next': 'div#b_content nav[role="navigation"] a.sb_pagN'
77
- }
78
- return selectors[element]
79
-
80
- def _first_page(self, query):
81
- url = f'{self._base_url}/search?q={query}&search=&form=QBLH'
82
- return {'url': url, 'data': None}
83
-
84
- def _next_page(self, soup):
85
- selector = self._selectors('next')
86
- next_page_tag = soup.select_one(selector)
87
- url = None
88
- if next_page_tag and next_page_tag.get('href'):
89
- url = self._base_url + next_page_tag['href']
90
- return {'url': url, 'data': None}
91
-
92
- def _get_url(self, tag):
93
- url = tag.get('href', '')
94
- resp = url
95
- try:
96
- parsed_url = urlparse(url)
97
- query_params = parse_qs(parsed_url.query)
98
- if "u" in query_params:
99
- encoded_url = query_params["u"][0][2:]
100
- try:
101
- decoded_bytes = base64.urlsafe_b64decode(encoded_url + '===')
102
- except base64.binascii.Error as e:
103
- print(f"Error decoding Base64 string: {e}")
104
- return url
105
- resp = decoded_bytes.decode('utf-8')
106
- except Exception as e:
107
- print(f"Error decoding Base64 string: {e}")
108
- return resp
109
-
110
- def _make_request(self, term: str, results: int, start: int = 0) -> str:
111
- params = {
112
- "q": term,
113
- "count": results,
114
- "first": start + 1,
115
- "setlang": self.lang,
116
- }
117
- url = self._base_url + "/search"
118
- try:
119
- resp = self.session.get(
120
- url=url,
121
- params=params,
122
- )
123
- resp.raise_for_status()
124
- return resp.text
125
- except Exception as e:
126
- if hasattr(e, 'response') and e.response is not None:
127
- raise Exception(f"Bing search failed with status {e.response.status_code}: {str(e)}")
128
- else:
129
- raise Exception(f"Bing search failed: {str(e)}")
130
-
131
- def text(
132
- self,
133
- keywords: str,
134
- region: str = None,
135
- safesearch: str = "moderate",
136
- max_results: int = 10,
137
- unique: bool = True
138
- ) -> List[BingSearchResult]:
139
- """
140
- Perform a text search on Bing.
141
-
142
- Args:
143
- keywords (str): The search keywords.
144
- region (str, optional): The region for the search. Defaults to None.
145
- safesearch (str): The safe search level ("on", "moderate", "off"). Defaults to "moderate".
146
- max_results (int): The maximum number of results to fetch. Defaults to 10.
147
- unique (bool): Whether to exclude duplicate URLs from the results. Defaults to True.
148
-
149
- Returns:
150
- List[BingSearchResult]: A list of Bing search results.
151
- """
152
- if not keywords:
153
- raise ValueError("Search keywords cannot be empty")
154
- from bs4 import BeautifulSoup
155
- safe_map = {
156
- "on": "Strict",
157
- "moderate": "Moderate",
158
- "off": "Off"
159
- }
160
- safe = safe_map.get(safesearch.lower(), "Moderate")
161
- fetched_results = []
162
- fetched_links = set()
163
- def fetch_page(url):
164
- try:
165
- resp = self.session.get(url)
166
- resp.raise_for_status()
167
- return resp.text
168
- except Exception as e:
169
- if hasattr(e, 'response') and e.response is not None:
170
- raise Exception(f"Bing search failed with status {e.response.status_code}: {str(e)}")
171
- else:
172
- raise Exception(f"Bing search failed: {str(e)}")
173
-
174
- # Fix: get the first page URL
175
- url = self._first_page(keywords)['url']
176
- urls_to_fetch = [url]
177
- while len(fetched_results) < max_results and urls_to_fetch:
178
- html_pages = list(self._executor.map(fetch_page, urls_to_fetch))
179
- urls_to_fetch = []
180
- for html in html_pages:
181
- soup = BeautifulSoup(html, "html.parser")
182
- selector_links = self._selectors('links')
183
- result_blocks = soup.select(selector_links)
184
- for result in result_blocks:
185
- link_tag = result.select_one(self._selectors('url'))
186
- if not link_tag:
187
- continue
188
- url_val = self._get_url(link_tag)
189
- title_tag = result.select_one(self._selectors('title'))
190
- title = title_tag.get_text(strip=True) if title_tag else ''
191
- desc_tag = result.select_one(self._selectors('text'))
192
- description = desc_tag.get_text(strip=True) if desc_tag else ''
193
- if url_val and title:
194
- if unique and url_val in fetched_links:
195
- continue
196
- fetched_results.append(BingSearchResult(url_val, title, description))
197
- fetched_links.add(url_val)
198
- if len(fetched_results) >= max_results:
199
- break
200
- if len(fetched_results) >= max_results:
201
- break
202
- next_page_info = self._next_page(soup)
203
- if next_page_info['url']:
204
- urls_to_fetch.append(next_page_info['url'])
205
- sleep(self.sleep_interval)
206
- next_page_info = self._next_page(soup)
207
- url = next_page_info['url']
208
- sleep(self.sleep_interval)
209
- return fetched_results[:max_results]
210
-
211
- def suggestions(self, query: str, region: str = None) -> List[str]:
212
- """
213
- Fetches search suggestions for a given query.
214
-
215
- Args:
216
- query (str): The search query for which suggestions are needed.
217
- region (str, optional): The region code (e.g., "en-US") for localized suggestions.
218
-
219
- Returns:
220
- List[str]: A list of suggestion strings related to the query.
221
- """
222
- if not query:
223
- raise ValueError("Search query cannot be empty")
224
- params = {
225
- "query": query,
226
- "mkt": region if region else "en-US"
227
- }
228
- url = f"https://api.bing.com/osjson.aspx?{urlencode(params)}"
229
- try:
230
- resp = self.session.get(url)
231
- resp.raise_for_status()
232
- data = resp.json()
233
- if isinstance(data, list) and len(data) > 1 and isinstance(data[1], list):
234
- return data[1]
235
- return []
236
- except Exception as e:
237
- if hasattr(e, 'response') and e.response is not None:
238
- raise Exception(f"Bing suggestions failed with status {e.response.status_code}: {str(e)}")
239
- else:
240
- raise Exception(f"Bing suggestions failed: {str(e)}")
241
-
242
- def images(
243
- self,
244
- keywords: str,
245
- region: str = None,
246
- safesearch: str = "moderate",
247
- max_results: int = 10
248
- ) -> List[BingImageResult]:
249
- """
250
- Perform an image search on Bing.
251
-
252
- Args:
253
- keywords (str): The search keywords.
254
- region (str, optional): The region for the search. Defaults to None.
255
- safesearch (str): The safe search level ("on", "moderate", "off"). Defaults to "moderate".
256
- max_results (int): The maximum number of results to fetch. Defaults to 10.
257
-
258
- Returns:
259
- List[BingImageResult]: A list of Bing image search results.
260
- """
261
- if not keywords:
262
- raise ValueError("Search keywords cannot be empty")
263
- from bs4 import BeautifulSoup
264
- safe_map = {
265
- "on": "Strict",
266
- "moderate": "Moderate",
267
- "off": "Off"
268
- }
269
- safe = safe_map.get(safesearch.lower(), "Moderate")
270
- params = {
271
- "q": keywords,
272
- "count": max_results,
273
- "setlang": self.lang,
274
- "safeSearch": safe,
275
- }
276
- if region:
277
- params["mkt"] = region
278
- url = f"{self._base_url}/images/search?{urlencode(params)}"
279
- try:
280
- resp = self.session.get(url)
281
- resp.raise_for_status()
282
- html = resp.text
283
- except Exception as e:
284
- if hasattr(e, 'response') and e.response is not None:
285
- raise Exception(f"Bing image search failed with status {e.response.status_code}: {str(e)}")
286
- else:
287
- raise Exception(f"Bing image search failed: {str(e)}")
288
- soup = BeautifulSoup(html, "html.parser")
289
- results = []
290
- for item in soup.select("a.iusc"):
291
- try:
292
- m = item.get("m")
293
- import json
294
- meta = json.loads(m) if m else {}
295
- image_url = meta.get("murl", "")
296
- thumb_url = meta.get("turl", "")
297
- title = meta.get("t", "")
298
- page_url = meta.get("purl", "")
299
- source = meta.get("surl", "")
300
- if image_url:
301
- results.append(BingImageResult(title, image_url, thumb_url, page_url, source))
302
- if len(results) >= max_results:
303
- break
304
- except Exception:
305
- continue
306
- return results[:max_results]
307
-
308
- def news(
309
- self,
310
- keywords: str,
311
- region: str = None,
312
- safesearch: str = "moderate",
313
- max_results: int = 10,
314
- ) -> List['BingNewsResult']:
315
- """Bing news search."""
316
- if not keywords:
317
- raise ValueError("Search keywords cannot be empty")
318
- from bs4 import BeautifulSoup
319
- safe_map = {
320
- "on": "Strict",
321
- "moderate": "Moderate",
322
- "off": "Off"
323
- }
324
- safe = safe_map.get(safesearch.lower(), "Moderate")
325
- params = {
326
- "q": keywords,
327
- "form": "QBNH",
328
- "safeSearch": safe,
329
- }
330
- if region:
331
- params["mkt"] = region
332
- url = f"{self._base_url}/news/search?{urlencode(params)}"
333
- try:
334
- resp = self.session.get(url)
335
- resp.raise_for_status()
336
- except Exception as e:
337
- if hasattr(e, 'response') and e.response is not None:
338
- raise Exception(f"Bing news search failed with status {e.response.status_code}: {str(e)}")
339
- else:
340
- raise Exception(f"Bing news search failed: {str(e)}")
341
- soup = BeautifulSoup(resp.text, "html.parser")
342
- results = []
343
- for item in soup.select("div.news-card, div.card, div.newsitem, div.card-content, div.t_s_main"):
344
- a_tag = item.find("a")
345
- title = a_tag.get_text(strip=True) if a_tag else ''
346
- url_val = a_tag['href'] if a_tag and a_tag.has_attr('href') else ''
347
- desc_tag = item.find("div", class_="snippet") or item.find("div", class_="news-card-snippet") or item.find("div", class_="snippetText")
348
- description = desc_tag.get_text(strip=True) if desc_tag else ''
349
- source_tag = item.find("div", class_="source")
350
- source = source_tag.get_text(strip=True) if source_tag else ''
351
- if url_val and title:
352
- results.append(BingNewsResult(title, url_val, description, source))
353
- if len(results) >= max_results:
354
- break
355
- # Fallback: try main news list if above selectors fail
356
- if not results:
357
- for item in soup.select("a.title"):
358
- title = item.get_text(strip=True)
359
- url_val = item['href'] if item.has_attr('href') else ''
360
- description = ''
361
- source = ''
362
- if url_val and title:
363
- results.append(BingNewsResult(title, url_val, description, source))
364
- if len(results) >= max_results:
365
- break
366
- return results[:max_results]
367
-
368
- if __name__ == "__main__":
369
- from rich import print
370
- bing = BingSearch(
371
- timeout=10,
372
- proxies=None,
373
- verify=True
374
- )
375
- print("TEXT SEARCH RESULTS:")
376
- text_results = bing.text(
377
- keywords="Python programming",
378
- region="us",
379
- safesearch="moderate",
380
- max_results=30
381
- )
382
- for result in text_results:
383
- print(f"Title: {result.title}")
384
- print(f"URL: {result.url}")
385
- print(f"Description: {result.description}")
386
- print("---")
387
- print("\nSEARCH SUGGESTIONS:")
388
- suggestions = bing.suggestions("how to")
389
- print(suggestions)
390
-
391
- print("\nIMAGE SEARCH RESULTS:")
392
- image_results = bing.images(
393
- keywords="Python programming",
394
- region="us",
395
- safesearch="moderate",
396
- max_results=10
397
- )
398
- for result in image_results:
399
- print(f"Title: {result.title}")
400
- print(f"Image URL: {result.image}")
401
- print(f"Page URL: {result.url}")
402
- print(f"Source: {result.source}")
403
- print("---")
404
-
405
- print("\nNEWS SEARCH RESULTS:")
406
- news_results = bing.news(
407
- keywords="Python programming",
408
- region="us",
409
- safesearch="moderate",
410
- max_results=10
411
- )
412
- for result in news_results:
413
- print(f"Title: {result.title}")
414
- print(f"URL: {result.url}")
415
- print(f"Description: {result.description}")
416
- print(f"Source: {result.source}")
417
- print("---")