webscout 6.3__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 (131) hide show
  1. webscout/AIauto.py +191 -176
  2. webscout/AIbase.py +0 -197
  3. webscout/AIutel.py +441 -1130
  4. webscout/DWEBS.py +189 -35
  5. webscout/{YTdownloader.py → Extra/YTToolkit/YTdownloader.py} +990 -1103
  6. webscout/Extra/YTToolkit/__init__.py +3 -0
  7. webscout/{transcriber.py → Extra/YTToolkit/transcriber.py} +479 -551
  8. webscout/Extra/YTToolkit/ytapi/__init__.py +6 -0
  9. webscout/Extra/YTToolkit/ytapi/channel.py +307 -0
  10. webscout/Extra/YTToolkit/ytapi/errors.py +13 -0
  11. webscout/Extra/YTToolkit/ytapi/extras.py +45 -0
  12. webscout/Extra/YTToolkit/ytapi/https.py +88 -0
  13. webscout/Extra/YTToolkit/ytapi/patterns.py +61 -0
  14. webscout/Extra/YTToolkit/ytapi/playlist.py +59 -0
  15. webscout/Extra/YTToolkit/ytapi/pool.py +8 -0
  16. webscout/Extra/YTToolkit/ytapi/query.py +37 -0
  17. webscout/Extra/YTToolkit/ytapi/stream.py +60 -0
  18. webscout/Extra/YTToolkit/ytapi/utils.py +62 -0
  19. webscout/Extra/YTToolkit/ytapi/video.py +102 -0
  20. webscout/Extra/__init__.py +3 -1
  21. webscout/Extra/autocoder/__init__.py +9 -0
  22. webscout/Extra/autocoder/autocoder_utiles.py +121 -0
  23. webscout/Extra/autocoder/rawdog.py +680 -0
  24. webscout/Extra/autollama.py +246 -195
  25. webscout/Extra/gguf.py +81 -56
  26. webscout/Extra/markdownlite/__init__.py +862 -0
  27. webscout/Extra/weather_ascii.py +2 -2
  28. webscout/LLM.py +206 -43
  29. webscout/Litlogger/__init__.py +681 -0
  30. webscout/Provider/DARKAI.py +1 -1
  31. webscout/Provider/EDITEE.py +1 -1
  32. webscout/Provider/NinjaChat.py +1 -1
  33. webscout/Provider/PI.py +120 -35
  34. webscout/Provider/Perplexity.py +590 -598
  35. webscout/Provider/Reka.py +0 -1
  36. webscout/Provider/RoboCoders.py +206 -0
  37. webscout/Provider/TTI/AiForce/__init__.py +22 -0
  38. webscout/Provider/TTI/AiForce/async_aiforce.py +257 -0
  39. webscout/Provider/TTI/AiForce/sync_aiforce.py +242 -0
  40. webscout/Provider/TTI/Nexra/__init__.py +22 -0
  41. webscout/Provider/TTI/Nexra/async_nexra.py +286 -0
  42. webscout/Provider/TTI/Nexra/sync_nexra.py +258 -0
  43. webscout/Provider/TTI/PollinationsAI/__init__.py +23 -0
  44. webscout/Provider/TTI/PollinationsAI/async_pollinations.py +330 -0
  45. webscout/Provider/TTI/PollinationsAI/sync_pollinations.py +285 -0
  46. webscout/Provider/TTI/__init__.py +2 -4
  47. webscout/Provider/TTI/artbit/__init__.py +22 -0
  48. webscout/Provider/TTI/artbit/async_artbit.py +184 -0
  49. webscout/Provider/TTI/artbit/sync_artbit.py +176 -0
  50. webscout/Provider/TTI/blackbox/__init__.py +4 -0
  51. webscout/Provider/TTI/blackbox/async_blackbox.py +212 -0
  52. webscout/Provider/TTI/{blackboximage.py → blackbox/sync_blackbox.py} +199 -153
  53. webscout/Provider/TTI/deepinfra/__init__.py +4 -0
  54. webscout/Provider/TTI/deepinfra/async_deepinfra.py +227 -0
  55. webscout/Provider/TTI/deepinfra/sync_deepinfra.py +199 -0
  56. webscout/Provider/TTI/huggingface/__init__.py +22 -0
  57. webscout/Provider/TTI/huggingface/async_huggingface.py +199 -0
  58. webscout/Provider/TTI/huggingface/sync_huggingface.py +195 -0
  59. webscout/Provider/TTI/imgninza/__init__.py +4 -0
  60. webscout/Provider/TTI/imgninza/async_ninza.py +214 -0
  61. webscout/Provider/TTI/{imgninza.py → imgninza/sync_ninza.py} +209 -136
  62. webscout/Provider/TTI/talkai/__init__.py +4 -0
  63. webscout/Provider/TTI/talkai/async_talkai.py +229 -0
  64. webscout/Provider/TTI/talkai/sync_talkai.py +207 -0
  65. webscout/Provider/TTS/__init__.py +5 -1
  66. webscout/Provider/TTS/deepgram.py +183 -0
  67. webscout/Provider/TTS/elevenlabs.py +137 -0
  68. webscout/Provider/TTS/gesserit.py +151 -0
  69. webscout/Provider/TTS/murfai.py +139 -0
  70. webscout/Provider/TTS/parler.py +134 -107
  71. webscout/Provider/TTS/streamElements.py +360 -275
  72. webscout/Provider/TTS/utils.py +280 -0
  73. webscout/Provider/TTS/voicepod.py +116 -116
  74. webscout/Provider/__init__.py +8 -1
  75. webscout/Provider/askmyai.py +2 -2
  76. webscout/Provider/cerebras.py +227 -219
  77. webscout/Provider/llama3mitril.py +0 -1
  78. webscout/Provider/meta.py +794 -779
  79. webscout/Provider/mhystical.py +176 -0
  80. webscout/Provider/perplexitylabs.py +265 -0
  81. webscout/Provider/twitterclone.py +251 -245
  82. webscout/Provider/typegpt.py +358 -0
  83. webscout/__init__.py +9 -8
  84. webscout/__main__.py +5 -5
  85. webscout/cli.py +252 -280
  86. webscout/conversation.py +227 -0
  87. webscout/exceptions.py +161 -29
  88. webscout/litagent/__init__.py +172 -0
  89. webscout/litprinter/__init__.py +832 -0
  90. webscout/optimizers.py +270 -0
  91. webscout/prompt_manager.py +279 -0
  92. webscout/scout/__init__.py +11 -0
  93. webscout/scout/core.py +884 -0
  94. webscout/scout/element.py +459 -0
  95. webscout/scout/parsers/__init__.py +69 -0
  96. webscout/scout/parsers/html5lib_parser.py +172 -0
  97. webscout/scout/parsers/html_parser.py +236 -0
  98. webscout/scout/parsers/lxml_parser.py +178 -0
  99. webscout/scout/utils.py +38 -0
  100. webscout/swiftcli/__init__.py +810 -0
  101. webscout/update_checker.py +125 -0
  102. webscout/version.py +1 -1
  103. webscout/zeroart/__init__.py +55 -0
  104. webscout/zeroart/base.py +61 -0
  105. webscout/zeroart/effects.py +99 -0
  106. webscout/zeroart/fonts.py +816 -0
  107. webscout/zerodir/__init__.py +225 -0
  108. {webscout-6.3.dist-info → webscout-6.5.dist-info}/METADATA +37 -112
  109. webscout-6.5.dist-info/RECORD +179 -0
  110. webscout/Agents/Onlinesearcher.py +0 -182
  111. webscout/Agents/__init__.py +0 -2
  112. webscout/Agents/functioncall.py +0 -248
  113. webscout/Bing_search.py +0 -154
  114. webscout/Provider/TTI/AIuncensoredimage.py +0 -103
  115. webscout/Provider/TTI/Nexra.py +0 -120
  116. webscout/Provider/TTI/PollinationsAI.py +0 -138
  117. webscout/Provider/TTI/WebSimAI.py +0 -142
  118. webscout/Provider/TTI/aiforce.py +0 -160
  119. webscout/Provider/TTI/artbit.py +0 -141
  120. webscout/Provider/TTI/deepinfra.py +0 -148
  121. webscout/Provider/TTI/huggingface.py +0 -155
  122. webscout/Provider/TTI/talkai.py +0 -116
  123. webscout/g4f.py +0 -666
  124. webscout/models.py +0 -23
  125. webscout/requestsHTMLfix.py +0 -775
  126. webscout/webai.py +0 -2590
  127. webscout-6.3.dist-info/RECORD +0 -124
  128. {webscout-6.3.dist-info → webscout-6.5.dist-info}/LICENSE.md +0 -0
  129. {webscout-6.3.dist-info → webscout-6.5.dist-info}/WHEEL +0 -0
  130. {webscout-6.3.dist-info → webscout-6.5.dist-info}/entry_points.txt +0 -0
  131. {webscout-6.3.dist-info → webscout-6.5.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,139 @@
1
+ import time
2
+ import requests
3
+ import pathlib
4
+ from io import BytesIO
5
+ from urllib.parse import urlencode
6
+ from playsound import playsound
7
+ from webscout import exceptions
8
+ from webscout.AIbase import TTSProvider
9
+ from webscout.Litlogger import LitLogger, LogFormat, ColorScheme
10
+ from webscout.litagent import LitAgent
11
+ from concurrent.futures import ThreadPoolExecutor, as_completed
12
+ from . import utils
13
+
14
+ class MurfAITTS(TTSProvider):
15
+ """Text-to-speech provider using the MurfAITTS API."""
16
+ # Request headers
17
+ headers: dict[str, str] = {
18
+ "User-Agent": LitAgent().random()
19
+ }
20
+ cache_dir = pathlib.Path("./audio_cache")
21
+ all_voices: dict[str, str] = {"Hazel": "en-UK-hazel"}
22
+
23
+ def __init__(self, timeout: int = 20, proxies: dict = None):
24
+ """Initializes the MurfAITTS TTS client."""
25
+ self.session = requests.Session()
26
+ self.session.headers.update(self.headers)
27
+ if proxies:
28
+ self.session.proxies.update(proxies)
29
+ self.timeout = timeout
30
+ self.logger = LitLogger(
31
+ name="MurfAITTS",
32
+ format=LogFormat.MODERN_EMOJI,
33
+ color_scheme=ColorScheme.AURORA
34
+ )
35
+
36
+ def tts(self, text: str, voice: str = "Hazel", verbose:bool = True) -> str:
37
+ """Converts text to speech using the MurfAITTS API and saves it to a file."""
38
+ assert (
39
+ voice in self.all_voices
40
+ ), f"Voice '{voice}' not one of [{', '.join(self.all_voices.keys())}]"
41
+
42
+ filename = self.cache_dir / f"{int(time.time())}.mp3"
43
+
44
+ voice_id = self.all_voices[voice]
45
+
46
+ # Split text into sentences
47
+ sentences = utils.split_sentences(text)
48
+
49
+ # Function to request audio for each chunk
50
+ def generate_audio_for_chunk(part_text: str, part_number: int):
51
+ while True:
52
+ try:
53
+ params: dict[str, str] = {
54
+ "name": voice_id,
55
+ "text": part_text
56
+ }
57
+ encode_param: str = urlencode(params)
58
+ response = self.session.get(f"https://murf.ai/Prod/anonymous-tts/audio?{encode_param}", headers=self.headers, timeout=self.timeout)
59
+ response.raise_for_status()
60
+
61
+ # Create the audio_cache directory if it doesn't exist
62
+ self.cache_dir.mkdir(parents=True, exist_ok=True)
63
+
64
+ # Check if the request was successful
65
+ if response.ok and response.status_code == 200:
66
+ if verbose:
67
+ self.logger.success(f"Chunk {part_number} processed successfully 🎉")
68
+ return part_number, response.content
69
+ else:
70
+ if verbose:
71
+ self.logger.warning(f"No data received for chunk {part_number}. Retrying...")
72
+ except requests.RequestException as e:
73
+ if verbose:
74
+ self.logger.error(f"Error for chunk {part_number}: {e}. Retrying... 🔄")
75
+ time.sleep(1)
76
+ try:
77
+ # Using ThreadPoolExecutor to handle requests concurrently
78
+ with ThreadPoolExecutor() as executor:
79
+ futures = {executor.submit(generate_audio_for_chunk, sentence.strip(), chunk_num): chunk_num
80
+ for chunk_num, sentence in enumerate(sentences, start=1)}
81
+
82
+ # Dictionary to store results with order preserved
83
+ audio_chunks = {}
84
+
85
+ for future in as_completed(futures):
86
+ chunk_num = futures[future]
87
+ try:
88
+ part_number, audio_data = future.result()
89
+ audio_chunks[part_number] = audio_data # Store the audio data in correct sequence
90
+ except Exception as e:
91
+ if verbose:
92
+ self.logger.error(f"Failed to generate audio for chunk {chunk_num}: {e} 🚨")
93
+
94
+ # Combine audio chunks in the correct sequence
95
+ combined_audio = BytesIO()
96
+ for part_number in sorted(audio_chunks.keys()):
97
+ combined_audio.write(audio_chunks[part_number])
98
+ if verbose:
99
+ self.logger.debug(f"Added chunk {part_number} to the combined file.")
100
+
101
+ # Save the combined audio data to a single file
102
+ with open(filename, 'wb') as f:
103
+ f.write(combined_audio.getvalue())
104
+ if verbose:
105
+ self.logger.info(f"Final Audio Saved as {filename} 🔊")
106
+ return filename.as_posix()
107
+
108
+ except requests.exceptions.RequestException as e:
109
+ self.logger.critical(f"Failed to perform the operation: {e} 🚨")
110
+ raise exceptions.FailedToGenerateResponseError(
111
+ f"Failed to perform the operation: {e}"
112
+ )
113
+
114
+ def play_audio(self, filename: str):
115
+ """
116
+ Plays an audio file using playsound.
117
+
118
+ Args:
119
+ filename (str): The path to the audio file.
120
+
121
+ Raises:
122
+ RuntimeError: If there is an error playing the audio.
123
+ """
124
+ try:
125
+ playsound(filename)
126
+ except Exception as e:
127
+ self.logger.error(f"Error playing audio: {e} 🔇")
128
+ raise RuntimeError(f"Error playing audio: {e}")
129
+
130
+ # Example usage
131
+ if __name__ == "__main__":
132
+ murfai = MurfAITTS()
133
+ text = "This is a test of the MurfAITTS text-to-speech API. It supports multiple sentences and advanced logging."
134
+
135
+ murfai.logger.info("Generating audio...")
136
+ audio_file = murfai.tts(text, voice="Hazel")
137
+
138
+ murfai.logger.info("Playing audio...")
139
+ murfai.play_audio(audio_file)
@@ -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)