diff --git a/app/src/main/java/com/deniscerri/ytdl/ui/more/settings/advanced/generateyoutubepotokens/GenerateYoutubePoTokensFragment.kt b/app/src/main/java/com/deniscerri/ytdl/ui/more/settings/advanced/generateyoutubepotokens/GenerateYoutubePoTokensFragment.kt index 63105192..43e6feba 100644 --- a/app/src/main/java/com/deniscerri/ytdl/ui/more/settings/advanced/generateyoutubepotokens/GenerateYoutubePoTokensFragment.kt +++ b/app/src/main/java/com/deniscerri/ytdl/ui/more/settings/advanced/generateyoutubepotokens/GenerateYoutubePoTokensFragment.kt @@ -202,25 +202,9 @@ class GenerateYoutubePoTokensFragment : Fragment() { val dialog = MaterialAlertDialogBuilder(requireContext()) dialog.setTitle(getString(R.string.generate_potokens)) - val text = """ - Auth - ----------------------- - 1. Click 'Auth' to open the sign in page in WebView. - 2. Sign in to your Google Account. - 3. Play any video that supports auto-translated subtitles. - 4. Turn on auto-translated subtitles and see if it works. - 4.1 If auto-translated subtitles don't work, switch to another video that supports auto-translated subtitles and try step 4 again. - 5. Click OK. - - No Auth - ----------------------- - 1. Click 'No Auth'. - 2. Write any youtube video url - 3. Wait for the video to load and play the video for at least 3 seconds. - 3. Click OK. - """.trimIndent() + val text = getString(R.string.potoken_guide) dialog.setMessage(text) - dialog.setNegativeButton("No Auth") { dialogInterface: DialogInterface, _: Int -> + dialog.setNegativeButton(getString(R.string.no_auth)) { dialogInterface: DialogInterface, _: Int -> val layout = BottomSheetDialog(requireContext()) layout.requestWindowFeature(Window.FEATURE_NO_TITLE) @@ -260,7 +244,7 @@ class GenerateYoutubePoTokensFragment : Fragment() { ) } - dialog.setPositiveButton("Auth") { dialogInterface: DialogInterface, _: Int -> + dialog.setPositiveButton(getString(R.string.auth)) { dialogInterface: DialogInterface, _: Int -> val intent = Intent(requireContext(), PoTokenWebViewLoginActivity::class.java) intent.putExtra("url", "https://www.youtube.com/account") webPoTokenResultLauncher.launch(intent) diff --git a/app/src/main/java/com/deniscerri/ytdl/util/extractors/newpipe/NewPipeUtil.kt b/app/src/main/java/com/deniscerri/ytdl/util/extractors/newpipe/NewPipeUtil.kt index 9b854fa0..6d5c2f29 100644 --- a/app/src/main/java/com/deniscerri/ytdl/util/extractors/newpipe/NewPipeUtil.kt +++ b/app/src/main/java/com/deniscerri/ytdl/util/extractors/newpipe/NewPipeUtil.kt @@ -21,6 +21,7 @@ import org.schabi.newpipe.extractor.channel.ChannelInfo import org.schabi.newpipe.extractor.channel.tabs.ChannelTabInfo import org.schabi.newpipe.extractor.kiosk.KioskInfo import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler +import org.schabi.newpipe.extractor.localization.ContentCountry import org.schabi.newpipe.extractor.localization.Localization import org.schabi.newpipe.extractor.playlist.PlaylistInfo import org.schabi.newpipe.extractor.search.SearchInfo @@ -262,7 +263,14 @@ class NewPipeUtil(context: Context) { fun getTrending(): ArrayList { try { val items = arrayListOf() - val info = KioskInfo.getInfo(NewPipe.getService(ServiceList.YouTube.serviceId), "https://www.youtube.com/feed/trending") + val kioskList = NewPipe.getService(ServiceList.YouTube.serviceId).kioskList + kioskList.forceContentCountry(ContentCountry(countryCode)) + + val kioskId = "trending_music" + val extractor = kioskList.getExtractorById(kioskId, null) + extractor.fetchPage() + + val info = KioskInfo.getInfo(extractor) if (info.relatedItems.isEmpty()) return arrayListOf() for (i in 0 until info.relatedItems.size) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e98b6fce..3db1264e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -505,4 +505,7 @@ Update yt-dlp while downloading Add -U to yt-dlp to update it to latest before downloading Preview filename + Auth\n-----------------------\n1. Click \'Auth\' to open the sign in page in WebView.\n2. Sign in to your Google Account.\n3. Play any video that supports auto-translated subtitles.\n4. Turn on auto-translated subtitles and see if it works.\n\t4.1 If auto-translated subtitles don\'t work, switch to another video that supports auto-translated subtitles and try step 4 again.\n5. Click OK.\n\nNo Auth\n-----------------------\n1. Click \'No Auth\'.\n2. Write any youtube video url\n3. Wait for the video to load and play the video for at least 3 seconds.\n3. Click OK. + No Auth + Auth