mirror of
				https://github.com/iv-org/invidious.git
				synced 2025-11-03 22:21:55 +00:00 
			
		
		
		
	API: Fix URL for vtt subtitles (#4221)
For 'fmt=vtt' to work, the 'fmt' parameter needs to be replaced in the original caption api URL. No associated open issue
This commit is contained in:
		@@ -141,7 +141,11 @@ module Invidious::Routes::API::V1::Videos
 | 
			
		||||
          end
 | 
			
		||||
        end
 | 
			
		||||
      else
 | 
			
		||||
        webvtt = YT_POOL.client &.get("#{url}&fmt=vtt").body
 | 
			
		||||
        uri = URI.parse(url)
 | 
			
		||||
        query_params = uri.query_params
 | 
			
		||||
        query_params["fmt"] = "vtt"
 | 
			
		||||
        uri.query_params = query_params
 | 
			
		||||
        webvtt = YT_POOL.client &.get(uri.request_target).body
 | 
			
		||||
 | 
			
		||||
        if webvtt.starts_with?("<?xml")
 | 
			
		||||
          webvtt = caption.timedtext_to_vtt(webvtt)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user