Download find_pattern.py from popaqy/Choosino: direct link, hf CLI and curl.
- Browser
- Download file 437 Bytes
-
https://huggingface.co/spaces/popaqy/Choosino/resolve/main/find_pattern.py
- Command line
-
hf download hf://spaces/popaqy/Choosino/find_pattern.py
-
curl -L -o find_pattern.py https://huggingface.co/spaces/popaqy/Choosino/resolve/main/find_pattern.py
437 Bytes
| import re | |
| def extract_id(url): | |
| match = re.search("(?<=\/)[\d]+(?=[?])", url) | |
| if (match == None): | |
| return -1 | |
| else: | |
| id = match.group() | |
| return id | |
| def count_comments(html): | |
| matches = re.findall("\"date\"", html) | |
| return len(matches) | |
| def clear_comment(comment): | |
| replacement = ['\r', '\n', ','] | |
| for word in replacement: | |
| comment = comment.replace(word, "") | |
| return comment | |