Choosino / find_pattern.py
popaqy's picture
Add files
4a6f287
Raw History Blame Contribute Delete
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