MCPcopy Create free account
hub / github.com/NanmiCoder/MediaCrawler / mask_nickname

Function mask_nickname

tools/user_hash.py:22–36  ·  view source on GitHub ↗

昵称中间脱敏:首尾各保留 1 字,中间替换为星号。 - 长度 <= 1:返回 "*" - 长度 == 2:首字 + "*" - 长度 >= 3:首字 + "***" + 尾字 这样既保留教学分析所需的内容归属语义,又无法据昵称定位到真人。

(name)

Source from the content-addressed store, hash-verified

20
21
22def mask_nickname(name) -> str:
23 """昵称中间脱敏:首尾各保留 1 字,中间替换为星号。
24 - 长度 <= 1:返回 "*"
25 - 长度 == 2:首字 + "*"
26 - 长度 >= 3:首字 + "***" + 尾字
27 这样既保留教学分析所需的内容归属语义,又无法据昵称定位到真人。
28 """
29 if name is None:
30 return ""
31 s = str(name)
32 if len(s) <= 1:
33 return "*"
34 if len(s) == 2:
35 return s[0] + "*"
36 return s[0] + "***" + s[-1]

Callers 15

update_bilibili_videoFunction · 0.90
update_weibo_noteFunction · 0.90
update_kuaishou_videoFunction · 0.90
update_ks_video_commentFunction · 0.90
update_xhs_noteFunction · 0.90
update_xhs_note_commentFunction · 0.90
update_douyin_awemeFunction · 0.90
update_dy_aweme_commentFunction · 0.90

Calls

no outgoing calls