mirror of
				https://gitea.invidious.io/iv-org/invidious-copy-2023-06-08.git
				synced 2024-08-15 00:53:38 +00:00 
			
		
		
		
	Add fix for videos without 'rvs'
This commit is contained in:
		
							parent
							
								
									f3fde38137
								
							
						
					
					
						commit
						16fb5023e0
					
				
					 2 changed files with 5 additions and 9 deletions
				
			
		|  | @ -257,11 +257,9 @@ get "/watch" do |env| | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   rvs = [] of Hash(String, String) |   rvs = [] of Hash(String, String) | ||||||
|   if video.info.has_key?("rvs") |   video.info["rvs"]?.try &.split(",").each do |rv| | ||||||
|     video.info["rvs"].split(",").each do |rv| |  | ||||||
|     rvs << HTTP::Params.parse(rv).to_h |     rvs << HTTP::Params.parse(rv).to_h | ||||||
|   end |   end | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   rating = video.info["avg_rating"].to_f64 |   rating = video.info["avg_rating"].to_f64 | ||||||
|   engagement = ((video.dislikes.to_f + video.likes.to_f)/video.views * 100) |   engagement = ((video.dislikes.to_f + video.likes.to_f)/video.views * 100) | ||||||
|  | @ -2007,7 +2005,7 @@ get "/api/v1/videos/:id" do |env| | ||||||
| 
 | 
 | ||||||
|       json.field "recommendedVideos" do |       json.field "recommendedVideos" do | ||||||
|         json.array do |         json.array do | ||||||
|           video.info["rvs"].split(",").each do |rv| |           video.info["rvs"]?.try &.split(",").each do |rv| | ||||||
|             rv = HTTP::Params.parse(rv) |             rv = HTTP::Params.parse(rv) | ||||||
| 
 | 
 | ||||||
|             if rv["id"]? |             if rv["id"]? | ||||||
|  |  | ||||||
|  | @ -24,11 +24,9 @@ def crawl_videos(db) | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     rvs = [] of Hash(String, String) |     rvs = [] of Hash(String, String) | ||||||
|     if video.info.has_key?("rvs") |     video.info["rvs"]?.try &.split(",").each do |rv| | ||||||
|       video.info["rvs"].split(",").each do |rv| |  | ||||||
|       rvs << HTTP::Params.parse(rv).to_h |       rvs << HTTP::Params.parse(rv).to_h | ||||||
|     end |     end | ||||||
|     end |  | ||||||
| 
 | 
 | ||||||
|     rvs.each do |rv| |     rvs.each do |rv| | ||||||
|       if rv.has_key?("id") && !db.query_one?("SELECT EXISTS (SELECT true FROM videos WHERE id = $1)", rv["id"], as: Bool) |       if rv.has_key?("id") && !db.query_one?("SELECT EXISTS (SELECT true FROM videos WHERE id = $1)", rv["id"], as: Bool) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue