diff --git a/boards/models/source.py b/boards/models/source.py --- a/boards/models/source.py +++ b/boards/models/source.py @@ -9,6 +9,7 @@ from django.db import models, transactio from django.utils.dateparse import parse_datetime from django.utils.timezone import utc from django.utils import timezone +from django.utils.html import strip_tags from boards.models import Post from boards.models.post import TITLE_MAX_LENGTH @@ -64,7 +65,7 @@ class ThreadSource(models.Model): if timestamp > last_timestamp: last_timestamp = timestamp if timestamp > start_timestamp: - Post.objects.create_post(title=title, text=item.description, + Post.objects.create_post(title=title, text=self.parse_text(item.description), thread=self.thread, file_urls=[item.link], tripcode=tripcode) logger.info('Fetched item {} from {} into thread {}'.format( title, self.name, self.thread)) @@ -72,3 +73,5 @@ class ThreadSource(models.Model): self.timestamp = last_timestamp self.save(update_fields=['timestamp']) + def parse_text(self, text): + return strip_tags(text)