webscout 8.3.4__py3-none-any.whl → 8.3.6__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 (98) hide show
  1. webscout/AIutel.py +52 -1016
  2. webscout/Bard.py +12 -6
  3. webscout/DWEBS.py +66 -57
  4. webscout/Provider/AISEARCH/PERPLEXED_search.py +214 -0
  5. webscout/Provider/AISEARCH/__init__.py +11 -10
  6. webscout/Provider/AISEARCH/felo_search.py +7 -3
  7. webscout/Provider/AISEARCH/scira_search.py +2 -0
  8. webscout/Provider/AISEARCH/stellar_search.py +53 -8
  9. webscout/Provider/Deepinfra.py +13 -1
  10. webscout/Provider/Flowith.py +6 -1
  11. webscout/Provider/GithubChat.py +1 -0
  12. webscout/Provider/GptOss.py +207 -0
  13. webscout/Provider/Kimi.py +445 -0
  14. webscout/Provider/Netwrck.py +3 -6
  15. webscout/Provider/OPENAI/README.md +2 -1
  16. webscout/Provider/OPENAI/TogetherAI.py +12 -8
  17. webscout/Provider/OPENAI/TwoAI.py +94 -1
  18. webscout/Provider/OPENAI/__init__.py +4 -4
  19. webscout/Provider/OPENAI/copilot.py +20 -4
  20. webscout/Provider/OPENAI/deepinfra.py +12 -0
  21. webscout/Provider/OPENAI/e2b.py +60 -8
  22. webscout/Provider/OPENAI/flowith.py +4 -3
  23. webscout/Provider/OPENAI/generate_api_key.py +48 -0
  24. webscout/Provider/OPENAI/gptoss.py +288 -0
  25. webscout/Provider/OPENAI/kimi.py +469 -0
  26. webscout/Provider/OPENAI/netwrck.py +8 -12
  27. webscout/Provider/OPENAI/refact.py +274 -0
  28. webscout/Provider/OPENAI/scirachat.py +4 -0
  29. webscout/Provider/OPENAI/textpollinations.py +11 -10
  30. webscout/Provider/OPENAI/toolbaz.py +1 -0
  31. webscout/Provider/OPENAI/venice.py +1 -0
  32. webscout/Provider/Perplexitylabs.py +163 -147
  33. webscout/Provider/Qodo.py +30 -6
  34. webscout/Provider/TTI/__init__.py +1 -0
  35. webscout/Provider/TTI/bing.py +14 -2
  36. webscout/Provider/TTI/together.py +11 -9
  37. webscout/Provider/TTI/venice.py +368 -0
  38. webscout/Provider/TTS/README.md +0 -1
  39. webscout/Provider/TTS/__init__.py +0 -1
  40. webscout/Provider/TTS/base.py +479 -159
  41. webscout/Provider/TTS/deepgram.py +409 -156
  42. webscout/Provider/TTS/elevenlabs.py +425 -111
  43. webscout/Provider/TTS/freetts.py +317 -140
  44. webscout/Provider/TTS/gesserit.py +192 -128
  45. webscout/Provider/TTS/murfai.py +248 -113
  46. webscout/Provider/TTS/openai_fm.py +347 -129
  47. webscout/Provider/TTS/speechma.py +620 -586
  48. webscout/Provider/TextPollinationsAI.py +11 -10
  49. webscout/Provider/TogetherAI.py +12 -4
  50. webscout/Provider/TwoAI.py +96 -2
  51. webscout/Provider/TypliAI.py +33 -27
  52. webscout/Provider/UNFINISHED/VercelAIGateway.py +339 -0
  53. webscout/Provider/UNFINISHED/fetch_together_models.py +6 -11
  54. webscout/Provider/Venice.py +1 -0
  55. webscout/Provider/WiseCat.py +18 -20
  56. webscout/Provider/__init__.py +2 -96
  57. webscout/Provider/cerebras.py +83 -33
  58. webscout/Provider/copilot.py +42 -23
  59. webscout/Provider/scira_chat.py +4 -0
  60. webscout/Provider/toolbaz.py +6 -10
  61. webscout/Provider/typefully.py +1 -11
  62. webscout/__init__.py +3 -15
  63. webscout/auth/__init__.py +19 -4
  64. webscout/auth/api_key_manager.py +189 -189
  65. webscout/auth/auth_system.py +25 -40
  66. webscout/auth/config.py +105 -6
  67. webscout/auth/database.py +377 -22
  68. webscout/auth/models.py +185 -130
  69. webscout/auth/request_processing.py +175 -11
  70. webscout/auth/routes.py +99 -2
  71. webscout/auth/server.py +9 -2
  72. webscout/auth/simple_logger.py +236 -0
  73. webscout/conversation.py +22 -20
  74. webscout/sanitize.py +1078 -0
  75. webscout/scout/README.md +20 -23
  76. webscout/scout/core/crawler.py +125 -38
  77. webscout/scout/core/scout.py +26 -5
  78. webscout/version.py +1 -1
  79. webscout/webscout_search.py +13 -6
  80. webscout/webscout_search_async.py +10 -8
  81. webscout/yep_search.py +13 -5
  82. {webscout-8.3.4.dist-info → webscout-8.3.6.dist-info}/METADATA +10 -149
  83. {webscout-8.3.4.dist-info → webscout-8.3.6.dist-info}/RECORD +88 -87
  84. webscout/Provider/Glider.py +0 -225
  85. webscout/Provider/OPENAI/README_AUTOPROXY.md +0 -238
  86. webscout/Provider/OPENAI/c4ai.py +0 -394
  87. webscout/Provider/OPENAI/glider.py +0 -330
  88. webscout/Provider/OPENAI/typegpt.py +0 -368
  89. webscout/Provider/OPENAI/uncovrAI.py +0 -477
  90. webscout/Provider/TTS/sthir.py +0 -94
  91. webscout/Provider/WritingMate.py +0 -273
  92. webscout/Provider/typegpt.py +0 -284
  93. webscout/Provider/uncovr.py +0 -333
  94. /webscout/Provider/{samurai.py → UNFINISHED/samurai.py} +0 -0
  95. {webscout-8.3.4.dist-info → webscout-8.3.6.dist-info}/WHEEL +0 -0
  96. {webscout-8.3.4.dist-info → webscout-8.3.6.dist-info}/entry_points.txt +0 -0
  97. {webscout-8.3.4.dist-info → webscout-8.3.6.dist-info}/licenses/LICENSE.md +0 -0
  98. {webscout-8.3.4.dist-info → webscout-8.3.6.dist-info}/top_level.txt +0 -0
@@ -1,140 +1,317 @@
1
- import os
2
- import requests
3
- from datetime import datetime
4
- from datetime import datetime
5
- from webscout.Provider.TTS import BaseTTSProvider
6
- from webscout.litagent import LitAgent
7
-
8
-
9
- class FreeTTS(BaseTTSProvider):
10
- """
11
- Text-to-speech provider using the FreeTTS API.
12
- """
13
-
14
- headers = {
15
- "accept": "*/*",
16
- "accept-language": "ru-RU,ru;q=0.8",
17
- "cache-control": "no-cache",
18
- "pragma": "no-cache",
19
- "sec-ch-ua": '"Brave";v="137", "Chromium";v="137", "Not/A)Brand";v="24"',
20
- "sec-ch-ua-mobile": "?0",
21
- "sec-ch-ua-platform": '"Windows"',
22
- "sec-fetch-dest": "empty",
23
- "sec-fetch-mode": "cors",
24
- "sec-fetch-site": "same-origin",
25
- "sec-gpc": "1",
26
- "User-Agent": LitAgent().random()
27
- }
28
-
29
- def __init__(self, lang="ru-RU", timeout: int = 30, proxies: dict = None):
30
- """Initializes the FreeTTS TTS client."""
31
- super().__init__()
32
- self.lang = lang
33
- self.url = "https://freetts.ru/api/v1/tts"
34
- self.select_url = "https://freetts.ru/api/v1/select"
35
- self.audio_base_url = "https://freetts.ru"
36
- self.session = requests.Session()
37
- self.session.headers.update(self.headers)
38
- if proxies:
39
- self.session.proxies.update(proxies)
40
- self.timeout = timeout
41
- self.voices = {}
42
- self.load_voices()
43
-
44
- def load_voices(self):
45
- """Загружает данные о голосах и приводит их к нужному виду"""
46
- try:
47
- response = self.session.get(self.select_url, timeout=self.timeout)
48
- if response.status_code == 200:
49
- data = response.json()
50
- voices_data = data["data"]["voice"]
51
-
52
- if isinstance(voices_data, list):
53
- for voice_info in voices_data:
54
- if isinstance(voice_info, dict):
55
- voice_id = voice_info.get("code")
56
- voice_name = voice_info.get("name", voice_id)
57
- if voice_id and voice_id.startswith(self.lang):
58
- self.voices[voice_id] = voice_name
59
- else:
60
- print("Error")
61
- print("Done")
62
- else:
63
- print(f"Error HTTP: {response.status_code}")
64
- except Exception as e:
65
- print(f"Error downloading voice: {e}")
66
-
67
- def get_available_voices(self):
68
- """Возвращает все доступные голоса в формате строки"""
69
- if not self.voices:
70
- return "Error"
71
- voices_list = [f"{voice_id}: {name}" for voice_id, name in self.voices.items()]
72
- return "\n".join(voices_list)
73
-
74
- def tts(self, text: str, voiceid: str = None) -> str:
75
- """
76
- Converts text to speech using the FreeTTS API and saves it to a file.
77
- Args:
78
- text (str): The text to convert to speech
79
- voiceid (str): Voice ID to use for TTS (default: first available)
80
- Returns:
81
- str: Path to the generated audio file (MP3)
82
- Raises:
83
- AssertionError: If no voices are available
84
- requests.RequestException: If there's an error communicating with the API
85
- RuntimeError: If there's an error processing the audio
86
- """
87
- try:
88
- if not self.voices:
89
- raise RuntimeError(f"No voices available for language '{self.lang}'")
90
-
91
- available_voices = self.get_available_voices()
92
- if not available_voices:
93
- print(f"There are no available voices for the language '{self.lang}'")
94
- return ""
95
-
96
- if voiceid is None:
97
- voiceid = next(iter(available_voices.keys()))
98
-
99
- payload = {
100
- "text": text,
101
- "voiceid": voiceid
102
- }
103
-
104
- response = requests.post(self.url, json=payload, headers=self.headers)
105
-
106
- if response.status_code == 200:
107
- data = response.json()
108
- mp3_path = data.get("data", {}).get("src", "")
109
-
110
- if not mp3_path:
111
- print("The path to the audio file in the response was not found.")
112
- return ""
113
-
114
- mp3_url = self.audio_base_url + mp3_path
115
-
116
- mp3_filename = datetime.now().strftime("%Y_%m_%d_%H_%M_%S") + ".mp3"
117
- full_path = os.path.abspath(mp3_filename)
118
-
119
- with requests.get(mp3_url, stream=True) as r:
120
- r.raise_for_status()
121
- with open(mp3_filename, "wb") as f:
122
- for chunk in r.iter_content(chunk_size=1024):
123
- f.write(chunk)
124
-
125
- print(f"File '{mp3_filename}'saved successfully!")
126
- return full_path
127
-
128
- except Exception as e:
129
- print(e)
130
-
131
- if __name__ == "__main__":
132
- tts = FreeTTS(lang="ru")
133
- available_voices = tts.get_available_voices()
134
- print("Available voices:", available_voices)
135
-
136
- text_to_speak = input("\nEnter text: ")
137
- voice_id = "ru-RU001"
138
- print("[debug] Generating audio...")
139
- audio_file = tts.tts(text=text_to_speak, voiceid=voice_id)
140
- print(f"Audio saved to: {audio_file}")
1
+ ##################################################################################
2
+ ## FreeTTS Provider ##
3
+ ##################################################################################
4
+ import os
5
+ import requests
6
+ from datetime import datetime
7
+ from webscout.Provider.TTS.base import BaseTTSProvider
8
+ from webscout.litagent import LitAgent
9
+
10
+
11
+ class FreeTTS(BaseTTSProvider):
12
+ """
13
+ Text-to-speech provider using the FreeTTS API with OpenAI-compatible interface.
14
+
15
+ This provider follows the OpenAI TTS API structure with support for:
16
+ - Multiple TTS models (gpt-4o-mini-tts, tts-1, tts-1-hd)
17
+ - Dynamic voice loading based on language
18
+ - Voice instructions for controlling speech aspects
19
+ - Multiple output formats
20
+ - Streaming support
21
+ """
22
+
23
+ headers = {
24
+ "accept": "*/*",
25
+ "accept-language": "ru-RU,ru;q=0.8",
26
+ "cache-control": "no-cache",
27
+ "pragma": "no-cache",
28
+ "sec-ch-ua": '"Brave";v="137", "Chromium";v="137", "Not/A)Brand";v="24"',
29
+ "sec-ch-ua-mobile": "?0",
30
+ "sec-ch-ua-platform": '"Windows"',
31
+ "sec-fetch-dest": "empty",
32
+ "sec-fetch-mode": "cors",
33
+ "sec-fetch-site": "same-origin",
34
+ "sec-gpc": "1",
35
+ "User-Agent": LitAgent().random()
36
+ }
37
+
38
+ # Override supported models for FreeTTS
39
+ SUPPORTED_MODELS = None
40
+
41
+ # Override supported voices (will be loaded dynamically)
42
+ SUPPORTED_VOICES = []
43
+
44
+ # Override supported formats
45
+ SUPPORTED_FORMATS = [
46
+ "mp3", # Default format for FreeTTS
47
+ "wav", # Alternative format
48
+ "aac" # Additional format support
49
+ ]
50
+
51
+ def __init__(self, lang="ru-RU", timeout: int = 30, proxies: dict = None):
52
+ """
53
+ Initialize the FreeTTS TTS client.
54
+
55
+ Args:
56
+ lang (str): Language code for voice selection
57
+ timeout (int): Request timeout in seconds
58
+ proxies (dict): Proxy configuration
59
+ """
60
+ super().__init__()
61
+ self.lang = lang
62
+ self.url = "https://freetts.ru/api/v1/tts"
63
+ self.select_url = "https://freetts.ru/api/v1/select"
64
+ self.audio_base_url = "https://freetts.ru"
65
+ self.session = requests.Session()
66
+ self.session.headers.update(self.headers)
67
+ if proxies:
68
+ self.session.proxies.update(proxies)
69
+ self.timeout = timeout
70
+ self.voices = {}
71
+ self.load_voices()
72
+ # Set default voice to first available
73
+ self.default_voice = next(iter(self.voices.keys())) if self.voices else "ru-RU001"
74
+
75
+ def load_voices(self):
76
+ """Load voice data and format it appropriately"""
77
+ try:
78
+ response = self.session.get(self.select_url, timeout=self.timeout)
79
+ if response.status_code == 200:
80
+ data = response.json()
81
+ voices_data = data["data"]["voice"]
82
+
83
+ if isinstance(voices_data, list):
84
+ for voice_info in voices_data:
85
+ if isinstance(voice_info, dict):
86
+ voice_id = voice_info.get("code")
87
+ voice_name = voice_info.get("name", voice_id)
88
+ if voice_id and voice_id.startswith(self.lang):
89
+ self.voices[voice_id] = voice_name
90
+ # Add to supported voices list
91
+ if voice_id not in self.SUPPORTED_VOICES:
92
+ self.SUPPORTED_VOICES.append(voice_id)
93
+ print("Voices loaded successfully")
94
+ else:
95
+ print(f"HTTP Error: {response.status_code}")
96
+ except Exception as e:
97
+ print(f"Error loading voices: {e}")
98
+
99
+ def get_available_voices(self):
100
+ """Return all available voices in string format"""
101
+ if not self.voices:
102
+ return "No voices available"
103
+ voices_list = [f"{voice_id}: {name}" for voice_id, name in self.voices.items()]
104
+ return "\n".join(voices_list)
105
+
106
+ def validate_voice(self, voice: str) -> str:
107
+ """
108
+ Validate and return the voice ID.
109
+
110
+ Args:
111
+ voice (str): Voice ID to validate
112
+
113
+ Returns:
114
+ str: Validated voice ID
115
+
116
+ Raises:
117
+ ValueError: If voice is not supported
118
+ """
119
+ if voice not in self.voices:
120
+ raise ValueError(f"Voice '{voice}' not supported. Available voices: {', '.join(self.voices.keys())}")
121
+ return voice
122
+
123
+ def tts(
124
+ self,
125
+ text: str,
126
+ model: str = "gpt-4o-mini-tts",
127
+ voice: str = None,
128
+ response_format: str = "mp3",
129
+ instructions: str = None,
130
+ verbose: bool = True
131
+ ) -> str:
132
+ """
133
+ Convert text to speech using FreeTTS API with OpenAI-compatible parameters.
134
+
135
+ Args:
136
+ text (str): The text to convert to speech
137
+ model (str): The TTS model to use (gpt-4o-mini-tts, tts-1, tts-1-hd)
138
+ voice (str): Voice ID to use for TTS (default: first available)
139
+ response_format (str): Audio format (mp3, wav, aac)
140
+ instructions (str): Voice instructions (not used by FreeTTS but kept for compatibility)
141
+ verbose (bool): Whether to print debug information
142
+
143
+ Returns:
144
+ str: Path to the generated audio file
145
+
146
+ Raises:
147
+ ValueError: If input parameters are invalid
148
+ RuntimeError: If there is an error generating or saving the audio
149
+ """
150
+ # Validate input parameters
151
+ if not text or not isinstance(text, str):
152
+ raise ValueError("Input text must be a non-empty string")
153
+ if len(text) > 10000:
154
+ raise ValueError("Input text exceeds maximum allowed length of 10,000 characters")
155
+
156
+ # Validate model and format using base class methods
157
+ model = self.validate_model(model)
158
+ response_format = self.validate_format(response_format)
159
+
160
+ # Use default voice if not provided
161
+ if voice is None:
162
+ voice = self.default_voice
163
+
164
+ # Validate voice
165
+ voice = self.validate_voice(voice)
166
+
167
+ try:
168
+ if not self.voices:
169
+ raise RuntimeError(f"No voices available for language '{self.lang}'")
170
+
171
+ available_voices = self.get_available_voices()
172
+ if not available_voices:
173
+ if verbose:
174
+ print(f"No available voices for language '{self.lang}'")
175
+ return ""
176
+
177
+ payload = {
178
+ "text": text,
179
+ "voiceid": voice,
180
+ "model": model,
181
+ "format": response_format
182
+ }
183
+
184
+ response = self.session.post(self.url, json=payload, headers=self.headers, timeout=self.timeout)
185
+
186
+ if response.status_code == 200:
187
+ data = response.json()
188
+ mp3_path = data.get("data", {}).get("src", "")
189
+
190
+ if not mp3_path:
191
+ raise RuntimeError("Audio file path not found in response")
192
+
193
+ mp3_url = self.audio_base_url + mp3_path
194
+
195
+ # Create filename with appropriate extension
196
+ file_extension = f".{response_format}" if response_format != "pcm" else ".wav"
197
+ filename = datetime.now().strftime("%Y_%m_%d_%H_%M_%S") + file_extension
198
+ full_path = os.path.abspath(filename)
199
+
200
+ with requests.get(mp3_url, stream=True, timeout=self.timeout) as r:
201
+ r.raise_for_status()
202
+ with open(filename, "wb") as f:
203
+ for chunk in r.iter_content(chunk_size=1024):
204
+ f.write(chunk)
205
+
206
+ if verbose:
207
+ print(f"[debug] Speech generated successfully")
208
+ print(f"[debug] Model: {model}")
209
+ print(f"[debug] Voice: {voice}")
210
+ print(f"[debug] Format: {response_format}")
211
+ print(f"[debug] Audio saved to: {filename}")
212
+
213
+ return full_path
214
+ else:
215
+ raise RuntimeError(f"API request failed with status code: {response.status_code}")
216
+
217
+ except Exception as e:
218
+ if verbose:
219
+ print(f"[debug] Error generating speech: {e}")
220
+ raise RuntimeError(f"Failed to generate speech: {str(e)}")
221
+
222
+ def create_speech(
223
+ self,
224
+ input: str,
225
+ model: str = "gpt-4o-mini-tts",
226
+ voice: str = None,
227
+ response_format: str = "mp3",
228
+ instructions: str = None,
229
+ verbose: bool = False
230
+ ) -> str:
231
+ """
232
+ OpenAI-compatible speech creation interface.
233
+
234
+ Args:
235
+ input (str): The text to convert to speech
236
+ model (str): The TTS model to use
237
+ voice (str): The voice to use
238
+ response_format (str): Audio format
239
+ instructions (str): Voice instructions (not used by FreeTTS)
240
+ verbose (bool): Whether to print debug information
241
+
242
+ Returns:
243
+ str: Path to the generated audio file
244
+ """
245
+ return self.tts(
246
+ text=input,
247
+ model=model,
248
+ voice=voice,
249
+ response_format=response_format,
250
+ instructions=instructions,
251
+ verbose=verbose
252
+ )
253
+
254
+ def stream_audio(
255
+ self,
256
+ input: str,
257
+ model: str = "gpt-4o-mini-tts",
258
+ voice: str = None,
259
+ response_format: str = "mp3",
260
+ instructions: str = None,
261
+ chunk_size: int = 1024,
262
+ verbose: bool = False
263
+ ):
264
+ """
265
+ Stream audio response in chunks.
266
+
267
+ Args:
268
+ input (str): The text to convert to speech
269
+ model (str): The TTS model to use
270
+ voice (str): The voice to use
271
+ response_format (str): Audio format
272
+ instructions (str): Voice instructions
273
+ chunk_size (int): Size of audio chunks to yield
274
+ verbose (bool): Whether to print debug information
275
+
276
+ Yields:
277
+ bytes: Audio data chunks
278
+ """
279
+ # Generate the audio file using create_speech
280
+ audio_file = self.create_speech(
281
+ input=input,
282
+ model=model,
283
+ voice=voice,
284
+ response_format=response_format,
285
+ instructions=instructions,
286
+ verbose=verbose
287
+ )
288
+
289
+ # Stream the file in chunks
290
+ with open(audio_file, 'rb') as f:
291
+ while chunk := f.read(chunk_size):
292
+ yield chunk
293
+
294
+
295
+ # Example usage
296
+ if __name__ == "__main__":
297
+ # Initialize the FreeTTS client
298
+ tts_client = FreeTTS(lang="ru-RU")
299
+
300
+ # Print available voices
301
+ print("Available voices:")
302
+ print(tts_client.get_available_voices())
303
+
304
+ # Convert text to speech
305
+ try:
306
+ audio_file = tts_client.create_speech(
307
+ input="Привет, как дела?",
308
+ model="gpt-4o-mini-tts",
309
+ voice="ru-RU001",
310
+ response_format="mp3",
311
+ verbose=True
312
+ )
313
+ print(f"Audio saved to: {audio_file}")
314
+ except Exception as e:
315
+ print(f"Error: {e}")
316
+ except Exception as e:
317
+ print(f"Error: {e}")