make a little more compact
This commit is contained in:
		| @@ -7,19 +7,14 @@ local options = { | |||||||
| 	server = "https://sponsor.ajay.app/api/skipSegments", | 	server = "https://sponsor.ajay.app/api/skipSegments", | ||||||
|  |  | ||||||
| 	-- Categories to fetch and skip | 	-- Categories to fetch and skip | ||||||
| 	categories = [["sponsor","intro","outro","interaction","selfpromo"]] | 	categories = '"sponsor","intro","outro","interaction","selfpromo"' | ||||||
| } | } | ||||||
|  |  | ||||||
| function getranges() | function getranges() | ||||||
| 	local res |  | ||||||
| 	local luacurl_available, cURL = pcall(require,'cURL') | 	local luacurl_available, cURL = pcall(require,'cURL') | ||||||
|  |  | ||||||
| 	local args = { | 	local args = ("categories=[%s]&videoID=%s"):format(options.categories, youtube_id) | ||||||
| 		([=[categories=[%s]]=]):format(options.categories), | 	local API = ("%s?%s"):format(options.server, args) | ||||||
| 		([=[videoID=%s]=]):format(youtube_id), |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	local API = ("%s?%s"):format(options.server,table.concat(args,"&")) |  | ||||||
|  |  | ||||||
| 	if not(luacurl_available) then -- if Lua-cURL is not available on this system | 	if not(luacurl_available) then -- if Lua-cURL is not available on this system | ||||||
| 		local API = API:gsub("%[", "\\["):gsub("]", "\\]") | 		local API = API:gsub("%[", "\\["):gsub("]", "\\]") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user