1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 02:32:33 +01:00

[twitter] add 'hashtag' extractor (#3783)

This commit is contained in:
Mike Fährmann 2023-03-22 22:20:40 +01:00
parent 082d55de16
commit 197882cf12
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 16 additions and 1 deletions

View File

@ -868,7 +868,7 @@ Consider all sites to be NSFW unless otherwise known.
<tr>
<td>Twitter</td>
<td>https://twitter.com/</td>
<td>Avatars, Backgrounds, Bookmarks, Events, individual Images, Likes, Lists, List Members, Media Timelines, Search Results, Timelines, Tweets</td>
<td>Avatars, Backgrounds, Bookmarks, Events, Hashtags, individual Images, Likes, Lists, List Members, Media Timelines, Search Results, Timelines, Tweets</td>
<td>Supported</td>
</tr>
<tr>

View File

@ -649,6 +649,21 @@ class TwitterSearchExtractor(TwitterExtractor):
return self.api.search_adaptive(query)
class TwitterHashtagExtractor(TwitterExtractor):
"""Extractor for Twitter hashtags"""
subcategory = "hashtag"
pattern = BASE_PATTERN + r"/hashtag/([^/?#]+)"
test = ("https://twitter.com/hashtag/nature", {
"pattern": TwitterSearchExtractor.pattern,
"url": "3571c3a53b7647ea35517041fdc17f77ec5b2cb9",
})
def items(self):
url = "{}/search?q=%23{}".format(self.root, self.user)
data = {"_extractor": TwitterSearchExtractor}
yield Message.Queue, url, data
class TwitterEventExtractor(TwitterExtractor):
"""Extractor for Tweets from a Twitter Event"""
subcategory = "event"