TeamNewPipe / NewPipe

A libre lightweight streaming front-end for Android.
https://newpipe.net
GNU General Public License v3.0
31.41k stars 3.06k forks source link

Support New Yt trending pages #1805

Open theScrabi opened 6 years ago

theScrabi commented 6 years ago

Youtube has recently introduced new trending pages

bildschirmfoto vom 2018-10-12 02-24-10

This now makes it possible to also see topic related trending, like music, live stream, news etc. Since I think this is (at least) something good youtube did we should add support for this. NewPipe is written to support more than only one of these "Kiosks" per service, so it should be pretty simple to just add some more kisoks to the extractor.

This should not be to much complicated, and it is a welcome thing for getting in touch with the extractor.

Optional UI changes

Short or long term we need to change the UI to better support multiple Kiosks. @Somethingweirdhere what do you think about my suggestion?

small_arrow_closed small_arrow_open

gregordr commented 6 years ago

Looks good to me! One thing though: There is still a main Trending page. Can you access it by pressing Trends, and expand the list by tapping on the arrow? Or would we title it Kiosks, and add Trends on the same level as Music, Sports and Live?

theScrabi commented 6 years ago

I think it was awesome if the kiosk could be togfled, meaning the last selected kiosk will be shown beside the arrow, and if someone clicks on it he can sellect one of the other ones

gregordr commented 6 years ago

@theScrabi Hm yeah, I think that makes sense!

gregordr commented 6 years ago

Anyone already working on this?

gregordr commented 6 years ago

Alright, will get working on it then.

Can you confirm to me that if you go to Trending News, you also get the URLhttps://www.youtube.com/feed/trending?bp=4gIuCggvbS8wNWpoZxIiUEwzWlE1Q3BOdWxRa2lqaUkwSWxMc0I0R3NQWjhUNVlDZA%3D%3D ? If not, the URL changes according to country or something else and we have to find a way to get that.

Edit: I have played around, but I ran into the problem that everything after a ? seems to be ignored, which is quite terrible because that's where our URLs differ.

gregordr commented 6 years ago

I solved the above problem by using an URL shortener... but that's not the best solution. Any ideas?

Edit: https://github.com/Somethingweirdhere/NewPipeExtractor/commit/d024434fcbcb2656b23e181fc2b5485a134b3d49

This is the extractor URL.

Parse this: implementation 'com.github.Somethingweirdhere:NewPipeExtractor:d024434fcbcb2656b23e181fc2b5485a134b3d49'

To test it. It works, but before making a pull request I think we should do something about the links instead of using bit.ly.

omarroth commented 5 years ago

I can verify that the News link you provided is the same for me. Although trending pages differ depending on region. I would probably recommend hardcoding the links rather than using a link shortener, similar to what is currently done in SearchQueryHandler, so instead of url + "&sp=..." it would be url + "&bp=...".

For something more robust, I would probably recommend taking a look at TeamNewPipe/NewPipeExtractor#106, as it appears to be quite similar. Although I haven't investigated very much, this appears to be the structure of the &bp= param (after Base64-decoding):

e2 02 SIZE =>
    0a SIZE =>
        /m/?????
    12 SIZE =>
        PLID

Where SIZE is a single byte indicating the length of the indented data (in bytes).

Notice that each trending param actually refers internally to a playlist, examples:

gregordr commented 5 years ago

@omarroth I have already tried that: https://github.com/Somethingweirdhere/NewPipeExtractor/commit/3fcf812e57360c5f74c1d0b6dbf7618152a2bdb2

The issue is that apparently everything after the ? get's ignored

omarroth commented 5 years ago

Ah, I missed that. Sorry that I won't be much help there.

gregordr commented 5 years ago

@theScrabi @TobiGr @karyogamy What do you think about this? Merge this way? Try to find out why the ? are being ignored? Any other thoughts?

theScrabi commented 5 years ago

I may look at this, but atm it has rather low priority.

Orion983 commented 3 years ago

Goodness I swear this didn't come up when I made my issue! Ah well nice issue