add string resource for po token guide, fix newpipe trending page
This commit is contained in:
parent
3d6c3980d0
commit
4a23ad3897
3 changed files with 15 additions and 20 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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<ResultItem> {
|
||||
try {
|
||||
val items = arrayListOf<ResultItem>()
|
||||
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) {
|
||||
|
|
|
|||
|
|
@ -505,4 +505,7 @@
|
|||
<string name="update_ytdlp_while_downloading">Update yt-dlp while downloading</string>
|
||||
<string name="update_ytdlp_while_downloading_summary">Add -U to yt-dlp to update it to latest before downloading</string>
|
||||
<string name="preview_filename">Preview filename</string>
|
||||
<string name="potoken_guide">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.</string>
|
||||
<string name="no_auth">No Auth</string>
|
||||
<string name="auth">Auth</string>
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Reference in a new issue