[common] add 'request_location()' convenience function

This commit is contained in:
Mike Fährmann
2025-04-18 22:43:26 +02:00
parent d6311bbf75
commit 88f1541a83
10 changed files with 29 additions and 64 deletions

View File

@@ -357,10 +357,9 @@ class RedditRedirectExtractor(Extractor):
sub_type = "user"
url = "https://www.reddit.com/{}/{}/s/{}".format(
sub_type, subreddit, share_url)
location = self.request_location(url, notfound="submission")
data = {"_extractor": RedditSubmissionExtractor}
response = self.request(url, method="HEAD", allow_redirects=False,
notfound="submission")
yield Message.Queue, response.headers["Location"], data
yield Message.Queue, location, data
class RedditAPI():