def clean_video(video):
text = []
try:
if len(video.description) > 0:
sentence_tokens = sent_tokenize(video.description)
for sentence in sentence_tokens:
if not ('http' in sentence):
text.append("{0} ".format(sentence))
video.description = "".join("{} ".format(s) for s in text)
video.save()
if settings.SHOW_DEBUG:
print(colored.green("Cleaned video description saved to db: {0}".format(video.title)))
except Exception as e:
print(colored.red("At clean_video {}".format(e)))
评论列表
文章目录