NewPipe icon indicating copy to clipboard operation
NewPipe copied to clipboard

Channel tabs

Open Theta-Dev opened this issue 2 years ago • 25 comments

Because YouTube is planning to update their channel page layout (as announced here) and divide videos into 3 tabs (regular videos, shorts, livestreams), we need to add this layout to the NewPipe app to be able to access all channel content.

What is it?

  • [ ] Bugfix (user facing)
  • [X] Feature (user facing)
  • [ ] Codebase improvement (dev facing)
  • [ ] Meta improvement to the project (dev facing)

Description of the changes in your PR

  • add a tabbed channel layout with tabs for videos, shorts, livestreams, playlists, featured channels and channel info
  • add a settings option to hide certain channel tabs
  • add a debug only option to set a YouTube visitor data cookie (allows for testing the new layout)

Before/After Screenshots/Screen Record

https://libreddit.kavin.rocks/r/NewPipe/comments/ybvl5t/update_on_the_channel_tabs_feature_debug_apk/

Fixes the following issue(s)

  • Fixes #2414

Relies on the following changes

  • TeamNewPipe/NewPipeExtractor#951

APK testing

Download the debug build here:

  • ~app-debug.zip~
  • ~app-debug2.zip (update: merged the latest extractor commits, fixes like count extraction)~
  • ~app-debug3.zip (update: cache channel data, fix NPE crash, add Bandcamp album support)~
  • app-debug4.zip (update: small extractor bugfix, extract upload date from shorts, show albums from YTM artist channels)

To test the new 3-tab layout by YouTube (Videos, Shorts, Live) which is currently A/B tested, go to Settings > Debug > YouTube visitor data and set it to this value: CgtOa256ckVkcG5YVSi7-c6aBg%3D%3D (Note: This will send a visitor cookie to Youtube.)

Note: you only have to set the visitor data if you want the new 3tab layout to alwas appear (for reproducible testing). It is not necessary if you just want to use the app

Due diligence

Theta-Dev avatar Oct 23 '22 23:10 Theta-Dev

Dun dun DUUUUUUUN. It's happening. It's finally happening. ಥ‿ಥ

opusforlife2 avatar Oct 24 '22 02:10 opusforlife2

Opening non-video items in channel tabs and then going back causes the entire channel info to be loaded again. Can it not be cached? Or opened as a fragment or something like video details pages are?


Crash crash crash! If you open any item from a non-video channel tab and then open a video, going full screen causes this crash:

FATAL EXCEPTION: main
Process: org.schabi.newpipe.debug.channeltabs, PID: 17217
java.lang.NullPointerException: Attempt to read from field 'com.google.android.material.tabs.TabLayout org.schabi.newpipe.databinding.FragmentChannelBinding.tabLayout' on a null object reference
	at org.schabi.newpipe.fragments.list.channel.ChannelFragment.onSaveInstanceState(ChannelFragment.java:134)
	at androidx.fragment.app.Fragment.performSaveInstanceState(Fragment.java:3183)
	at androidx.fragment.app.FragmentStateManager.saveBasicState(FragmentStateManager.java:680)
	at androidx.fragment.app.FragmentStateManager.saveState(FragmentStateManager.java:646)
	at androidx.fragment.app.FragmentStore.saveActiveFragments(FragmentStore.java:214)
	at androidx.fragment.app.FragmentManager.saveAllStateInternal(FragmentManager.java:2318)
	at androidx.fragment.app.FragmentManager.lambda$attachController$0$androidx-fragment-app-FragmentManager(FragmentManager.java:2572)
	at androidx.fragment.app.FragmentManager$$ExternalSyntheticLambda0.saveState(Unknown Source:2)
	at androidx.savedstate.SavedStateRegistry.performSave(SavedStateRegistry.kt:247)
	at androidx.savedstate.SavedStateRegistryController.performSave(SavedStateRegistryController.kt:81)
	at androidx.activity.ComponentActivity.onSaveInstanceState(ComponentActivity.java:338)
	at android.app.Activity.performSaveInstanceState(Activity.java:2203)
	at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1520)
	at android.app.ActivityThread.callActivityOnSaveInstanceState(ActivityThread.java:5830)
	at android.app.ActivityThread.callActivityOnStop(ActivityThread.java:5229)
	at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:5784)
	at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:5703)
	at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:71)
	at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2253)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loopOnce(Looper.java:201)
	at android.os.Looper.loop(Looper.java:288)
	at android.app.ActivityThread.main(ActivityThread.java:7870)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

opusforlife2 avatar Oct 24 '22 11:10 opusforlife2

Can we get the ability to disable shorts from all newpipe feeds please?

Bizz91 avatar Oct 24 '22 19:10 Bizz91

@opusforlife2 I published a new debug build (v3) that should fix your issues

Theta-Dev avatar Oct 25 '22 08:10 Theta-Dev

Confirmed. Thanks!

opusforlife2 avatar Oct 25 '22 12:10 opusforlife2

Playlist creator channel details is inaccessible.

IMG_20221028_203731

SameenAhnaf avatar Oct 28 '22 14:10 SameenAhnaf

Some design suggestion for new channel tabs! img_2022_10_29_12_26_15.jpg IMG_20221025_101021.jpg IMG_20221025_101613.jpg IMG_20221025_100719.jpg IMG_20221025_102008.jpg session-2022-10-25-110503.jpg IMG_20221029_105634.jpg

Some channels doesn't feature Home video, then the Home tab look like this👇

img_2022_10_29_12_33_54.jpg

tvnmguy avatar Oct 29 '22 05:10 tvnmguy

Is possible to implement search something in a channel? If possible... My design is here👇 img_2022_10_29_13_23_48.jpg IMG_20221029_131703.jpg img_2022_10_29_13_23_48.jpg img_2022_10_29_13_08_48.jpg img_2022_10_29_13_05_50.jpg img_2022_10_29_13_01_56.jpg

tvnmguy avatar Oct 29 '22 08:10 tvnmguy

@SameenAhnaf Did you open this playlist from the channel playlists tab? I tried it and could not reproduce this issue.

This PR does not touch any playlist extraction code, so that issue may also occur when opening a playlist manually.

A quick fix would be to clear the cache and reopen the playlist.

Theta-Dev avatar Oct 29 '22 08:10 Theta-Dev

@Theta-Dev AudricV successfully solved the bug in extractor. Anyway, https://github.com/TeamNewPipe/NewPipe/issues/5746 & https://github.com/TeamNewPipe/NewPipe/issues/9223 could be linked with this PR.

Btw, do you have any plan how to integrate 3 separate tabs' loading into one what's new feed? Or, split what's new feed into three tabs on another PR? I noticed that recent shorts and live videos are not included in what's new feed.

SameenAhnaf avatar Oct 29 '22 18:10 SameenAhnaf

It is not possible to merge all 3 tabs into one feed because YouTube does not show the upload date of shorts.

We could omit the shorts and merge the video and livestream tab into the feed.

An alternative would be to fetch both the video tab and the RSS feed. That would be faster than fetching 2 tabs and we would still get all the shorts and livestreams

Theta-Dev avatar Oct 29 '22 20:10 Theta-Dev

Is it within scope of this PR to split what's new feed into three tabs? An issue is inevitable in this regard.

An alternative would be to fetch both the video tab and the RSS feed.

I think, this point should be discussed in https://github.com/TeamNewPipe/NewPipe/issues/4934 instead. Many users have limited access to cellular data and this should be an option, not the only way.

SameenAhnaf avatar Oct 29 '22 20:10 SameenAhnaf

I haven't set the visitor data cookie, yet I'm suddenly seeing the Shorts and Live tabs. I wasn't seeing them a couple of days ago when I tested debug3. A/B testing is the culprit, I assume?

opusforlife2 avatar Oct 30 '22 16:10 opusforlife2

App debug 3 is working all right even without entering any cookie no problem during video playback using it instead of official new pipe release for 3 days

killerrook avatar Oct 31 '22 20:10 killerrook

If the app remains open and android goes in deep sleep or app is killed by android. The following error shows up 4-5 times. Then keep pressing back and app will be closed after all error reports are shown. Upon reopening it will work fine again. Consistent issue.Hope that helps.

Exception

  • User Action: ui error
  • Request: ACRA report
  • Content Country: US
  • Content Language: en-US
  • App Language: en_US
  • Service: none
  • Version: 0.24.0
  • OS: Linux OPPO/CPH1861/CPH1861:9/PPR1.180610.011/1587903909:user/release-keys 9 - 28
Crash log

java.lang.RuntimeException: Unable to start activity ComponentInfo{org.schabi.newpipe.debug.channeltabs/org.schabi.newpipe.MainActivity}: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: androidx.fragment.app.FragmentManagerState
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3175)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3312)
	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:113)
	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:71)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2038)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loop(Looper.java:226)
	at android.app.ActivityThread.main(ActivityThread.java:7178)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:503)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:942)
Caused by: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: androidx.fragment.app.FragmentManagerState
	at android.os.Parcel.readParcelableCreator(Parcel.java:2855)
	at android.os.Parcel.readParcelable(Parcel.java:2781)
	at android.os.Parcel.readValue(Parcel.java:2684)
	at android.os.Parcel.readArrayMapInternal(Parcel.java:3053)
	at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:288)
	at android.os.BaseBundle.unparcel(BaseBundle.java:232)
	at android.os.Bundle.getParcelable(Bundle.java:940)
	at androidx.fragment.app.FragmentManager.attachController(FragmentManager.java:2583)
	at androidx.fragment.app.FragmentController.attachHost(FragmentController.java:116)
	at androidx.fragment.app.FragmentActivity.lambda$init$1$androidx-fragment-app-FragmentActivity(FragmentActivity.java:128)
	at androidx.fragment.app.FragmentActivity$$ExternalSyntheticLambda1.onContextAvailable(Unknown Source:2)
	at androidx.activity.contextaware.ContextAwareHelper.dispatchOnContextAvailable(ContextAwareHelper.java:99)
	at androidx.activity.ComponentActivity.onCreate(ComponentActivity.java:322)
	at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:249)
	at org.schabi.newpipe.MainActivity.onCreate(MainActivity.java:136)
	at android.app.Activity.performCreate(Activity.java:7383)
	at android.app.Activity.performCreate(Activity.java:7374)
	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3155)
	... 11 more


killerrook avatar Nov 01 '22 13:11 killerrook

Image or thumbnail doesn't load while in debug build with NewPipeExtractor crash fix. Still persisted. I hope they will be fixed. @Theta-Dev, I need to fix thumbnail loading issues.

Exception

  • User Action: load image
  • Request: https://i.ytimg.com/vi/XgvuIGwYIpk/maxresdefault.jpg?sqp=-oaymwEmCIAKENAF8quKqQMa8AEB-AH-CYAC0AWKAgwIABABGGUgUihEMA8=&rs=AOn4CLCzqLb2G-9A61HkSVzBNIITMhqUvg
  • Content Country: PH
  • Content Language: en-PH
  • App Language: en_PH
  • Service: YouTube
  • Version: 0.24.0
  • OS: Linux Android 12 - 31
Crash log

com.squareup.picasso.NetworkRequestHandler$ResponseException: HTTP 404
	at com.squareup.picasso.NetworkRequestHandler.load(NetworkRequestHandler.java:51)
	at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:219)
	at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:175)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:463)
	at java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
	at java.lang.Thread.run(Thread.java:1012)
	at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:354)


WorkHard4470 avatar Nov 02 '22 10:11 WorkHard4470

Sometimes in app debug 3.zip the follow inconsistent error occurs when refreshing feed Screenshot_2022-11-01-19-31-15-42 Screenshot_2022-11-01-19-31-01-47_ee8807d2de22f1831269d80920e33a3b Screenshot_2022-11-01-19-30-57-56_ee8807d2de22f1831269d80920e33a3b Screenshot_2022-11-01-19-30-51-13_ee8807d2de22f1831269d80920e33a3b

killerrook avatar Nov 05 '22 00:11 killerrook

Channel tabs seem to be inaccessible if added as a content on main page. Only, normal videos are shown.

SameenAhnaf avatar Nov 05 '22 17:11 SameenAhnaf

Channel tabs seem to be inaccessible if added as a content on main page. Only, normal videos are shown.

That is intentional. The main page already used a tabbed layout, so we cant have another tab bar inside.

Theta-Dev avatar Nov 06 '22 00:11 Theta-Dev

One thing I noticed is that when being on any tab other than the "VIDEOS" one, if you rotate the screen, you're moved back to it (the videos tab).

tsiflimagas avatar Nov 06 '22 01:11 tsiflimagas

Please @Theta-Dev resolve the checks and resolve branch conflicts.

WorkHard4470 avatar Nov 06 '22 01:11 WorkHard4470

Got this when reloading the feed some time after watching this particular video. Not sure if it's related to the pr or is by any means important, tho. Otherwise, no problems encountered so far; great job! And thanks for removing shorts and streams from the "what's new" tab, they were kinda annoying 🙃

Exception

  • User Action: play stream
  • Request: Loading failed for [Сразу несколько новых проектов. Большой анонс с veloline и stark]: https://www.youtube.com/watch?v=twjbDeKip2s
  • Content Country: US
  • Content Language: en-US
  • App Language: en_US
  • Service: YouTube
  • Version: 0.24.0
  • OS: Linux Android 13 - 33
Crash log

org.schabi.newpipe.player.mediasource.FailedMediaSource$MediaSourceResolutionException: Unable to resolve source from stream info. URL: https://www.youtube.com/watch?v=twjbDeKip2s, audio count: 0, video count: 12, 2
	at org.schabi.newpipe.player.playback.MediaSourceManager.lambda$getLoadedMediaSource$3$org-schabi-newpipe-player-playback-MediaSourceManager(MediaSourceManager.java:432)
	at org.schabi.newpipe.player.playback.MediaSourceManager$$ExternalSyntheticLambda0.apply(Unknown Source:6)
	at io.reactivex.rxjava3.internal.operators.single.SingleMap$MapSingleObserver.onSuccess(SingleMap.java:58)
	at io.reactivex.rxjava3.internal.operators.single.SingleDoOnError$DoOnError.onSuccess(SingleDoOnError.java:52)
	at io.reactivex.rxjava3.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.onSuccess(SingleSubscribeOn.java:68)
	at io.reactivex.rxjava3.internal.operators.maybe.MaybeToSingle$ToSingleMaybeSubscriber.onSuccess(MaybeToSingle.java:83)
	at io.reactivex.rxjava3.internal.operators.flowable.FlowableElementAtMaybe$ElementAtSubscriber.onNext(FlowableElementAtMaybe.java:80)
	at io.reactivex.rxjava3.internal.operators.maybe.MaybeConcatArray$ConcatMaybeObserver.drain(MaybeConcatArray.java:136)
	at io.reactivex.rxjava3.internal.operators.maybe.MaybeConcatArray$ConcatMaybeObserver.request(MaybeConcatArray.java:78)
	at io.reactivex.rxjava3.internal.operators.flowable.FlowableElementAtMaybe$ElementAtSubscriber.onSubscribe(FlowableElementAtMaybe.java:66)
	at io.reactivex.rxjava3.internal.operators.maybe.MaybeConcatArray.subscribeActual(MaybeConcatArray.java:42)
	at io.reactivex.rxjava3.core.Flowable.subscribe(Flowable.java:15868)
	at io.reactivex.rxjava3.internal.operators.flowable.FlowableElementAtMaybe.subscribeActual(FlowableElementAtMaybe.java:36)
	at io.reactivex.rxjava3.core.Maybe.subscribe(Maybe.java:5330)
	at io.reactivex.rxjava3.internal.operators.maybe.MaybeToSingle.subscribeActual(MaybeToSingle.java:46)
	at io.reactivex.rxjava3.core.Single.subscribe(Single.java:4813)
	at io.reactivex.rxjava3.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run(SingleSubscribeOn.java:89)
	at io.reactivex.rxjava3.core.Scheduler$DisposeTask.run(Scheduler.java:644)
	at io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:65)
	at io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:56)
	at java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:307)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
	at java.lang.Thread.run(Thread.java:1012)


c0h2r avatar Nov 06 '22 12:11 c0h2r

Steps to reproduce bug

  1. Start playing a video in background
  2. Enque 2-3 songs
  3. The thumnail on the minimized player appears for first one but not the second

Here is a screenshot depicting problem in debug(v3 and v4) Screenshot_2022-11-07-08-06-30-88

killerrook avatar Nov 07 '22 02:11 killerrook

Also some videos are Missing thumbnail in what's new feed as well Screenshot_2022-11-07-11-40-53-06_79bc5d99886106bfc3f2688bf01a61d3

killerrook avatar Nov 07 '22 06:11 killerrook

Also some videos are Missing thumbnail in what's new feed as well Screenshot_2022-11-07-11-40-53-06_79bc5d99886106bfc3f2688bf01a61d3

Yes, me too

tvnmguy avatar Nov 07 '22 08:11 tvnmguy

Issues:

  • Switching from popup to main player results in blank (black) screen in main(default) player while the audio keeps playing.
  • The download confirmation dialog only shows 3gp links for some videos(this also doesn't exist in 0.24.1)

Observation/Analysis:

  1. The issue does not exist in 0.24.1
  2. The default settings for main player is 240p
  3. For pop-up default settings is 140p
  4. The file type or codec is MPEG4 i.e. mp4
  5. Changing video quality in main (default) player once the blank screen issue occurs does not fix the problem

killerrook avatar Nov 15 '22 08:11 killerrook

Good experience with debug 4 on my end. Also, perhaps I'm missing something, but shouldn't the "what's new" section have videos / shorts / live all together? That is of course how it was before the youtube channel tabs update.

To be clear, the NP channel tabs update here is great - huge improvement.

wCTcTU4P avatar Nov 23 '22 03:11 wCTcTU4P

Good experience with debug 4 on my end. Also, perhaps I'm missing something, but shouldn't the "what's new" section have videos / shorts / live all together? That is of course how it was before the youtube channel tabs update.

To be clear, the NP channel tabs update here is great - huge improvement.

no, shorts are cancer and there will be an option to hide them. or another section. live videos and announcements are on top, announcements only if option show future videos is set.

Feuerswut avatar Nov 23 '22 03:11 Feuerswut

Good experience with debug 4 on my end. Also, perhaps I'm missing something, but shouldn't the "what's new" section have videos / shorts / live all together? That is of course how it was before the youtube channel tabs update. To be clear, the NP channel tabs update here is great - huge improvement.

no, shorts are cancer and there will be an option to hide them. or another section. live videos and announcements are on top, announcements only if option show future videos is set.

Personally, I agree and don't care for shorts whatsoever. On the development end, I would think it would be an option of what combinations of the 3 subsets (shorts, vids, live, unless I am missing something else) the user wants to have in their "What's New" feed, with the default being "All".

Also, just to clarify on lives - I have seen them at the top, but when they are posted afterwards, they do not seem to be appearing in the What's New feed. That specifically was the issue I identified (for my personal use). Previously, post-live video postings were in the feed, and now they are not, even in debug v4 from testing yesterday.

In addition, I just remembered one further piece of feedback - I found that the playlists tab on a test channel only had the 1st playlist category that I see here: https://www.youtube.com/c/3blue1brown/playlists.

Specifically 3Blue1Brown has several playlist categories (meta-playlists?), "Created Playlists", "Series", "Projects on other channels". What I saw in debug v4 corresponded only to the first one listed, "Created Playlists", I believe.

Another example - PBS spacetime has a special category of playlists as well: https://www.youtube.com/@pbsspacetime/playlists. It seems that can be user defined, but basically it seems newpipe would want to have the superset of "Created Playlists" as well as any other user-defined playlist categories (or meta-playlists, if you will).

If I need to clarify or if I am just remembering wrong or something, please let me know, but I believe this is what I encountered in my brief test yesterday.

wCTcTU4P avatar Nov 23 '22 18:11 wCTcTU4P

have you set the cookie to receive the 3 tab layout data?

i get all playlists and have not set the cookie. Screenshot_20221123-195822.png Screenshot_20221123-195816.png

Feuerswut avatar Nov 23 '22 18:11 Feuerswut

have you set the cookie to receive the 3 tab layout data?

i get all playlists and have not set the cookie.

Sorry for the slow response. Regarding the cookie, I'm not sure what you're referring to - I downloaded debug4 and didn't alter any settings (haven't seen one regarding cookies, so idk exactly where it is).

So I see that PBS Spacetime actually shows correctly in NewPipe. However, 3Blue1Brown does not have some other playlists lists as before. Have you tried that one on your end? Specifically upon review, it seems "Created playlists" and "Projects on other channels" categories are in NewPipe. So it is just "Series" playlists that aren't there. Perhaps that is a... special playlist category of some type that is being missed by NewPipe?

Also, is there any word on post-live video postings (VODs, I guess is the term?) being in the "What's New?" section? Not sure if that relates to the cookie you mentioned.

wCTcTU4P avatar Nov 26 '22 21:11 wCTcTU4P