webscout 2025.10.15__py3-none-any.whl → 2025.10.17__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 (63) hide show
  1. webscout/Extra/YTToolkit/README.md +1 -1
  2. webscout/Extra/tempmail/README.md +3 -3
  3. webscout/Provider/ClaudeOnline.py +350 -0
  4. webscout/Provider/OPENAI/README.md +1 -1
  5. webscout/Provider/TTI/bing.py +4 -4
  6. webscout/Provider/TTI/claudeonline.py +315 -0
  7. webscout/__init__.py +1 -1
  8. webscout/client.py +4 -5
  9. webscout/litprinter/__init__.py +0 -42
  10. webscout/scout/README.md +59 -8
  11. webscout/scout/core/scout.py +62 -0
  12. webscout/scout/element.py +251 -45
  13. webscout/search/__init__.py +3 -4
  14. webscout/search/engines/bing/images.py +5 -2
  15. webscout/search/engines/bing/news.py +6 -4
  16. webscout/search/engines/bing/text.py +5 -2
  17. webscout/search/engines/yahoo/__init__.py +41 -0
  18. webscout/search/engines/yahoo/answers.py +16 -0
  19. webscout/search/engines/yahoo/base.py +34 -0
  20. webscout/search/engines/yahoo/images.py +324 -0
  21. webscout/search/engines/yahoo/maps.py +16 -0
  22. webscout/search/engines/yahoo/news.py +258 -0
  23. webscout/search/engines/yahoo/suggestions.py +140 -0
  24. webscout/search/engines/yahoo/text.py +273 -0
  25. webscout/search/engines/yahoo/translate.py +16 -0
  26. webscout/search/engines/yahoo/videos.py +302 -0
  27. webscout/search/engines/yahoo/weather.py +220 -0
  28. webscout/search/http_client.py +1 -1
  29. webscout/search/yahoo_main.py +54 -0
  30. webscout/{auth → server}/__init__.py +2 -23
  31. webscout/server/config.py +84 -0
  32. webscout/{auth → server}/request_processing.py +3 -28
  33. webscout/{auth → server}/routes.py +6 -148
  34. webscout/server/schemas.py +23 -0
  35. webscout/{auth → server}/server.py +11 -43
  36. webscout/server/simple_logger.py +84 -0
  37. webscout/version.py +1 -1
  38. webscout/version.py.bak +1 -1
  39. webscout/zeroart/README.md +17 -9
  40. webscout/zeroart/__init__.py +78 -6
  41. webscout/zeroart/effects.py +51 -1
  42. webscout/zeroart/fonts.py +559 -1
  43. {webscout-2025.10.15.dist-info → webscout-2025.10.17.dist-info}/METADATA +11 -54
  44. {webscout-2025.10.15.dist-info → webscout-2025.10.17.dist-info}/RECORD +51 -46
  45. {webscout-2025.10.15.dist-info → webscout-2025.10.17.dist-info}/entry_points.txt +1 -1
  46. webscout/Extra/weather.md +0 -281
  47. webscout/auth/api_key_manager.py +0 -189
  48. webscout/auth/auth_system.py +0 -85
  49. webscout/auth/config.py +0 -175
  50. webscout/auth/database.py +0 -755
  51. webscout/auth/middleware.py +0 -248
  52. webscout/auth/models.py +0 -185
  53. webscout/auth/rate_limiter.py +0 -254
  54. webscout/auth/schemas.py +0 -103
  55. webscout/auth/simple_logger.py +0 -236
  56. webscout/search/engines/yahoo.py +0 -65
  57. webscout/search/engines/yahoo_news.py +0 -64
  58. /webscout/{auth → server}/exceptions.py +0 -0
  59. /webscout/{auth → server}/providers.py +0 -0
  60. /webscout/{auth → server}/request_models.py +0 -0
  61. {webscout-2025.10.15.dist-info → webscout-2025.10.17.dist-info}/WHEEL +0 -0
  62. {webscout-2025.10.15.dist-info → webscout-2025.10.17.dist-info}/licenses/LICENSE.md +0 -0
  63. {webscout-2025.10.15.dist-info → webscout-2025.10.17.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,140 @@
1
+ """Yahoo search suggestions engine."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ from typing import Any
7
+
8
+ from .base import YahooSearchEngine
9
+
10
+
11
+ class YahooSuggestions(YahooSearchEngine[str]):
12
+ """Yahoo search suggestions engine.
13
+
14
+ Provides autocomplete suggestions as you type.
15
+ """
16
+
17
+ name = "yahoo"
18
+ category = "suggestions"
19
+
20
+ search_url = "https://search.yahoo.com/sugg/gossip/gossip-us-ura"
21
+ search_method = "GET"
22
+
23
+ def build_payload(
24
+ self,
25
+ query: str,
26
+ region: str,
27
+ safesearch: str,
28
+ timelimit: str | None,
29
+ page: int = 1,
30
+ **kwargs: Any,
31
+ ) -> dict[str, Any]:
32
+ """Build suggestions payload.
33
+
34
+ Args:
35
+ query: Partial search query
36
+ region: Region code
37
+ safesearch: Safe search level (unused)
38
+ timelimit: Time limit (unused)
39
+ page: Page number (unused)
40
+ **kwargs: Additional parameters
41
+
42
+ Returns:
43
+ Query parameters
44
+ """
45
+ payload = {
46
+ "command": query,
47
+ "output": "sd1",
48
+ "nresults": kwargs.get("max_suggestions", 10),
49
+ }
50
+
51
+ return payload
52
+
53
+ def extract_results(self, html_text: str) -> list[str]:
54
+ """Extract suggestions from JSON response.
55
+
56
+ Args:
57
+ html_text: JSON response text
58
+
59
+ Returns:
60
+ List of suggestion strings
61
+ """
62
+ try:
63
+ data = json.loads(html_text)
64
+
65
+ # Yahoo returns suggestions in 'r' key
66
+ if "r" in data and isinstance(data["r"], list):
67
+ suggestions = []
68
+ for item in data["r"]:
69
+ if isinstance(item, dict) and "k" in item:
70
+ suggestions.append(item["k"])
71
+ elif isinstance(item, str):
72
+ suggestions.append(item)
73
+ return suggestions
74
+
75
+ return []
76
+ except (json.JSONDecodeError, KeyError, TypeError):
77
+ return []
78
+
79
+ def search(
80
+ self,
81
+ query: str,
82
+ region: str = "us-en",
83
+ safesearch: str = "moderate",
84
+ timelimit: str | None = None,
85
+ page: int = 1,
86
+ max_results: int | None = None,
87
+ **kwargs: Any,
88
+ ) -> list[str] | None:
89
+ """Get search suggestions for a query.
90
+
91
+ Args:
92
+ query: Partial search query
93
+ region: Region code
94
+ safesearch: Safe search level
95
+ timelimit: Time limit
96
+ page: Page number
97
+ max_results: Maximum suggestions
98
+ **kwargs: Additional parameters
99
+
100
+ Returns:
101
+ List of suggestion strings
102
+ """
103
+ if max_results:
104
+ kwargs["max_suggestions"] = max_results
105
+
106
+ payload = self.build_payload(
107
+ query=query,
108
+ region=region,
109
+ safesearch=safesearch,
110
+ timelimit=timelimit,
111
+ page=page,
112
+ **kwargs
113
+ )
114
+
115
+ response = self.request(self.search_method, self.search_url, params=payload)
116
+ if not response:
117
+ return None
118
+
119
+ suggestions = self.extract_results(response)
120
+
121
+ if max_results:
122
+ suggestions = suggestions[:max_results]
123
+
124
+ return suggestions if suggestions else None
125
+
126
+ def run(self, keywords: str, region: str = "us-en") -> list[str]:
127
+ """Run suggestions search and return results.
128
+
129
+ Args:
130
+ keywords: Search query.
131
+ region: Region code.
132
+
133
+ Returns:
134
+ List of suggestion strings.
135
+ """
136
+ results = self.search(
137
+ query=keywords,
138
+ region=region,
139
+ )
140
+ return results if results else []
@@ -0,0 +1,273 @@
1
+ """Yahoo text search engine with pagination support."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from collections.abc import Mapping
6
+ from typing import Any
7
+ from urllib.parse import unquote_plus, urljoin
8
+
9
+ from .base import YahooSearchEngine
10
+ from ...results import TextResult
11
+
12
+
13
+ def extract_url(u: str) -> str:
14
+ """Extract and sanitize URL from Yahoo redirect.
15
+
16
+ Yahoo uses /RU= redirect URLs that need to be decoded.
17
+ Example: /url?sa=t&url=https%3A%2F%2Fexample.com
18
+ """
19
+ if not u:
20
+ return u
21
+
22
+ # Handle /RU= redirect format
23
+ if "/RU=" in u:
24
+ start = u.find("/RU=") + 4
25
+ end = u.find("/RK=", start)
26
+ if end == -1:
27
+ end = len(u)
28
+ return unquote_plus(u[start:end])
29
+
30
+ return u
31
+
32
+
33
+ class YahooText(YahooSearchEngine[TextResult]):
34
+ """Yahoo text search engine with full pagination support.
35
+
36
+ Features:
37
+ - Multi-page navigation like a human
38
+ - Automatic next page detection
39
+ - Clean result extraction
40
+ - Time filter support
41
+ - Region support
42
+ """
43
+
44
+ name = "yahoo"
45
+ category = "text"
46
+
47
+ search_url = "https://search.yahoo.com/search"
48
+ search_method = "GET"
49
+
50
+ # XPath selectors for result extraction
51
+ items_xpath = "//div[contains(@class, 'compTitle')]"
52
+ elements_xpath: Mapping[str, str] = {
53
+ "title": ".//h3//span//text()",
54
+ "href": ".//a/@href",
55
+ "body": "./following-sibling::div[contains(@class, 'compText')]//text()",
56
+ }
57
+
58
+ def build_payload(
59
+ self,
60
+ query: str,
61
+ region: str,
62
+ safesearch: str,
63
+ timelimit: str | None,
64
+ page: int = 1,
65
+ **kwargs: Any
66
+ ) -> dict[str, Any]:
67
+ """Build search payload for Yahoo.
68
+
69
+ Args:
70
+ query: Search query string
71
+ region: Region code (e.g., 'us-en')
72
+ safesearch: Safe search level
73
+ timelimit: Time limit filter (d=day, w=week, m=month)
74
+ page: Page number (1-indexed)
75
+ **kwargs: Additional parameters
76
+
77
+ Returns:
78
+ Dictionary of query parameters
79
+ """
80
+ payload = {
81
+ "p": query,
82
+ "ei": "UTF-8",
83
+ }
84
+
85
+ # Pagination: Yahoo uses 'b' parameter for offset
86
+ # Page 1: no b parameter or b=1
87
+ # Page 2: b=8 (shows results 8-14)
88
+ # Page 3: b=15, etc.
89
+ if page > 1:
90
+ payload["b"] = f"{(page - 1) * 7 + 1}"
91
+
92
+ # Time filter
93
+ if timelimit:
94
+ payload["btf"] = timelimit
95
+
96
+ return payload
97
+
98
+ def post_extract_results(self, results: list[TextResult]) -> list[TextResult]:
99
+ """Post-process and clean extracted results.
100
+
101
+ Args:
102
+ results: Raw extracted results
103
+
104
+ Returns:
105
+ Cleaned and filtered results
106
+ """
107
+ cleaned_results = []
108
+
109
+ for result in results:
110
+ # Extract real URL from redirect
111
+ if result.href:
112
+ result.href = extract_url(result.href)
113
+
114
+ # Filter out empty results
115
+ if result.title and result.href:
116
+ cleaned_results.append(result)
117
+
118
+ return cleaned_results
119
+
120
+ def search(
121
+ self,
122
+ query: str,
123
+ region: str = "us-en",
124
+ safesearch: str = "moderate",
125
+ timelimit: str | None = None,
126
+ page: int = 1,
127
+ max_results: int | None = None,
128
+ **kwargs: Any,
129
+ ) -> list[TextResult] | None:
130
+ """Search Yahoo with automatic pagination like a human browser.
131
+
132
+ This method automatically follows pagination links to gather results
133
+ across multiple pages, similar to how a human would browse search results.
134
+
135
+ Args:
136
+ query: Search query string
137
+ region: Region code
138
+ safesearch: Safe search level
139
+ timelimit: Time filter (d=day, w=week, m=month, y=year)
140
+ page: Starting page number
141
+ max_results: Maximum number of results to return
142
+ **kwargs: Additional search parameters
143
+
144
+ Returns:
145
+ List of TextResult objects, or None if search fails
146
+ """
147
+ results = []
148
+ current_page = page
149
+ max_pages = kwargs.get("max_pages", 10) # Limit to prevent infinite loops
150
+
151
+ while current_page <= max_pages:
152
+ # Build payload for current page
153
+ payload = self.build_payload(
154
+ query=query,
155
+ region=region,
156
+ safesearch=safesearch,
157
+ timelimit=timelimit,
158
+ page=current_page,
159
+ **kwargs
160
+ )
161
+
162
+ # Make request
163
+ html_text = self.request(self.search_method, self.search_url, params=payload)
164
+ if not html_text:
165
+ break
166
+
167
+ # Pre-process HTML
168
+ html_text = self.pre_process_html(html_text)
169
+
170
+ # Extract results from current page
171
+ page_results = self.extract_results(html_text)
172
+ if not page_results:
173
+ break
174
+
175
+ results.extend(page_results)
176
+
177
+ # Check if we have enough results
178
+ if max_results and len(results) >= max_results:
179
+ break
180
+
181
+ # Look for next page link
182
+ tree = self.extract_tree(html_text)
183
+ next_links = tree.xpath("//a[contains(text(), 'Next') or contains(@class, 'next')]/@href")
184
+
185
+ if not next_links:
186
+ # Try to find numbered page links
187
+ page_links = tree.xpath(f"//a[contains(text(), '{current_page + 1}')]/@href")
188
+ if not page_links:
189
+ break
190
+
191
+ current_page += 1
192
+
193
+ # Post-process all results
194
+ results = self.post_extract_results(results)
195
+
196
+ # Trim to max_results if specified
197
+ if max_results:
198
+ results = results[:max_results]
199
+
200
+ return results if results else None
201
+
202
+ def search_page(
203
+ self,
204
+ query: str,
205
+ region: str = "us-en",
206
+ safesearch: str = "moderate",
207
+ timelimit: str | None = None,
208
+ page: int = 1,
209
+ **kwargs: Any,
210
+ ) -> list[TextResult] | None:
211
+ """Search a single page (for compatibility).
212
+
213
+ Args:
214
+ query: Search query
215
+ region: Region code
216
+ safesearch: Safe search level
217
+ timelimit: Time filter
218
+ page: Page number
219
+ **kwargs: Additional parameters
220
+
221
+ Returns:
222
+ List of results from the specified page
223
+ """
224
+ payload = self.build_payload(
225
+ query=query,
226
+ region=region,
227
+ safesearch=safesearch,
228
+ timelimit=timelimit,
229
+ page=page,
230
+ **kwargs
231
+ )
232
+
233
+ html_text = self.request(self.search_method, self.search_url, params=payload)
234
+ if not html_text:
235
+ return None
236
+
237
+ html_text = self.pre_process_html(html_text)
238
+ results = self.extract_results(html_text)
239
+
240
+ return self.post_extract_results(results) if results else None
241
+
242
+ def run(
243
+ self,
244
+ keywords: str,
245
+ region: str = "us-en",
246
+ safesearch: str = "moderate",
247
+ timelimit: str | None = None,
248
+ backend: str = "auto",
249
+ max_results: int | None = None,
250
+ ) -> list[dict[str, str]]:
251
+ """Run text search and return results as dictionaries.
252
+
253
+ Args:
254
+ keywords: Search query.
255
+ region: Region code.
256
+ safesearch: Safe search level.
257
+ timelimit: Time filter.
258
+ backend: Backend type (ignored for Yahoo).
259
+ max_results: Maximum number of results.
260
+
261
+ Returns:
262
+ List of search result dictionaries.
263
+ """
264
+ results = self.search(
265
+ query=keywords,
266
+ region=region,
267
+ safesearch=safesearch,
268
+ timelimit=timelimit,
269
+ max_results=max_results,
270
+ )
271
+ if results is None:
272
+ return []
273
+ return [result.to_dict() for result in results]
@@ -0,0 +1,16 @@
1
+ """Yahoo translate search."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from .base import YahooSearchEngine
6
+
7
+
8
+ class YahooTranslate(YahooSearchEngine):
9
+ """Yahoo translation."""
10
+
11
+ def run(self, *args, **kwargs) -> list[dict[str, str]]:
12
+ """Translate text using Yahoo.
13
+
14
+ Not supported.
15
+ """
16
+ raise NotImplementedError("Yahoo does not support translation")