[twitter] fix pattern for single tweet (#5371)

- Add optional slash
- Update tests to include some non-standard tweet URLs
This commit is contained in:
fireattack
2024-03-25 11:45:04 +08:00
committed by Mike Fährmann
parent c3bafd6a2b
commit 423599ce95
2 changed files with 3 additions and 3 deletions

View File

@@ -736,7 +736,7 @@ class TwitterEventExtractor(TwitterExtractor):
class TwitterTweetExtractor(TwitterExtractor):
"""Extractor for individual tweets"""
subcategory = "tweet"
pattern = BASE_PATTERN + r"/([^/?#]+|i/web)/status/(\d+)/?$"
pattern = BASE_PATTERN + r"/([^/?#]+|i/web)/status/(\d+)/?(?:$|[?#])"
example = "https://twitter.com/USER/status/12345"
def __init__(self, match):