MCPcopy
hub / github.com/elebumm/RedditVideoMakerBot / extract_id

Function extract_id

utils/id.py:7–14  ·  view source on GitHub ↗

This function takes a reddit object and returns the post id

(reddit_obj: dict, field: Optional[str] = "thread_id")

Source from the content-addressed store, hash-verified

5
6
7def extract_id(reddit_obj: dict, field: Optional[str] = "thread_id"):
8 """
9 This function takes a reddit object and returns the post id
10 """
11 if field not in reddit_obj.keys():
12 raise ValueError(f"Field '{field}' not found in reddit object")
13 reddit_id = re.sub(r"[^\w\s-]", "", reddit_obj[field])
14 return reddit_id

Callers 3

mainFunction · 0.90
imagemakerFunction · 0.90
make_final_videoFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected