mirror of
				https://gitea.invidious.io/iv-org/invidious-copy-2023-06-08.git
				synced 2024-08-15 00:53:38 +00:00 
			
		
		
		
	Add support for abbreviated sub count in search
This commit is contained in:
		
							parent
							
								
									7002a316fd
								
							
						
					
					
						commit
						34c43b8349
					
				
					 1 changed files with 6 additions and 1 deletions
				
			
		| 
						 | 
					@ -415,7 +415,12 @@ def extract_items(nodeset, ucid = nil, author_name = nil)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      author_thumbnail ||= ""
 | 
					      author_thumbnail ||= ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      subscriber_count = node.xpath_node(%q(.//span[contains(@class, "yt-subscriber-count")])).try &.["title"].gsub(/\D/, "").to_i?
 | 
					      subscriber_count_text = node.xpath_node(%q(.//span[contains(@class, "yt-subscriber-count")])).try &.["title"]
 | 
				
			||||||
 | 
					      begin
 | 
				
			||||||
 | 
					        subscriber_count = subscriber_count_text.try { |text| short_text_to_number(text) }
 | 
				
			||||||
 | 
					      rescue ex
 | 
				
			||||||
 | 
					        subscriber_count = subscriber_count_text.try &.gsub(/\D/, "").to_i?
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
      subscriber_count ||= 0
 | 
					      subscriber_count ||= 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      video_count = node.xpath_node(%q(.//ul[@class="yt-lockup-meta-info"]/li)).try &.content.split(" ")[0].gsub(/\D/, "").to_i?
 | 
					      video_count = node.xpath_node(%q(.//ul[@class="yt-lockup-meta-info"]/li)).try &.content.split(" ")[0].gsub(/\D/, "").to_i?
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue