diff options
| author | Alexandre Flament <alex@al-f.net> | 2021-12-27 19:11:01 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-27 19:11:01 +0100 |
| commit | c6922ae7c5e53f695d5f5f8704b10b4e2815cda4 (patch) | |
| tree | 9c0456ad1a1d9d375311ccd8c9bd3eafd0779114 /searx/engines/invidious.py | |
| parent | 54bce130f9074c3d63009237b014c727a1443cc5 (diff) | |
| parent | d84226bf63757b1d4245ab26e9c081daf42389aa (diff) | |
Merge pull request #619 from dalf/apply-black
Apply black
Diffstat (limited to 'searx/engines/invidious.py')
| -rw-r--r-- | searx/engines/invidious.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/searx/engines/invidious.py b/searx/engines/invidious.py index 5d0b00edb..914615d6f 100644 --- a/searx/engines/invidious.py +++ b/searx/engines/invidious.py @@ -46,14 +46,10 @@ def request(query, params): base_url_rand = base_url search_url = base_url_rand + "api/v1/search?q={query}" - params["url"] = search_url.format( - query=quote_plus(query) - ) + "&page={pageno}".format(pageno=params["pageno"]) + params["url"] = search_url.format(query=quote_plus(query)) + "&page={pageno}".format(pageno=params["pageno"]) if params["time_range"] in time_range_dict: - params["url"] += "&date={timerange}".format( - timerange=time_range_dict[params["time_range"]] - ) + params["url"] += "&date={timerange}".format(timerange=time_range_dict[params["time_range"]]) if params["language"] != "all": lang = params["language"].split("-") @@ -88,17 +84,13 @@ def response(resp): url = base_invidious_url + videoid embedded = embedded_url.format(videoid=videoid) thumbs = result.get("videoThumbnails", []) - thumb = next( - (th for th in thumbs if th["quality"] == "sddefault"), None - ) + thumb = next((th for th in thumbs if th["quality"] == "sddefault"), None) if thumb: thumbnail = thumb.get("url", "") else: thumbnail = "" - publishedDate = parser.parse( - time.ctime(result.get("published", 0)) - ) + publishedDate = parser.parse(time.ctime(result.get("published", 0))) length = time.gmtime(result.get("lengthSeconds")) if length.tm_hour: length = time.strftime("%H:%M:%S", length) |