webscout 6.4__py3-none-any.whl → 6.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.
- webscout/AIutel.py +7 -54
- webscout/DWEBS.py +48 -26
- webscout/{YTdownloader.py → Extra/YTToolkit/YTdownloader.py} +990 -1103
- webscout/Extra/YTToolkit/__init__.py +3 -0
- webscout/{transcriber.py → Extra/YTToolkit/transcriber.py} +1 -1
- webscout/Extra/YTToolkit/ytapi/__init__.py +6 -0
- webscout/Extra/YTToolkit/ytapi/channel.py +307 -0
- webscout/Extra/YTToolkit/ytapi/errors.py +13 -0
- webscout/Extra/YTToolkit/ytapi/extras.py +45 -0
- webscout/Extra/YTToolkit/ytapi/https.py +88 -0
- webscout/Extra/YTToolkit/ytapi/patterns.py +61 -0
- webscout/Extra/YTToolkit/ytapi/playlist.py +59 -0
- webscout/Extra/YTToolkit/ytapi/pool.py +8 -0
- webscout/Extra/YTToolkit/ytapi/query.py +37 -0
- webscout/Extra/YTToolkit/ytapi/stream.py +60 -0
- webscout/Extra/YTToolkit/ytapi/utils.py +62 -0
- webscout/Extra/YTToolkit/ytapi/video.py +102 -0
- webscout/Extra/__init__.py +2 -1
- webscout/Extra/autocoder/autocoder_utiles.py +119 -101
- webscout/Extra/autocoder/rawdog.py +679 -680
- webscout/Extra/gguf.py +441 -441
- webscout/Extra/markdownlite/__init__.py +862 -0
- webscout/Extra/weather_ascii.py +2 -2
- webscout/Provider/AISEARCH/__init__.py +2 -0
- webscout/Provider/AISEARCH/ooai.py +155 -0
- webscout/Provider/Amigo.py +70 -85
- webscout/Provider/{prefind.py → Jadve.py} +72 -70
- webscout/Provider/Netwrck.py +235 -0
- webscout/Provider/Openai.py +4 -3
- webscout/Provider/PI.py +292 -221
- webscout/Provider/PizzaGPT.py +3 -3
- webscout/Provider/Reka.py +0 -1
- webscout/Provider/TTS/__init__.py +5 -1
- webscout/Provider/TTS/deepgram.py +183 -0
- webscout/Provider/TTS/elevenlabs.py +137 -0
- webscout/Provider/TTS/gesserit.py +151 -0
- webscout/Provider/TTS/murfai.py +139 -0
- webscout/Provider/TTS/parler.py +134 -107
- webscout/Provider/TTS/streamElements.py +360 -275
- webscout/Provider/TTS/utils.py +280 -0
- webscout/Provider/TTS/voicepod.py +116 -116
- webscout/Provider/TeachAnything.py +15 -2
- webscout/Provider/Youchat.py +42 -8
- webscout/Provider/__init__.py +8 -21
- webscout/Provider/meta.py +794 -779
- webscout/Provider/multichat.py +230 -0
- webscout/Provider/promptrefine.py +2 -2
- webscout/Provider/talkai.py +10 -13
- webscout/Provider/turboseek.py +5 -4
- webscout/Provider/tutorai.py +8 -112
- webscout/Provider/typegpt.py +5 -7
- webscout/Provider/x0gpt.py +81 -9
- webscout/Provider/yep.py +123 -361
- webscout/__init__.py +33 -28
- webscout/conversation.py +24 -9
- webscout/exceptions.py +188 -20
- webscout/litprinter/__init__.py +719 -831
- webscout/litprinter/colors.py +54 -0
- webscout/optimizers.py +420 -270
- webscout/prompt_manager.py +279 -279
- webscout/scout/__init__.py +8 -0
- webscout/scout/core/__init__.py +7 -0
- webscout/scout/core/crawler.py +140 -0
- webscout/scout/core/scout.py +571 -0
- webscout/scout/core/search_result.py +96 -0
- webscout/scout/core/text_analyzer.py +63 -0
- webscout/scout/core/text_utils.py +277 -0
- webscout/scout/core/web_analyzer.py +52 -0
- webscout/scout/core.py +884 -0
- webscout/scout/element.py +460 -0
- webscout/scout/parsers/__init__.py +69 -0
- webscout/scout/parsers/html5lib_parser.py +172 -0
- webscout/scout/parsers/html_parser.py +236 -0
- webscout/scout/parsers/lxml_parser.py +178 -0
- webscout/scout/utils.py +38 -0
- webscout/update_checker.py +184 -125
- webscout/version.py +1 -1
- webscout/zeroart/__init__.py +55 -0
- webscout/zeroart/base.py +60 -0
- webscout/zeroart/effects.py +99 -0
- webscout/zeroart/fonts.py +816 -0
- webscout/zerodir/__init__.py +225 -0
- {webscout-6.4.dist-info → webscout-6.6.dist-info}/METADATA +18 -231
- webscout-6.6.dist-info/RECORD +197 -0
- webscout-6.6.dist-info/top_level.txt +2 -0
- webstoken/__init__.py +30 -0
- webstoken/classifier.py +189 -0
- webstoken/keywords.py +216 -0
- webstoken/language.py +128 -0
- webstoken/ner.py +164 -0
- webstoken/normalizer.py +35 -0
- webstoken/processor.py +77 -0
- webstoken/sentiment.py +206 -0
- webstoken/stemmer.py +73 -0
- webstoken/t.py +75 -0
- webstoken/tagger.py +60 -0
- webstoken/tokenizer.py +158 -0
- webscout/Agents/Onlinesearcher.py +0 -182
- webscout/Agents/__init__.py +0 -2
- webscout/Agents/functioncall.py +0 -248
- webscout/Bing_search.py +0 -251
- webscout/Provider/Perplexity.py +0 -599
- webscout/Provider/RoboCoders.py +0 -206
- webscout/Provider/genspark.py +0 -225
- webscout/Provider/perplexitylabs.py +0 -265
- webscout/Provider/twitterclone.py +0 -251
- webscout/Provider/upstage.py +0 -230
- webscout/gpt4free.py +0 -666
- webscout/requestsHTMLfix.py +0 -775
- webscout/webai.py +0 -2590
- webscout-6.4.dist-info/RECORD +0 -154
- webscout-6.4.dist-info/top_level.txt +0 -1
- /webscout/Provider/{felo_search.py → AISEARCH/felo_search.py} +0 -0
- {webscout-6.4.dist-info → webscout-6.6.dist-info}/LICENSE.md +0 -0
- {webscout-6.4.dist-info → webscout-6.6.dist-info}/WHEEL +0 -0
- {webscout-6.4.dist-info → webscout-6.6.dist-info}/entry_points.txt +0 -0
webscout/update_checker.py
CHANGED
|
@@ -1,125 +1,184 @@
|
|
|
1
|
-
"""
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
from typing import Optional
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
except
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
1
|
+
"""
|
|
2
|
+
Ayy, check it out! 👀
|
|
3
|
+
>>> from webscout import check_for_updates
|
|
4
|
+
>>> check_for_updates()
|
|
5
|
+
'Yo, new Webscout version just dropped: 2.0.0! 🔥
|
|
6
|
+
Level up with: `pip install --upgrade webscout`'
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import subprocess
|
|
10
|
+
import sys
|
|
11
|
+
import os
|
|
12
|
+
from typing import Optional
|
|
13
|
+
|
|
14
|
+
import requests
|
|
15
|
+
from packaging import version
|
|
16
|
+
import re
|
|
17
|
+
|
|
18
|
+
from webscout import LitLogger, ColorScheme
|
|
19
|
+
from importlib.metadata import version as get_package_version
|
|
20
|
+
from importlib.metadata import PackageNotFoundError
|
|
21
|
+
from importlib.metadata import metadata as get_package_metadata
|
|
22
|
+
|
|
23
|
+
# Setting up that clean logger format, no cap! 💯
|
|
24
|
+
CUSTOM_FORMAT = """{message}"""
|
|
25
|
+
|
|
26
|
+
logger = LitLogger(
|
|
27
|
+
name="WebscoutUpdate",
|
|
28
|
+
format=CUSTOM_FORMAT,
|
|
29
|
+
color_scheme=ColorScheme.OCEAN,
|
|
30
|
+
level_styles={
|
|
31
|
+
"TRACE": "DIM",
|
|
32
|
+
"DEBUG": "NORMAL",
|
|
33
|
+
"INFO": "BOLD",
|
|
34
|
+
"SUCCESS": "BOLD",
|
|
35
|
+
"WARNING": "BOLD",
|
|
36
|
+
"ERROR": "BOLD",
|
|
37
|
+
"CRITICAL": "BOLD"
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
def get_installed_version() -> Optional[str]:
|
|
42
|
+
"""Yo, let's check what version you're running! 🔍
|
|
43
|
+
|
|
44
|
+
What this function's all about:
|
|
45
|
+
- Checking your setup real quick 💨
|
|
46
|
+
- Getting them version deets 📱
|
|
47
|
+
- Handling any problems like a boss 💪
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
Optional[str]: Your version number or None if we can't find it
|
|
51
|
+
|
|
52
|
+
Examples:
|
|
53
|
+
>>> version = get_installed_version()
|
|
54
|
+
>>> print(version)
|
|
55
|
+
'1.2.3'
|
|
56
|
+
"""
|
|
57
|
+
try:
|
|
58
|
+
return get_package_version('webscout')
|
|
59
|
+
except PackageNotFoundError:
|
|
60
|
+
return None
|
|
61
|
+
except Exception as e:
|
|
62
|
+
return None
|
|
63
|
+
|
|
64
|
+
def get_pypi_version() -> Optional[str]:
|
|
65
|
+
"""Let's see what's fresh on PyPI! 🚀
|
|
66
|
+
|
|
67
|
+
This function's vibe:
|
|
68
|
+
- Hitting up PyPI for the latest drop 🌐
|
|
69
|
+
- Keeping it smooth with timeout handling ⚡
|
|
70
|
+
- Making sure we get good data fr fr 💯
|
|
71
|
+
|
|
72
|
+
Returns:
|
|
73
|
+
Optional[str]: Latest version or None if something's not right
|
|
74
|
+
|
|
75
|
+
Examples:
|
|
76
|
+
>>> latest = get_pypi_version()
|
|
77
|
+
>>> print(latest)
|
|
78
|
+
'2.0.0'
|
|
79
|
+
"""
|
|
80
|
+
try:
|
|
81
|
+
response = requests.get(
|
|
82
|
+
"https://pypi.org/pypi/webscout/json",
|
|
83
|
+
timeout=10
|
|
84
|
+
)
|
|
85
|
+
response.raise_for_status()
|
|
86
|
+
return response.json()['info']['version']
|
|
87
|
+
except requests.RequestException as e:
|
|
88
|
+
pass
|
|
89
|
+
except (KeyError, ValueError) as e:
|
|
90
|
+
pass
|
|
91
|
+
except Exception as e:
|
|
92
|
+
pass
|
|
93
|
+
return None
|
|
94
|
+
|
|
95
|
+
def version_compare(v1: str, v2: str) -> int:
|
|
96
|
+
"""Time to compare these versions! 💪
|
|
97
|
+
|
|
98
|
+
Args:
|
|
99
|
+
v1: First version we checking
|
|
100
|
+
v2: Second version to compare with
|
|
101
|
+
|
|
102
|
+
Returns:
|
|
103
|
+
int: -1 if v1's older, 1 if v1's newer, 0 if they twins
|
|
104
|
+
|
|
105
|
+
Examples:
|
|
106
|
+
>>> version_compare('1.0.0', '2.0.0')
|
|
107
|
+
-1
|
|
108
|
+
"""
|
|
109
|
+
try:
|
|
110
|
+
version1 = version.parse(v1)
|
|
111
|
+
version2 = version.parse(v2)
|
|
112
|
+
if version1 < version2:
|
|
113
|
+
return -1
|
|
114
|
+
if version1 > version2:
|
|
115
|
+
return 1
|
|
116
|
+
return 0
|
|
117
|
+
except version.InvalidVersion as e:
|
|
118
|
+
pass
|
|
119
|
+
return 0
|
|
120
|
+
except Exception as e:
|
|
121
|
+
pass
|
|
122
|
+
return 0
|
|
123
|
+
|
|
124
|
+
def display_version_info(installed: Optional[str], latest: Optional[str]) -> None:
|
|
125
|
+
"""Let's break down your version status! 📱
|
|
126
|
+
|
|
127
|
+
What we doing here:
|
|
128
|
+
- Comparing your version with the latest drop 🔄
|
|
129
|
+
- Letting you know if you need to level up ⬆️
|
|
130
|
+
- Keeping you in the loop with style 💯
|
|
131
|
+
|
|
132
|
+
Args:
|
|
133
|
+
installed: What you running rn
|
|
134
|
+
latest: What's fresh out there
|
|
135
|
+
|
|
136
|
+
Examples:
|
|
137
|
+
>>> display_version_info('1.0.0', '2.0.0')
|
|
138
|
+
'Yo, new Webscout version just dropped: 2.0.0! 🔥'
|
|
139
|
+
"""
|
|
140
|
+
if installed:
|
|
141
|
+
pass
|
|
142
|
+
|
|
143
|
+
if latest and installed:
|
|
144
|
+
comparison_result = version_compare(installed, latest)
|
|
145
|
+
if comparison_result < 0:
|
|
146
|
+
logger.warning(
|
|
147
|
+
f"Yo, new Webscout version just dropped: {latest}! 🔥\n"
|
|
148
|
+
f"Level up with: `pip install --upgrade webscout`"
|
|
149
|
+
)
|
|
150
|
+
elif comparison_result > 0:
|
|
151
|
+
logger.success("You already got the latest version, no cap! 💯")
|
|
152
|
+
|
|
153
|
+
def check_for_updates() -> None:
|
|
154
|
+
"""Time to check if you're running the latest! 🚀
|
|
155
|
+
|
|
156
|
+
What we doing:
|
|
157
|
+
- Peeking at your current setup 📱
|
|
158
|
+
- Checking what's new out there 🌐
|
|
159
|
+
- Keeping you updated fr fr ⚡
|
|
160
|
+
|
|
161
|
+
Examples:
|
|
162
|
+
>>> check_for_updates()
|
|
163
|
+
# We got you with them version checks fam!
|
|
164
|
+
"""
|
|
165
|
+
installed_version = get_installed_version()
|
|
166
|
+
latest_version = get_pypi_version()
|
|
167
|
+
|
|
168
|
+
if not installed_version:
|
|
169
|
+
pass
|
|
170
|
+
return
|
|
171
|
+
|
|
172
|
+
if not latest_version:
|
|
173
|
+
pass
|
|
174
|
+
return
|
|
175
|
+
|
|
176
|
+
display_version_info(installed_version, latest_version)
|
|
177
|
+
|
|
178
|
+
if __name__ == "__main__":
|
|
179
|
+
try:
|
|
180
|
+
check_for_updates()
|
|
181
|
+
except KeyboardInterrupt:
|
|
182
|
+
logger.warning("Update check got cancelled, no worries fam! 🤚")
|
|
183
|
+
except Exception as e:
|
|
184
|
+
logger.error(f"Uh oh, something went wrong: {str(e)} 😔")
|
webscout/version.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
__version__ = "6.
|
|
1
|
+
__version__ = "6.6"
|
|
2
2
|
__prog__ = "webscout"
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ZeroArt: A zero-dependency ASCII art text generator
|
|
3
|
+
|
|
4
|
+
Create awesome ASCII art text without external dependencies!
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .base import ZeroArtFont
|
|
8
|
+
from .fonts import BlockFont, SlantFont, NeonFont, CyberFont
|
|
9
|
+
from .effects import AsciiArtEffects
|
|
10
|
+
|
|
11
|
+
def figlet_format(text, font='block'):
|
|
12
|
+
"""
|
|
13
|
+
Generate ASCII art text
|
|
14
|
+
|
|
15
|
+
:param text: Text to convert
|
|
16
|
+
:param font: Font style (default: 'block')
|
|
17
|
+
:return: ASCII art representation of text
|
|
18
|
+
"""
|
|
19
|
+
font_map = {
|
|
20
|
+
'block': BlockFont(),
|
|
21
|
+
'slant': SlantFont(),
|
|
22
|
+
'neon': NeonFont(),
|
|
23
|
+
'cyber': CyberFont()
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
selected_font = font_map.get(font.lower(), BlockFont())
|
|
27
|
+
return selected_font.render(text)
|
|
28
|
+
|
|
29
|
+
def print_figlet(text, font='block'):
|
|
30
|
+
"""
|
|
31
|
+
Print ASCII art text directly
|
|
32
|
+
|
|
33
|
+
:param text: Text to convert and print
|
|
34
|
+
:param font: Font style (default: 'block')
|
|
35
|
+
"""
|
|
36
|
+
print(figlet_format(text, font))
|
|
37
|
+
|
|
38
|
+
# Expose additional effects
|
|
39
|
+
rainbow = AsciiArtEffects.rainbow_effect
|
|
40
|
+
glitch = AsciiArtEffects.glitch_effect
|
|
41
|
+
wrap_text = AsciiArtEffects.wrap_text
|
|
42
|
+
outline = AsciiArtEffects.outline_effect
|
|
43
|
+
|
|
44
|
+
__all__ = [
|
|
45
|
+
'figlet_format',
|
|
46
|
+
'print_figlet',
|
|
47
|
+
'rainbow',
|
|
48
|
+
'glitch',
|
|
49
|
+
'wrap_text',
|
|
50
|
+
'outline',
|
|
51
|
+
'BlockFont',
|
|
52
|
+
'SlantFont',
|
|
53
|
+
'NeonFont',
|
|
54
|
+
'CyberFont'
|
|
55
|
+
]
|
webscout/zeroart/base.py
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ZeroArt Base: Core classes and utilities for ASCII art generation
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
class ZeroArtFont:
|
|
6
|
+
"""Base class for ASCII art fonts"""
|
|
7
|
+
def __init__(self, name):
|
|
8
|
+
self.name = name
|
|
9
|
+
self.letters = {}
|
|
10
|
+
self.special_chars = {}
|
|
11
|
+
|
|
12
|
+
def add_letter(self, char, art_lines):
|
|
13
|
+
"""
|
|
14
|
+
Add a custom letter to the font
|
|
15
|
+
|
|
16
|
+
:param char: Character to add
|
|
17
|
+
:param art_lines: List of art lines representing the character
|
|
18
|
+
"""
|
|
19
|
+
self.letters[char.upper()] = art_lines
|
|
20
|
+
|
|
21
|
+
def add_special_char(self, name, art_lines):
|
|
22
|
+
"""
|
|
23
|
+
Add a special ASCII art character or design
|
|
24
|
+
|
|
25
|
+
:param name: Name of the special character
|
|
26
|
+
:param art_lines: List of art lines representing the character
|
|
27
|
+
"""
|
|
28
|
+
self.special_chars[name] = art_lines
|
|
29
|
+
|
|
30
|
+
def get_letter(self, char):
|
|
31
|
+
"""
|
|
32
|
+
Get ASCII art for a specific character
|
|
33
|
+
|
|
34
|
+
:param char: Character to retrieve
|
|
35
|
+
:return: List of art lines or default space
|
|
36
|
+
"""
|
|
37
|
+
return self.letters.get(char.upper(), self.letters.get(' ', [' ']))
|
|
38
|
+
|
|
39
|
+
def render(self, text):
|
|
40
|
+
if not text:
|
|
41
|
+
return ""
|
|
42
|
+
|
|
43
|
+
# Get the maximum height of any character in the font
|
|
44
|
+
max_height = max(len(self.get_letter(c)) for c in text)
|
|
45
|
+
|
|
46
|
+
# Initialize art_lines with empty strings
|
|
47
|
+
art_lines = ["" for _ in range(max_height)]
|
|
48
|
+
|
|
49
|
+
# Process each character
|
|
50
|
+
for char in text:
|
|
51
|
+
char_art = self.get_letter(char)
|
|
52
|
+
# Pad shorter characters with empty lines to match max_height
|
|
53
|
+
while len(char_art) < max_height:
|
|
54
|
+
char_art.append(" " * len(char_art[0]))
|
|
55
|
+
|
|
56
|
+
# Add character art to each line
|
|
57
|
+
for i in range(max_height):
|
|
58
|
+
art_lines[i] += char_art[i] + " "
|
|
59
|
+
|
|
60
|
+
return "\n".join(art_lines)
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ZeroArt Effects: ASCII art text effects and transformations
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import random
|
|
6
|
+
import textwrap
|
|
7
|
+
|
|
8
|
+
class AsciiArtEffects:
|
|
9
|
+
"""Collection of ASCII art text effects"""
|
|
10
|
+
|
|
11
|
+
@staticmethod
|
|
12
|
+
def rainbow_effect(text, font):
|
|
13
|
+
"""
|
|
14
|
+
Apply a rainbow-like color effect to ASCII art
|
|
15
|
+
|
|
16
|
+
:param text: Text to render
|
|
17
|
+
:param font: Font to use
|
|
18
|
+
:return: Rainbow-styled ASCII art
|
|
19
|
+
"""
|
|
20
|
+
colors = [
|
|
21
|
+
'\033[91m', # Red
|
|
22
|
+
'\033[93m', # Yellow
|
|
23
|
+
'\033[92m', # Green
|
|
24
|
+
'\033[94m', # Blue
|
|
25
|
+
'\033[95m', # Magenta
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
art = font.render(text)
|
|
29
|
+
art_lines = art.split('\n')
|
|
30
|
+
|
|
31
|
+
colored_lines = []
|
|
32
|
+
for line in art_lines:
|
|
33
|
+
colored_line = ''
|
|
34
|
+
for char in line:
|
|
35
|
+
color = random.choice(colors)
|
|
36
|
+
colored_line += color + char
|
|
37
|
+
colored_lines.append(colored_line + '\033[0m') # Reset color
|
|
38
|
+
|
|
39
|
+
return '\n'.join(colored_lines)
|
|
40
|
+
|
|
41
|
+
@staticmethod
|
|
42
|
+
def glitch_effect(text, font, glitch_intensity=0.1):
|
|
43
|
+
"""
|
|
44
|
+
Apply a glitch-like distortion to ASCII art
|
|
45
|
+
|
|
46
|
+
:param text: Text to render
|
|
47
|
+
:param font: Font to use
|
|
48
|
+
:param glitch_intensity: Probability of character distortion
|
|
49
|
+
:return: Glitched ASCII art
|
|
50
|
+
"""
|
|
51
|
+
art = font.render(text)
|
|
52
|
+
art_lines = art.split('\n')
|
|
53
|
+
|
|
54
|
+
glitched_lines = []
|
|
55
|
+
glitch_chars = ['~', '^', '`', '¯', '±']
|
|
56
|
+
|
|
57
|
+
for line in art_lines:
|
|
58
|
+
glitched_line = ''
|
|
59
|
+
for char in line:
|
|
60
|
+
if random.random() < glitch_intensity:
|
|
61
|
+
glitched_line += random.choice(glitch_chars)
|
|
62
|
+
else:
|
|
63
|
+
glitched_line += char
|
|
64
|
+
glitched_lines.append(glitched_line)
|
|
65
|
+
|
|
66
|
+
return '\n'.join(glitched_lines)
|
|
67
|
+
|
|
68
|
+
@staticmethod
|
|
69
|
+
def wrap_text(text, width=20):
|
|
70
|
+
"""
|
|
71
|
+
Wrap ASCII art text to a specific width
|
|
72
|
+
|
|
73
|
+
:param text: Text to wrap
|
|
74
|
+
:param width: Maximum line width
|
|
75
|
+
:return: Wrapped text
|
|
76
|
+
"""
|
|
77
|
+
return textwrap.fill(text, width=width)
|
|
78
|
+
|
|
79
|
+
@staticmethod
|
|
80
|
+
def outline_effect(text, font, outline_char='*'):
|
|
81
|
+
"""
|
|
82
|
+
Add an outline effect to ASCII art
|
|
83
|
+
|
|
84
|
+
:param text: Text to render
|
|
85
|
+
:param font: Font to use
|
|
86
|
+
:param outline_char: Character to use for outline
|
|
87
|
+
:return: ASCII art with outline
|
|
88
|
+
"""
|
|
89
|
+
art = font.render(text)
|
|
90
|
+
art_lines = art.split('\n')
|
|
91
|
+
|
|
92
|
+
outlined_lines = []
|
|
93
|
+
for line in art_lines:
|
|
94
|
+
outlined_line = outline_char + line + outline_char
|
|
95
|
+
outlined_lines.append(outlined_line)
|
|
96
|
+
|
|
97
|
+
top_bottom_line = outline_char * (len(outlined_lines[0]))
|
|
98
|
+
|
|
99
|
+
return '\n'.join([top_bottom_line] + outlined_lines + [top_bottom_line])
|