@@ -19,7 +19,10 @@ def __init__(self, config: TCNConfig, twitch: Twitch):
19
19
self .blacklisted_channelnames = self .config .blacklisted_channelnames
20
20
21
21
async def init_primary_user (self , username : str , users : dict ):
22
- primary_user = await self .get_user_by_name (username )
22
+ if username .strip () in self .blacklisted_channelnames :
23
+ return
24
+
25
+ primary_user = await self .get_user_by_name (username .strip ())
23
26
if not primary_user :
24
27
return
25
28
@@ -60,9 +63,9 @@ async def find_connections_from_videos(self, videos: list[Video],
60
63
if user .size >= self .config .max_children :
61
64
user .color = 'red'
62
65
break
63
- if names := re .findall ('(@\w+)' , v .title ):
66
+ if names := re .findall (r '(@\w+)' , v .title ):
64
67
for name in names :
65
- n = name .replace ("@" , "" ).lower ()
68
+ n = name .replace ("@" , "" ).lower (). strip ()
66
69
if not (4 <= len (n ) <= 25 ) or n in self .blacklisted_channelnames :
67
70
continue
68
71
if n not in users :
@@ -72,7 +75,7 @@ async def find_connections_from_videos(self, videos: list[Video],
72
75
user .add_child (child )
73
76
child .add_child (user ) # Bidirectional enforcement
74
77
users [child .name ] = child
75
- elif n not in [x .name for x in user .children ]:
78
+ elif n not in [x .name . strip () for x in user .children ]:
76
79
user .add_child (users [n ])
77
80
if user not in users [n ].children : # Bidirectional enforcement
78
81
users [n ].add_child (user ) # Bidirectional enforcement
0 commit comments