[unsplash] replace dash with space in search API queries (#2429)

This commit is contained in:
chinggg
2022-03-19 23:00:05 +08:00
committed by GitHub
parent f8230dde43
commit 6f1d5e8ab9

View File

@@ -193,7 +193,7 @@ class UnsplashSearchExtractor(UnsplashExtractor):
"""Extractor for unsplash search results"""
subcategory = "search"
pattern = BASE_PATTERN + r"/s/photos/([^/?#]+)(?:\?([^/?#]+))?"
test = ("https://unsplash.com/s/photos/nature", {
test = ("https://unsplash.com/s/photos/hair-style", {
"pattern": r"https://images\.unsplash\.com/((flagged/)?photo-\d+-\w+"
r"|reserve/[^/?#]+)\?ixid=\w+&ixlib=rb-1\.2\.1$",
"range": "1-30",
@@ -206,7 +206,7 @@ class UnsplashSearchExtractor(UnsplashExtractor):
def photos(self):
url = self.root + "/napi/search/photos"
params = {"query": text.unquote(self.item)}
params = {"query": text.unquote(self.item.replace('-', ' '))}
if self.query:
params.update(text.parse_query(self.query))
return self._pagination(url, params, True)