Skip to content

Commit 049a156

Browse files
committed
Strip IRC formatting from message before extracting URLs from it
1 parent af9aae9 commit 049a156

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ircurltitlebot/bot.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from typing import Dict, List, NoReturn, Optional, Tuple
1212
from urllib.parse import urlparse
1313

14+
import ircstyle
1415
import miniirc
1516
import urlextract
1617

@@ -223,6 +224,7 @@ def _handle_privmsg(irc: miniirc.IRC, hostmask: Tuple[str, str, str], args: List
223224
return
224225

225226
# Extract URLs
227+
msg = ircstyle.unstyle(msg)
226228
# words = [word for word in msg.split() if not word.isalnum()] # Filter out several non-URL words.
227229
try:
228230
urls = url_extractor.find_urls(msg, only_unique=False) # Assumes returned URLs have same order as in message.

0 commit comments

Comments
 (0)