File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -7,9 +7,11 @@ throttle: 10
77# Default value: 5
88wait_time : 30
99
10- # URLs matching this regular expression will not be tweeted
10+ # URLs matching these regular expressions will not be tweeted
1111# Used e.g. for Wiley journals that republish old content with new URLs
12- blacklist : " pericles.pericles-prod.literatumonline.com"
12+ blacklist :
13+ - " pericles.pericles-prod.literatumonline.com"
14+ - " www.onlinelibrary.wiley.com"
1315
1416# Whether to include journal Twitter handles. Not recommended: can lead
1517# to the bot being banned for "large numbers of unsolicited mentions".
Original file line number Diff line number Diff line change @@ -220,9 +220,9 @@ def __init__(self, doTweet=True):
220220 config = {}
221221 self .throttle = config .get ("throttle" , 0 )
222222 self .wait_time = config .get ("wait_time" , 5 )
223- self .blacklist = config .get ("blacklist" , "" ).strip ()
224- self .blacklist = re .compile (self .blacklist ) if self .blacklist else None
225223 self .handles = config .get ("handles" , True )
224+ self .blacklist = config .get ("blacklist" , [])
225+ self .blacklist = [re .compile (s ) for s in self .blacklist ]
226226
227227 # Connect to Twitter, unless requested not to
228228 if doTweet :
@@ -267,10 +267,11 @@ def sendTweet(self, entry):
267267 tweet_body = title [:length ] + " " + url
268268
269269 # Some URLs may match our blacklist
270- if self .blacklist and self .blacklist .search (url ):
271- print (f"BLACKLISTED: { tweet_body } \n " )
272- self .addToPosted (entry .id )
273- return
270+ for regexp in self .blacklist :
271+ if regexp .search (url ):
272+ print (f"BLACKLISTED: { tweet_body } \n " )
273+ self .addToPosted (entry .id )
274+ return
274275
275276 media = None
276277 image = findImage (entry )
You can’t perform that action at this time.
0 commit comments