Skip to content

Commit be3db2e

Browse files
committed
Fix parsing of comments links in the relaxed YAML config format
1 parent 2735d0c commit be3db2e

File tree

3 files changed

+246
-3
lines changed

3 files changed

+246
-3
lines changed

TikTokLiveTool.pyw

+12-3
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,21 @@ pending_gifts = []
2121
pending_actions = []
2222

2323
def preprocess_yaml_string(yaml_str):
24-
# Match keys that need quoting and preserve indentation
2524
def quote_key(match):
2625
indent = match.group(1) # Leading spaces
2726
key = match.group(2) # The actual key
2827
return f'{indent}"{key}":'
29-
yaml_str = re.sub(r'^(\s*)([^:\s][^:\n]*):', quote_key, yaml_str, flags=re.MULTILINE)
30-
return yaml_str
28+
29+
# Only process lines that are not comments
30+
def process_line(line):
31+
if line.strip().startswith('#'):
32+
return line
33+
return re.sub(r'^(\s*)([^:\s][^:\n]*):', quote_key, line)
34+
35+
# Apply processing to each line individually
36+
yaml_lines = yaml_str.splitlines()
37+
processed_lines = [process_line(line) for line in yaml_lines]
38+
return '\n'.join(processed_lines)
3139

3240
def open_link(url):
3341
webbrowser.open(url)
@@ -401,6 +409,7 @@ def load_config():
401409
try:
402410
with open("config.cfg", 'r') as file:
403411
configfile = preprocess_yaml_string(file.read())
412+
print(configfile)
404413
config.update(yaml.safe_load(configfile))
405414
except Exception as e:
406415
print(f"Error loading config: {e}")

gifts.txt

+204
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
Gimme The Vote: 1
2+
Music Play: 1
3+
GG: 1
4+
Ice Cream Cone: 1
5+
Rose: 1
6+
TikTok: 1
7+
Community Fest: 1
8+
Cat Paws: 1
9+
Thumbs Up: 1
10+
Heart: 1
11+
Cake Slice: 1
12+
Glow Stick: 1
13+
Love you: 1
14+
Squirrel: 1
15+
Heart Me: 1
16+
Team Bracelet: 2
17+
Finger Heart: 5
18+
Instant Noodles: 5
19+
Cute Cat: 5
20+
New Year Protection: 5
21+
Fighting: 7
22+
LOL: 9
23+
Cheer You Up: 9
24+
Friendship Necklace: 10
25+
Rosa: 10
26+
Watermelon: 10
27+
Shiba Inu Cookie: 10
28+
Shaved ice: 10
29+
Perfume: 20
30+
Thank you: 20
31+
Nice to meet you: 20
32+
Love you: 20
33+
Doughnut: 30
34+
Hot Choco: 30
35+
Community Crown: 99
36+
Paper Crane: 99
37+
Little Crown: 99
38+
Cap: 99
39+
Snowman: 99
40+
Hat and Mustache: 99
41+
Cupid’s Bow: 99
42+
Like-Pop: 99
43+
Love Painting: 99
44+
Pineapple: 99
45+
Star: 99
46+
Mishka Bear: 100
47+
Confetti: 100
48+
Hand Hearts: 100
49+
Hand Heart: 100
50+
LIVE Fandom: 100
51+
Marvelous Confetti: 100
52+
Sunglasses: 199
53+
Hearts: 199
54+
Lock and Key: 199
55+
Garland Headpiece: 199
56+
Love You: 199
57+
Cheer For You: 199
58+
Birthday Glasses: 199
59+
Pinch Cheek: 199
60+
Wooly Hat: 199
61+
Shiba Inu: 199
62+
Stroke Hair: 199
63+
Stinging Bee: 199
64+
Massage for You: 199
65+
Coffee Magic: 199
66+
Lucky Spray: 199
67+
Bunny Ears: 200
68+
Pinch Face: 249
69+
Boxing Gloves: 299
70+
Duck: 299
71+
Corgi: 299
72+
Fruit Friends: 299
73+
Kitten’s Paw: 299
74+
Dancing Flower: 299
75+
Naughty Chicken: 299
76+
Play for You: 299
77+
TikTok Crown: 299
78+
Rock Star: 299
79+
Rookie King: 299
80+
Lucky Cat: 399
81+
Singing Mic: 399
82+
Forever Rosa: 399
83+
Magic Rhythm: 399
84+
Relaxed Goose: 399
85+
Tom's Hug: 399
86+
Beating Heart: 449
87+
Coral: 499
88+
Hands Up: 499
89+
Money Gun: 500
90+
Spaghetti Kiss: 500
91+
Great Job: 500
92+
Cuddle with Me: 500
93+
Sweet Memories: 500
94+
You’re Amazing: 500
95+
VR Goggles: 500
96+
Lion’s Mane: 500
97+
Gem Gun: 500
98+
Swan: 699
99+
The Van Cat: 799
100+
Claw machine: 800
101+
Train: 899
102+
Travel with You: 999
103+
Hot Spring: 999
104+
Lovely Music: 999
105+
Lucky Airdrop Box: 999
106+
Shiny Face: 999
107+
Trending Figure: 999
108+
Gold Mine: 1000
109+
Mirror Bloom: 1000
110+
Watermelon Love: 1000
111+
Magic Cat: 1000
112+
Blooming Ribbons: 1000
113+
Galaxy: 1000
114+
Giraffe: 1000
115+
Spotlight: 1000
116+
Shiny air balloon: 1000
117+
Fireworks: 1088
118+
Frozen Magic: 1299
119+
Garland : 1500
120+
Champion: 1500
121+
Chasing the Dream: 1500
122+
Lover’s Lock: 1500
123+
Greeting Card: 1500
124+
Future Encounter: 1500
125+
Adventure Encounter: 1500
126+
Penlight: 1599
127+
Here We Go: 1799
128+
Love Drop: 1800
129+
Battle Crush: 1888
130+
Make-up Box: 1999
131+
Rabbit: 1999
132+
Star of Red Carpet: 1999
133+
Super Cake: 1999
134+
Gift Box: 1999
135+
Cooper Flies Home: 1999
136+
Mystery Firework: 1999
137+
Whale Diving: 2150
138+
Animal Band: 2500
139+
Concert: 2888
140+
Motorcycle: 2988
141+
Community Celebration: 2999
142+
Illumination: 2999
143+
Old Famous Car: 2999
144+
Rhythmic Bear: 2999
145+
Space Kitty: 2999
146+
Ferris Wheel: 3000
147+
Meteor Shower: 3000
148+
Golden Party: 3000
149+
Sakura Train: 3999
150+
Gift Box: 3999
151+
Flower Overflow: 4000
152+
Cosy Nights: 4000
153+
Your Concert: 4500
154+
Private Jet: 4888
155+
Leon the Kitten: 4888
156+
Signature Jet: 4888
157+
Unicorn Fantasy: 5000
158+
Farm: 5000
159+
Flying Jets: 5000
160+
Motorcycle Together: 5000
161+
Aqua Car: 6000
162+
Future City: 6000
163+
Lili the Leopard: 6599
164+
Birthday Party: 6999
165+
Celebration Time: 6999
166+
Happy Party: 6999
167+
Sports Car: 7000
168+
Star Throne: 7999
169+
Match Trophy: 7999
170+
Star Throne: 7999
171+
Leon and Lili: 9699
172+
Interstellar: 10000
173+
Sunset Speedway: 10000
174+
Couples Lock: 10000
175+
Falcon: 10999
176+
Red Lightning: 12000
177+
White Wolf: 12000
178+
Gimme The Mic: 12000
179+
Holy Arc: 14999
180+
Rosa Nebula: 15000
181+
Look! Meteor Shower: 15000
182+
Future Journey: 15000
183+
Amusement Park: 17000
184+
Fly Love: 19999
185+
Castle Fantasy: 20000
186+
TikTok Shuttle: 20000
187+
Yacht: 20000
188+
Premium Shuttle: 20000
189+
Rose Carriage: 25000
190+
Phoenix: 25999
191+
Adam’s Dream: 25999
192+
Mystic Castle: 25999
193+
Solar Temple: 25999
194+
Dragon Flame: 26999
195+
Lion: 29999
196+
Leon and Lion: 34000
197+
TikTok Universe+: 34999
198+
TikTok Stars: 39999
199+
Thunder Falcon: 39999
200+
Fire Phoenix: 41999
201+
Arnold the Warrior: 42999
202+
Pegasus: 42999
203+
TikTok Universe: 44999
204+
TikTok Universe: 44999

requirements.txt

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
anyio==4.4.0
2+
async-timeout==4.0.3
3+
betterproto==2.0.0b7
4+
certifi==2024.7.4
5+
customtkinter==5.2.2
6+
darkdetect==0.8.0
7+
ffmpy==0.4.0
8+
grpclib==0.4.7
9+
h11==0.14.0
10+
h2==4.1.0
11+
hpack==4.0.0
12+
httpcore==1.0.5
13+
httpx==0.27.0
14+
hyperframe==6.0.1
15+
idna==3.8
16+
mashumaro==3.13.1
17+
multidict==6.0.5
18+
packaging==24.1
19+
protobuf==5.27.3
20+
protobuf3-to-dict==0.1.5
21+
pyee==11.1.0
22+
python-dateutil==2.9.0.post0
23+
python-socks==2.4.4
24+
PyYAML==6.0.2
25+
six==1.16.0
26+
sniffio==1.3.1
27+
TikTokLive==6.1.0
28+
typing_extensions==4.12.2
29+
websockets==13.0
30+
websockets_proxy==0.1.2

0 commit comments

Comments
 (0)