mirror of
https://github.com/searxng/searxng.git
synced 2024-11-26 04:41:00 +00:00
[fix] follow-up of 4da7003ae
/ add missing review from @Bnyro
[1] https://github.com/searxng/searxng/pull/2656#pullrequestreview-1607956209 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
4da7003ae0
commit
4f8895c6de
1 changed files with 5 additions and 7 deletions
|
@ -6,6 +6,7 @@
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
from urllib.parse import urlencode
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
# Engine metadata
|
# Engine metadata
|
||||||
|
@ -21,16 +22,14 @@ about = {
|
||||||
# Engine configuration
|
# Engine configuration
|
||||||
paging = True
|
paging = True
|
||||||
results_per_page = 20
|
results_per_page = 20
|
||||||
categories = ['images']
|
categories = ['videos']
|
||||||
|
|
||||||
# Search URL (Note: lighthouse.lbry.com/search works too, and may be faster at times)
|
# Search URL (Note: lighthouse.lbry.com/search works too, and may be faster at times)
|
||||||
base_url = "https://lighthouse.odysee.tv/search"
|
base_url = "https://lighthouse.odysee.tv/search"
|
||||||
|
|
||||||
# Request function
|
|
||||||
def request(query, params):
|
|
||||||
page = params.get("pageno", 1) - 1
|
|
||||||
start_index = page * results_per_page
|
|
||||||
|
|
||||||
|
def request(query, params):
|
||||||
|
start_index = (params["pageno"] - 1) * results_per_page
|
||||||
query_params = {
|
query_params = {
|
||||||
"s": query,
|
"s": query,
|
||||||
"size": results_per_page,
|
"size": results_per_page,
|
||||||
|
@ -39,8 +38,7 @@ def request(query, params):
|
||||||
"mediaType": "video",
|
"mediaType": "video",
|
||||||
}
|
}
|
||||||
|
|
||||||
query_str = "&".join([f"{key}={value}" for key, value in query_params.items()])
|
params["url"] = f"{base_url}?{urlencode(query_params)}"
|
||||||
params["url"] = f"{base_url}?{query_str}"
|
|
||||||
return params
|
return params
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue