···
9
+
# https://en.wikipedia.org/wiki/Seven_dirty_words
SDW_REGEX = re.compile(r'^(shit|piss|fuck|cunt|cocksucker|motherfucker|tits)[!,./;?~ ]*$', re.I|re.A)
class SevenDirtyWordsFeed(BaseFeed):
···
38
-
if record.get('reply') is not None:
40
+
record.get('reply') is None,
41
+
record.get('embed') is None,
42
+
record.get('facets') is None,
43
+
SDW_REGEX.search(record['text']) is not None,
41
-
# https://en.wikipedia.org/wiki/Seven_dirty_words
42
-
if SDW_REGEX.search(record['text']) is not None:
43
-
repo = commit['did']
44
-
rkey = commit['rkey']
45
-
post_uri = f'at://{repo}/app.bsky.feed.post/{rkey}'
46
-
ts = self.safe_timestamp(record.get('createdAt')).timestamp()
47
-
self.transaction_begin(self.db_cnx)
48
-
self.db_cnx.execute(
49
-
'insert into posts (uri, create_ts) values (:uri, :ts)',
50
-
dict(uri=post_uri, ts=ts)
49
+
repo = commit['did']
50
+
rkey = commit['rkey']
51
+
post_uri = f'at://{repo}/app.bsky.feed.post/{rkey}'
52
+
ts = self.safe_timestamp(record.get('createdAt')).timestamp()
53
+
self.transaction_begin(self.db_cnx)
54
+
self.db_cnx.execute(
55
+
'insert into posts (uri, create_ts) values (:uri, :ts)',
56
+
dict(uri=post_uri, ts=ts)
def commit_changes(self):
self.logger.debug('committing changes')