mirror of
				https://github.com/searxng/searxng.git
				synced 2025-11-03 19:17:07 -05:00 
			
		
		
		
	[mod] odysee: time range support
This commit is contained in:
		
							parent
							
								
									b98907e91f
								
							
						
					
					
						commit
						09c61dabc9
					
				@ -21,6 +21,7 @@ about = {
 | 
			
		||||
 | 
			
		||||
# Engine configuration
 | 
			
		||||
paging = True
 | 
			
		||||
time_range_support = True
 | 
			
		||||
results_per_page = 20
 | 
			
		||||
categories = ['videos']
 | 
			
		||||
 | 
			
		||||
@ -29,6 +30,13 @@ base_url = "https://lighthouse.odysee.tv/search"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def request(query, params):
 | 
			
		||||
    time_range_dict = {
 | 
			
		||||
        "day": "today",
 | 
			
		||||
        "week": "thisweek",
 | 
			
		||||
        "month": "thismonth",
 | 
			
		||||
        "year": "thisyear",
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    start_index = (params["pageno"] - 1) * results_per_page
 | 
			
		||||
    query_params = {
 | 
			
		||||
        "s": query,
 | 
			
		||||
@ -38,6 +46,9 @@ def request(query, params):
 | 
			
		||||
        "mediaType": "video",
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if params['time_range'] in time_range_dict:
 | 
			
		||||
        query_params['time_filter'] = time_range_dict[params['time_range']]
 | 
			
		||||
 | 
			
		||||
    params["url"] = f"{base_url}?{urlencode(query_params)}"
 | 
			
		||||
    return params
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user