webscout 6.4__py3-none-any.whl → 6.5__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 (69) hide show
  1. webscout/AIutel.py +7 -54
  2. webscout/DWEBS.py +48 -26
  3. webscout/{YTdownloader.py → Extra/YTToolkit/YTdownloader.py} +990 -1103
  4. webscout/Extra/YTToolkit/__init__.py +3 -0
  5. webscout/{transcriber.py → Extra/YTToolkit/transcriber.py} +1 -1
  6. webscout/Extra/YTToolkit/ytapi/__init__.py +6 -0
  7. webscout/Extra/YTToolkit/ytapi/channel.py +307 -0
  8. webscout/Extra/YTToolkit/ytapi/errors.py +13 -0
  9. webscout/Extra/YTToolkit/ytapi/extras.py +45 -0
  10. webscout/Extra/YTToolkit/ytapi/https.py +88 -0
  11. webscout/Extra/YTToolkit/ytapi/patterns.py +61 -0
  12. webscout/Extra/YTToolkit/ytapi/playlist.py +59 -0
  13. webscout/Extra/YTToolkit/ytapi/pool.py +8 -0
  14. webscout/Extra/YTToolkit/ytapi/query.py +37 -0
  15. webscout/Extra/YTToolkit/ytapi/stream.py +60 -0
  16. webscout/Extra/YTToolkit/ytapi/utils.py +62 -0
  17. webscout/Extra/YTToolkit/ytapi/video.py +102 -0
  18. webscout/Extra/__init__.py +2 -1
  19. webscout/Extra/autocoder/rawdog.py +679 -680
  20. webscout/Extra/gguf.py +441 -441
  21. webscout/Extra/markdownlite/__init__.py +862 -0
  22. webscout/Extra/weather_ascii.py +2 -2
  23. webscout/Provider/PI.py +292 -221
  24. webscout/Provider/Perplexity.py +6 -14
  25. webscout/Provider/Reka.py +0 -1
  26. webscout/Provider/TTS/__init__.py +5 -1
  27. webscout/Provider/TTS/deepgram.py +183 -0
  28. webscout/Provider/TTS/elevenlabs.py +137 -0
  29. webscout/Provider/TTS/gesserit.py +151 -0
  30. webscout/Provider/TTS/murfai.py +139 -0
  31. webscout/Provider/TTS/parler.py +134 -107
  32. webscout/Provider/TTS/streamElements.py +360 -275
  33. webscout/Provider/TTS/utils.py +280 -0
  34. webscout/Provider/TTS/voicepod.py +116 -116
  35. webscout/Provider/__init__.py +146 -146
  36. webscout/Provider/meta.py +794 -779
  37. webscout/Provider/typegpt.py +1 -2
  38. webscout/__init__.py +24 -28
  39. webscout/litprinter/__init__.py +831 -830
  40. webscout/optimizers.py +269 -269
  41. webscout/prompt_manager.py +279 -279
  42. webscout/scout/__init__.py +11 -0
  43. webscout/scout/core.py +884 -0
  44. webscout/scout/element.py +459 -0
  45. webscout/scout/parsers/__init__.py +69 -0
  46. webscout/scout/parsers/html5lib_parser.py +172 -0
  47. webscout/scout/parsers/html_parser.py +236 -0
  48. webscout/scout/parsers/lxml_parser.py +178 -0
  49. webscout/scout/utils.py +38 -0
  50. webscout/update_checker.py +125 -125
  51. webscout/version.py +1 -1
  52. webscout/zeroart/__init__.py +55 -0
  53. webscout/zeroart/base.py +61 -0
  54. webscout/zeroart/effects.py +99 -0
  55. webscout/zeroart/fonts.py +816 -0
  56. webscout/zerodir/__init__.py +225 -0
  57. {webscout-6.4.dist-info → webscout-6.5.dist-info}/METADATA +12 -68
  58. {webscout-6.4.dist-info → webscout-6.5.dist-info}/RECORD +62 -37
  59. webscout/Agents/Onlinesearcher.py +0 -182
  60. webscout/Agents/__init__.py +0 -2
  61. webscout/Agents/functioncall.py +0 -248
  62. webscout/Bing_search.py +0 -251
  63. webscout/gpt4free.py +0 -666
  64. webscout/requestsHTMLfix.py +0 -775
  65. webscout/webai.py +0 -2590
  66. {webscout-6.4.dist-info → webscout-6.5.dist-info}/LICENSE.md +0 -0
  67. {webscout-6.4.dist-info → webscout-6.5.dist-info}/WHEEL +0 -0
  68. {webscout-6.4.dist-info → webscout-6.5.dist-info}/entry_points.txt +0 -0
  69. {webscout-6.4.dist-info → webscout-6.5.dist-info}/top_level.txt +0 -0
@@ -1,108 +1,135 @@
1
- import time
2
- from pathlib import Path
3
- from typing import Generator
4
- from playsound import playsound
5
- from webscout import exceptions
6
- from webscout.AIbase import TTSProvider
7
-
8
- from gradio_client import Client
9
- import os
10
-
11
-
12
- class ParlerTTS(TTSProvider):
13
- """
14
- A class to interact with the Parler TTS API through Gradio Client.
15
- """
16
-
17
- def __init__(self, timeout: int = 20, proxies: dict = None):
18
- """Initializes the Parler TTS client."""
19
- self.api_endpoint = "/gen_tts"
20
- self.client = Client("parler-tts/parler_tts") # Initialize the Gradio client
21
- self.timeout = timeout
22
- self.audio_cache_dir = Path("./audio_cache")
23
-
24
- def tts(self, text: str, description: str = "", use_large: bool = False) -> str:
25
- """
26
- Converts text to speech using the Parler TTS API.
27
-
28
- Args:
29
- text (str): The text to be converted to speech.
30
- description (str, optional): Description of the desired voice characteristics. Defaults to "".
31
- use_large (bool, optional): Whether to use the large model variant. Defaults to False.
32
-
33
- Returns:
34
- str: The filename of the saved audio file.
35
-
36
- Raises:
37
- exceptions.FailedToGenerateResponseError: If there is an error generating or saving the audio.
38
- """
39
- filename = self.audio_cache_dir / f"{int(time.time())}.wav"
40
-
41
- try:
42
- result = self.client.predict(
43
- text=text,
44
- description=description,
45
- use_large=use_large,
46
- api_name=self.api_endpoint,
47
- )
48
-
49
- if isinstance(result, bytes):
50
- audio_bytes = result
51
- elif isinstance(result, str) and os.path.isfile(result):
52
- with open(result, "rb") as f:
53
- audio_bytes = f.read()
54
- else:
55
- raise ValueError(f"Unexpected response from API: {result}")
56
-
57
- self._save_audio(audio_bytes, filename)
58
- return filename.as_posix()
59
-
60
- except Exception as e:
61
- raise exceptions.FailedToGenerateResponseError(
62
- f"Error generating audio after multiple retries: {e}"
63
- ) from e
64
-
65
- def _save_audio(self, audio_data: bytes, filename: Path):
66
- """Saves the audio data to a WAV file in the audio cache directory."""
67
- try:
68
- self.audio_cache_dir.mkdir(parents=True, exist_ok=True)
69
- with open(filename, "wb") as f:
70
- f.write(audio_data)
71
-
72
- except Exception as e:
73
- raise exceptions.FailedToGenerateResponseError(f"Error saving audio: {e}")
74
-
75
- def play_audio(self, filename: str):
76
- """
77
- Plays an audio file using playsound.
78
-
79
- Args:
80
- filename (str): The path to the audio file.
81
-
82
- Raises:
83
- RuntimeError: If there is an error playing the audio.
84
- """
85
- try:
86
- playsound(filename)
87
- except Exception as e:
88
- raise RuntimeError(f"Error playing audio: {e}")
89
-
90
-
91
- # Example usage
92
- if __name__ == "__main__":
93
- parlertts = ParlerTTS()
94
- text = (
95
- "All of the data, pre-processing, training code, and weights are released "
96
- "publicly under a permissive license, enabling the community to build on our work "
97
- "and develop their own powerful models."
98
- )
99
- voice_description = (
100
- "Laura's voice is monotone yet slightly fast in delivery, with a very close "
101
- "recording that almost has no background noise."
102
- )
103
-
104
- print("Generating audio...")
105
- audio_file = parlertts.tts(text, description=voice_description, use_large=False)
106
-
107
- print("Playing audio...")
1
+ import time
2
+ from pathlib import Path
3
+ from typing import Generator
4
+ from playsound import playsound
5
+ from webscout import exceptions
6
+ from webscout.AIbase import TTSProvider
7
+ from webscout.Litlogger import LitLogger, LogFormat, ColorScheme
8
+ from gradio_client import Client
9
+ import os
10
+
11
+
12
+ class ParlerTTS(TTSProvider):
13
+ """
14
+ A class to interact with the Parler TTS API through Gradio Client.
15
+ """
16
+
17
+ def __init__(self, timeout: int = 20, proxies: dict = None):
18
+ """Initializes the Parler TTS client."""
19
+ self.api_endpoint = "/gen_tts"
20
+ self.client = Client("parler-tts/parler_tts") # Initialize the Gradio client
21
+ self.timeout = timeout
22
+ self.audio_cache_dir = Path("./audio_cache")
23
+ self.logger = LitLogger(
24
+ name="ParlerTTS",
25
+ format=LogFormat.MODERN_EMOJI,
26
+ color_scheme=ColorScheme.AURORA
27
+ )
28
+
29
+ def tts(self, text: str, description: str = "", use_large: bool = False, verbose: bool = True) -> str:
30
+ """
31
+ Converts text to speech using the Parler TTS API.
32
+
33
+ Args:
34
+ text (str): The text to be converted to speech.
35
+ description (str, optional): Description of the desired voice characteristics. Defaults to "".
36
+ use_large (bool, optional): Whether to use the large model variant. Defaults to False.
37
+ verbose (bool, optional): Whether to log detailed information. Defaults to True.
38
+
39
+ Returns:
40
+ str: The filename of the saved audio file.
41
+
42
+ Raises:
43
+ exceptions.FailedToGenerateResponseError: If there is an error generating or saving the audio.
44
+ """
45
+ filename = self.audio_cache_dir / f"{int(time.time())}.wav"
46
+
47
+ try:
48
+ if verbose:
49
+ self.logger.info(f"Generating TTS with description: {description} 🎙️")
50
+
51
+ result = self.client.predict(
52
+ text=text,
53
+ description=description,
54
+ use_large=use_large,
55
+ api_name=self.api_endpoint,
56
+ )
57
+
58
+ if isinstance(result, bytes):
59
+ audio_bytes = result
60
+ elif isinstance(result, str) and os.path.isfile(result):
61
+ with open(result, "rb") as f:
62
+ audio_bytes = f.read()
63
+ else:
64
+ raise ValueError(f"Unexpected response from API: {result}")
65
+
66
+ self._save_audio(audio_bytes, filename)
67
+
68
+ if verbose:
69
+ self.logger.success(f"Audio generated successfully: {filename} 🔊")
70
+
71
+ return filename.as_posix()
72
+
73
+ except Exception as e:
74
+ self.logger.critical(f"Error generating audio: {e} 🚨")
75
+ raise exceptions.FailedToGenerateResponseError(
76
+ f"Error generating audio after multiple retries: {e}"
77
+ ) from e
78
+
79
+ def _save_audio(self, audio_data: bytes, filename: Path):
80
+ """
81
+ Saves the audio data to a WAV file in the audio cache directory.
82
+
83
+ Args:
84
+ audio_data (bytes): Audio data to save
85
+ filename (Path): Path to save the audio file
86
+
87
+ Raises:
88
+ exceptions.FailedToGenerateResponseError: If there is an error saving the audio.
89
+ """
90
+ try:
91
+ self.audio_cache_dir.mkdir(parents=True, exist_ok=True)
92
+ with open(filename, "wb") as f:
93
+ f.write(audio_data)
94
+ self.logger.debug(f"Audio saved to {filename} 💾")
95
+
96
+ except Exception as e:
97
+ self.logger.error(f"Error saving audio: {e} 🔇")
98
+ raise exceptions.FailedToGenerateResponseError(f"Error saving audio: {e}")
99
+
100
+ def play_audio(self, filename: str):
101
+ """
102
+ Plays an audio file using playsound.
103
+
104
+ Args:
105
+ filename (str): The path to the audio file.
106
+
107
+ Raises:
108
+ RuntimeError: If there is an error playing the audio.
109
+ """
110
+ try:
111
+ self.logger.info(f"Playing audio: {filename} 🎵")
112
+ playsound(filename)
113
+ except Exception as e:
114
+ self.logger.error(f"Error playing audio: {e} 🔇")
115
+ raise RuntimeError(f"Error playing audio: {e}")
116
+
117
+
118
+ # Example usage
119
+ if __name__ == "__main__":
120
+ parlertts = ParlerTTS()
121
+ text = (
122
+ "All of the data, pre-processing, training code, and weights are released "
123
+ "publicly under a permissive license, enabling the community to build on our work "
124
+ "and develop their own powerful models."
125
+ )
126
+ voice_description = (
127
+ "Laura's voice is monotone yet slightly fast in delivery, with a very close "
128
+ "recording that almost has no background noise."
129
+ )
130
+
131
+ parlertts.logger.info("Generating audio...")
132
+ audio_file = parlertts.tts(text, description=voice_description, use_large=False)
133
+
134
+ parlertts.logger.info("Playing audio...")
108
135
  parlertts.play_audio(audio_file)