You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
767 B

from datetime import datetime
import re
streaming_urls = ["^https://www.youtube.com", "^https://player.odycdn.com", "^https://youtu.be"]
def timestampToDate(ts):
return datetime.fromtimestamp(int(ts)/1000000).strftime("%y-%m-%d %H:%M")
def checkStreamingVideo(link):
for pattern in streaming_urls:
if re.search(pattern, link) is not None:
return True
return False
def checkReddit(link):
return re.search("^https://www.reddit.com", link) is not None
def checkRedditComments(links):
for link in links:
if re.search("^https://www.reddit.com/[a-zA-Z1-9/]+/comments", link) is not None:
return link
return False
def writeLog(text):
with open("debug.log", "a") as f:
f.write(str(text))