mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-11-04 09:13:00 +00:00 
			
		
		
		
	fixed some more bugs
This commit is contained in:
		@@ -151,6 +151,8 @@ public class VideoItemListFragment extends ListFragment {
 | 
				
			|||||||
                        /* todo: this shoudl not be assigned static */ "Youtube", query, R.string.general_error));
 | 
					                        /* todo: this shoudl not be assigned static */ "Youtube", query, R.string.general_error));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                e.printStackTrace();
 | 
					                e.printStackTrace();
 | 
				
			||||||
 | 
					            } finally {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,7 +31,12 @@ public class SearchResult {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        SearchResult result = engine.search(query, page, languageCode, dl).getSearchResult();
 | 
					        SearchResult result = engine.search(query, page, languageCode, dl).getSearchResult();
 | 
				
			||||||
        if(result.resultList.isEmpty()) {
 | 
					        if(result.resultList.isEmpty()) {
 | 
				
			||||||
            throw new ExtractionException("Empty result despite no error");
 | 
					            if(result.suggestion.isEmpty()) {
 | 
				
			||||||
 | 
					                throw new ExtractionException("Empty result despite no error");
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                // This is used as a fallback. Do not relay on it !!!
 | 
				
			||||||
 | 
					                throw new SearchEngine.NothingFoundException(result.suggestion);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return result;
 | 
					        return result;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -96,6 +96,9 @@ public class YoutubeSearchEngine implements SearchEngine {
 | 
				
			|||||||
            // both types of spell correction item
 | 
					            // both types of spell correction item
 | 
				
			||||||
            if (!((el = item.select("div[class*=\"spell-correction\"]").first()) == null)) {
 | 
					            if (!((el = item.select("div[class*=\"spell-correction\"]").first()) == null)) {
 | 
				
			||||||
                collector.setSuggestion(el.select("a").first().text());
 | 
					                collector.setSuggestion(el.select("a").first().text());
 | 
				
			||||||
 | 
					                if(list.children().size() == 1) {
 | 
				
			||||||
 | 
					                    throw new NothingFoundException("Did you mean: " + el.select("a").first().text());
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                // search message item
 | 
					                // search message item
 | 
				
			||||||
            } else if (!((el = item.select("div[class*=\"search-message\"]").first()) == null)) {
 | 
					            } else if (!((el = item.select("div[class*=\"search-message\"]").first()) == null)) {
 | 
				
			||||||
                //result.errorMessage = el.text();
 | 
					                //result.errorMessage = el.text();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user