[twitter] support '/intent/user?user_id=…' URLs (#980)
This commit is contained in:
@@ -245,7 +245,8 @@ class TwitterExtractor(Extractor):
|
|||||||
class TwitterTimelineExtractor(TwitterExtractor):
|
class TwitterTimelineExtractor(TwitterExtractor):
|
||||||
"""Extractor for all images from a user's timeline"""
|
"""Extractor for all images from a user's timeline"""
|
||||||
subcategory = "timeline"
|
subcategory = "timeline"
|
||||||
pattern = BASE_PATTERN + r"/(?!search)([^/?&#]+)/?(?:$|[?#])"
|
pattern = BASE_PATTERN + \
|
||||||
|
r"/(?!search)(?:([^/?&#]+)/?(?:$|[?#])|intent/user\?user_id=(\d+))"
|
||||||
test = (
|
test = (
|
||||||
("https://twitter.com/supernaturepics", {
|
("https://twitter.com/supernaturepics", {
|
||||||
"range": "1-40",
|
"range": "1-40",
|
||||||
@@ -253,8 +254,15 @@ class TwitterTimelineExtractor(TwitterExtractor):
|
|||||||
}),
|
}),
|
||||||
("https://mobile.twitter.com/supernaturepics?p=i"),
|
("https://mobile.twitter.com/supernaturepics?p=i"),
|
||||||
("https://www.twitter.com/id:2976459548"),
|
("https://www.twitter.com/id:2976459548"),
|
||||||
|
("https://twitter.com/intent/user?user_id=2976459548"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def __init__(self, match):
|
||||||
|
TwitterExtractor.__init__(self, match)
|
||||||
|
uid = match.group(2)
|
||||||
|
if uid:
|
||||||
|
self.user = "id:" + uid
|
||||||
|
|
||||||
def tweets(self):
|
def tweets(self):
|
||||||
return TwitterAPI(self).timeline_profile(self.user)
|
return TwitterAPI(self).timeline_profile(self.user)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user