-
Notifications
You must be signed in to change notification settings - Fork 0
/
CommentGenerator.py
42 lines (35 loc) · 1.66 KB
/
CommentGenerator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import random
def getauthor(url):
print(url)
while "by-" in url:
url = url[url.index("by-")+3:]
# url = url[:url.index("?")]
authorlist = url.split('-')
temporaryauthorlist=[]
for name in authorlist:
if "%" not in name and "null" not in name:
temporaryauthorlist.append(name)
author = " ".join(temporaryauthorlist)
print(author)
return author.capitalize()
def getcomment(topic, author):
first_part_comment = ["Awesome ", "Amazing ", "Excellent ", "Stunning ", "Cool ", "Lovely ", "Wonderful ",
"Superb ", "Spectacular ", "Great ", "Fantastic ", "Nice ", "Impressive ", "Fabulous ",
"Splendid ", "Captivating ", "Formidable ", "Enchanting "]
special_first_part = ["What a ", "Love this ", "Daaaamn, ", "", "", "", "", "", "", "", "", "", ""]
second_part_comment = ["image", "photo", "shot", "work", "picture", "frame", "snapshot", "composition", "capture",
"scene"]
third_part_comment = [" Congrats!", " Congratulations!", " Good job!", " Well taken!", "", "", "", "", "", "", "",
"", ""]
comment = random.choice(special_first_part)
if comment == "":
comment += random.choice(first_part_comment)
comment += random.choice(second_part_comment)
else:
comment += random.choice(first_part_comment).lower()
comment += random.choice(second_part_comment)
if author == "":
return comment + "!" + random.choice(third_part_comment)
else:
comment += (", " + author.split(" ")[0] + "!" + random.choice(third_part_comment))
return comment