[unsplash] replace dash with space in search API queries (#2429)
This commit is contained in:
@@ -193,7 +193,7 @@ class UnsplashSearchExtractor(UnsplashExtractor):
|
|||||||
"""Extractor for unsplash search results"""
|
"""Extractor for unsplash search results"""
|
||||||
subcategory = "search"
|
subcategory = "search"
|
||||||
pattern = BASE_PATTERN + r"/s/photos/([^/?#]+)(?:\?([^/?#]+))?"
|
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+"
|
"pattern": r"https://images\.unsplash\.com/((flagged/)?photo-\d+-\w+"
|
||||||
r"|reserve/[^/?#]+)\?ixid=\w+&ixlib=rb-1\.2\.1$",
|
r"|reserve/[^/?#]+)\?ixid=\w+&ixlib=rb-1\.2\.1$",
|
||||||
"range": "1-30",
|
"range": "1-30",
|
||||||
@@ -206,7 +206,7 @@ class UnsplashSearchExtractor(UnsplashExtractor):
|
|||||||
|
|
||||||
def photos(self):
|
def photos(self):
|
||||||
url = self.root + "/napi/search/photos"
|
url = self.root + "/napi/search/photos"
|
||||||
params = {"query": text.unquote(self.item)}
|
params = {"query": text.unquote(self.item.replace('-', ' '))}
|
||||||
if self.query:
|
if self.query:
|
||||||
params.update(text.parse_query(self.query))
|
params.update(text.parse_query(self.query))
|
||||||
return self._pagination(url, params, True)
|
return self._pagination(url, params, True)
|
||||||
|
|||||||
Reference in New Issue
Block a user