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

Function anonymize_user_id

tools/user_hash.py:11–19  ·  view source on GitHub ↗

把原始用户 ID 转成匿名哈希,用于内容/评论记录的创作者分组, 不暴露真实身份。返回 sha256 截断 16 位的十六进制串。

(user_id)

Source from the content-addressed store, hash-verified

9
10
11def anonymize_user_id(user_id) -> str:
12 """把原始用户 ID 转成匿名哈希,用于内容/评论记录的创作者分组,
13 不暴露真实身份。返回 sha256 截断 16 位的十六进制串。"""
14 if user_id is None:
15 return ""
16 s = str(user_id).strip()
17 if not s:
18 return ""
19 return hashlib.sha256(s.encode("utf-8")).hexdigest()[:16]
20
21
22def mask_nickname(name) -> str:

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