mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 15:23:00 +00:00 
			
		
		
		
	fix yt trending content language
This commit is contained in:
		| @@ -55,7 +55,7 @@ dependencies { | |||||||
|         exclude module: 'support-annotations' |         exclude module: 'support-annotations' | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     implementation 'com.github.TeamNewPipe:NewPipeExtractor:2d191c4ca' |     implementation 'com.github.TeamNewPipe:NewPipeExtractor:044b8fe32f47e28' | ||||||
|  |  | ||||||
|     testImplementation 'junit:junit:4.12' |     testImplementation 'junit:junit:4.12' | ||||||
|     testImplementation 'org.mockito:mockito-core:1.10.19' |     testImplementation 'org.mockito:mockito-core:1.10.19' | ||||||
|   | |||||||
| @@ -5,6 +5,7 @@ import android.preference.PreferenceManager; | |||||||
| import android.support.annotation.NonNull; | import android.support.annotation.NonNull; | ||||||
| import android.support.annotation.Nullable; | import android.support.annotation.Nullable; | ||||||
| import android.support.v7.app.ActionBar; | import android.support.v7.app.ActionBar; | ||||||
|  | import android.util.Log; | ||||||
| import android.view.LayoutInflater; | import android.view.LayoutInflater; | ||||||
| import android.view.Menu; | import android.view.Menu; | ||||||
| import android.view.MenuInflater; | import android.view.MenuInflater; | ||||||
| @@ -153,7 +154,11 @@ public class KioskFragment extends BaseListInfoFragment<KioskInfo> { | |||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public Single<ListExtractor.NextItemsResult> loadMoreItemsLogic() { |     public Single<ListExtractor.NextItemsResult> loadMoreItemsLogic() { | ||||||
|         return ExtractorHelper.getMoreKioskItems(serviceId, url, currentNextItemsUrl); |         String contentCountry = PreferenceManager | ||||||
|  |                 .getDefaultSharedPreferences(activity) | ||||||
|  |                 .getString(getString(R.string.search_language_key), | ||||||
|  |                         getString(R.string.default_language_value)); | ||||||
|  |         return ExtractorHelper.getMoreKioskItems(serviceId, url, currentNextItemsUrl, contentCountry); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /*////////////////////////////////////////////////////////////////////////// |     /*////////////////////////////////////////////////////////////////////////// | ||||||
|   | |||||||
| @@ -143,16 +143,16 @@ public final class ExtractorHelper { | |||||||
|         return checkCache(forceLoad, serviceId, url, Single.fromCallable(new Callable<KioskInfo>() { |         return checkCache(forceLoad, serviceId, url, Single.fromCallable(new Callable<KioskInfo>() { | ||||||
|             @Override |             @Override | ||||||
|             public KioskInfo call() throws Exception { |             public KioskInfo call() throws Exception { | ||||||
|                 return KioskInfo.getInfo(NewPipe.getService(serviceId), url, contentCountry); |                 return KioskInfo.getInfo(NewPipe.getService(serviceId), url, toUpperCase(contentCountry)); | ||||||
|             } |             } | ||||||
|         })); |         })); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public static Single<NextItemsResult> getMoreKioskItems(final int serviceId, final String url, final String nextStreamsUrl) { |     public static Single<NextItemsResult> getMoreKioskItems(final int serviceId, final String url, final String nextStreamsUrl, final String contentCountry) { | ||||||
|         return Single.fromCallable(new Callable<NextItemsResult>() { |         return Single.fromCallable(new Callable<NextItemsResult>() { | ||||||
|             @Override |             @Override | ||||||
|             public NextItemsResult call() throws Exception { |             public NextItemsResult call() throws Exception { | ||||||
|                 return KioskInfo.getMoreItems(NewPipe.getService(serviceId), url, nextStreamsUrl); |                 return KioskInfo.getMoreItems(NewPipe.getService(serviceId), url, nextStreamsUrl, toUpperCase(contentCountry)); | ||||||
|             } |             } | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
| @@ -267,4 +267,17 @@ public final class ExtractorHelper { | |||||||
|     public static boolean isInterruptedCaused(Throwable throwable) { |     public static boolean isInterruptedCaused(Throwable throwable) { | ||||||
|         return ExtractorHelper.hasExactCauseThrowable(throwable, InterruptedIOException.class, InterruptedException.class); |         return ExtractorHelper.hasExactCauseThrowable(throwable, InterruptedIOException.class, InterruptedException.class); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     public static String toUpperCase(String value) { | ||||||
|  |         StringBuilder sb = new StringBuilder(value); | ||||||
|  |         for (int index = 0; index < sb.length(); index++) { | ||||||
|  |             char c = sb.charAt(index); | ||||||
|  |             if (Character.isLowerCase(c)) { | ||||||
|  |                 sb.setCharAt(index, Character.toUpperCase(c)); | ||||||
|  |             } else { | ||||||
|  |                 sb.setCharAt(index, Character.toLowerCase(c)); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return sb.toString(); | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Schabi
					Schabi