Skip to content

Commit

Permalink
ignore Apertium URLs (closes apertium#599)
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-martian committed Jun 30, 2022
1 parent 77f302b commit 45e9df8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/head.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
from modules import wikipedia
from modules import wiktionary

APERTIUM_URLS = [
r'.*\bapertium\.(org|com)(/.*)?',
r'.*\bapertium\.projectjj\.com(/.*)?',
r'.*\bgithub\.com/apertium(/.*)?'
]

# seconds until a URL title will be repeated if said multiple times
TITLE_MAX_REPEAT_TIME = 300
Expand Down Expand Up @@ -109,6 +114,10 @@ def snarfuri(phenny, input):
if nowtime - oldtime < TITLE_MAX_REPEAT_TIME:
return

for pat in APERTIUM_URLS:
if re.match(pat, uri):
return

phenny.recent_titles[uri] = nowtime

title = gettitle(phenny, input, uri)
Expand Down

0 comments on commit 45e9df8

Please sign in to comment.