mirror of
				https://github.com/iv-org/invidious.git
				synced 2025-11-03 22:21:55 +00:00 
			
		
		
		
	integrate legacy yt xml subscription import with new json sub import
This commit is contained in:
		@@ -760,10 +760,16 @@ post "/data_control" do |env|
 | 
				
			|||||||
          end
 | 
					          end
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
      when "import_youtube"
 | 
					      when "import_youtube"
 | 
				
			||||||
        subscriptions = JSON.parse(body)
 | 
					        if body[0..4] == "<opml" 
 | 
				
			||||||
 | 
					          subscriptions = XML.parse(body)
 | 
				
			||||||
        user.subscriptions += subscriptions.as_a.compact_map do |entry|
 | 
					          user.subscriptions += subscriptions.xpath_nodes(%q(//outline[@type="rss"])).map do |channel|
 | 
				
			||||||
          entry["snippet"]["resourceId"]["channelId"].as_s
 | 
					            channel["xmlUrl"].match(/UC[a-zA-Z0-9_-]{22}/).not_nil![0]
 | 
				
			||||||
 | 
					          end
 | 
				
			||||||
 | 
					        else
 | 
				
			||||||
 | 
					          subscriptions = JSON.parse(body)
 | 
				
			||||||
 | 
					          user.subscriptions += subscriptions.as_a.compact_map do |entry|
 | 
				
			||||||
 | 
					            entry["snippet"]["resourceId"]["channelId"].as_s
 | 
				
			||||||
 | 
					        end
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
        user.subscriptions.uniq!
 | 
					        user.subscriptions.uniq!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user