diff --git a/doc/changelog.md b/doc/changelog.md index 7e8a43f2..4898eb3e 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -2,6 +2,10 @@ ## changes in this version +* Fixed error when displaying an URL at the end of a line, when the tweet or direct message contained multiple lines. Now the URL should be displayed correctly. ((#305,)[https://github.com/manuelcortez/TWBlue/issues/305]) + +## Changes in version 0.95 + * TWBlue can open a Tweet or user directly in Twitter. There is a new option in the context menu for people and tweet buffers, and also, the shortcut control+win+alt+Enter will open the focused item in Twitter. * Some keystrokes were remapped in the Windows 10 Keymap: * Read location of a tweet: Ctrl+Win+G. ([#177](https://github.com/manuelcortez/TWBlue/pull/177)) diff --git a/src/sessions/twitter/utils.py b/src/sessions/twitter/utils.py index 51629c10..2a5b360b 100644 --- a/src/sessions/twitter/utils.py +++ b/src/sessions/twitter/utils.py @@ -19,11 +19,11 @@ __doc__ = "Find urls in tweets and #audio hashtag." url_re = re.compile(r"(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'\".,<>?«»“”‘’]))") -url_re2 = re.compile("(?:\w+://|www\.)[^ ,.?!#%=+][^ ]*") -bad_chars = '\'\\.,[](){}:;"' +url_re2 = re.compile("(?:\w+://|www\.)[^ ,.?!#%=+][^ \\n\\t]*") +bad_chars = '\'\\\n.,[](){}:;"' def find_urls_in_text(text): - return [s.strip(bad_chars) for s in url_re2.findall(text)] + return url_re2.findall(text) def find_urls (tweet): urls = []