Refactoring xml serialization.

This commit is contained in:
Samuel Clay 2022-07-02 13:09:37 -04:00
parent 80a1d57944
commit b26817ba77

View file

@ -382,9 +382,6 @@ class TwitterFetcher:
tweet_title = user_tweet['full_text']
tweet_text = linebreaks(content_tweet['full_text'])
# Remove unserializable control characters
tweet_text = re.sub(r'[\x00-\x08\x0B-\x0C\x0E-\x1F]', '', tweet_text)
replaced = {}
entities_media = content_tweet['entities'].get('media', [])
@ -472,6 +469,9 @@ class TwitterFetcher:
("<b>%s</b> %s" % (content_tweet['retweet_count'], "retweet" if content_tweet['retweet_count'] == 1 else "retweets")) if content_tweet['retweet_count'] else "",
)
# Remove unserializable control characters
content = re.sub(r'[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFDD0-\uFDEF\uFFFE\uFFFF]', '', content)
story = {
'title': tweet_title,
'link': "https://twitter.com/%s/status/%s" % (original_author_screen_name, user_tweet['id']),