TeamNewPipe / NewPipe

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

[enhancement] "What's New" sorting improvement #822

Closed M86xKC closed 4 years ago

M86xKC commented 6 years ago

So now the "What's New" page shows the latest video from each channel you subscribed to, but that's not how YouTube subscriptions work, youtubes' subscription list sorts videos by the publish date.

Now in NewPipe each channel have only one video in the "What's New" feed even if they published 10 videos recently "say 1 day ago" at the same time only one will show up in "What's New", and some other channels that you may subscribed to, haven't published in months and you have watched their videos it still shows them every time you go to "What's New".

So it will be nice to sort the "What's New" videos by the publish date.

theScrabi commented 6 years ago

It would be nice if we could have a proper feed manager like typical rss managers that shows how much videos of a channel you didn't see, and which one they are.

karyogamy commented 6 years ago

This problem is noted and discussed in more detail in #739, but may take some time before a good implementation surfaces. In short, the timestamp available on the webpage is insufficient in determining the time of publishing, so the latest video is used as a replacement for getting the feed. Also, in order to implement a proper feed, we have to consider how to deal with other services in the future.

M86xKC commented 6 years ago

@theScrabi @karyogamy @epitron @Generator @timofonic I found this "https://github.com/ram-on/SkyTube" and it is not feature-rich as NewPipe but its "feed tab" is awesome, (It sorts the videos by time published) I hope you can fork it and get it workin' in NewPipe

karyogamy commented 6 years ago

@pupyc SkyTube uses Youtube API for retrieving video's publish date, something NewPipe will not support.

jfwerner commented 6 years ago

@karyogamy It still knows when the video was published though....

Just make it like YouTube. Just a normal feed. I don't want to click on "What's new" to see the videos. Wouldn't it be much more logical to make that "My subscribed channels" and show the Feed directly?

epistularum commented 6 years ago

In my opinion a subscription feed would be a major addition for anyone wishing to use newpipe as a replacement of the YouTube app.

theScrabi commented 6 years ago

Yes I see it like you. I wished NewPipe had this. Just someone had to do it :)

wojcik-online commented 6 years ago

I've been using NewPipe as a replacement for the YouTube app, and this issue has been bothering me the most. So I've started to work on an implementation, but before adding a PR, I would like to get some input.

How I imagine the feed to work:

theScrabi commented 6 years ago

Sounds good. But isn't the date already parsed in the extractor? If not than the parsing would belong there anyway.

karyogamy commented 6 years ago

@wojcik-online Looks good to me too, though like @theScrabi said, we do have to take into account that different services may have different format patterns on the upload date strings. Also, I'd like request you to not change the database at the moment as it is undergoing a schema overhaul in #1004. By the way, great job on the change you made on feed fragment, I didn't know you can use Rx buffer like that.

mauriciocolli commented 6 years ago

@theScrabi Take a look here: YoutubeStreamInfoItemExtractor.java#L118, we are simply taking what the streaming service is displaying.


I think all translation stuff should happen in the front end (NewPipe) but here's some ups and downs on downloading the page in only one language:

Ups:

Downs:

wojcik-online commented 6 years ago

@mauriciocolli I think the page could be downloaded in the language selected by the user and the parsing could take place in the front end. To parse every supported language, format patterns would have to be added to the resource strings.

<?xml version='1.0' encoding='UTF-8'?> 
<resources>
    <string name="service_yt_http_accept_language">en-US</string>
    <string name="service_yt_date_format_month">(\d)+ months ago</string>
</resources>
mauriciocolli commented 6 years ago

@wojcik-online that's the problem, it's just too many and who knows for how long they will be valid.

Even if we did, people would have to actively maintain the multitude of languages (someone who knows, at least, regexp). And then, even if the last point wasn't a problem, there's multiple services that could be using different words/phrases that would amplify the maintenance.

For these reasons, I think the cost of maintenance it's just too high.

wojcik-online commented 6 years ago

@mauriciocolli Do you think that the cost of keeping the following format up to date (in every language) would be too high as well? I doubt that the phrases are likely to change any time soon and the format doesn't require any knowledge of regexp.

<resources>
    <string name="upload_date_seconds_ago_phrase">sec</string>
    <string name="upload_date_minutes_ago_phrase">min</string> 
    <string name="upload_date_hours_ago_phrase">hour</string> 
    <string name="upload_date_days_ago_phrase">day</string> 
    <string name="upload_date_weeks_ago_phrase">week</string> 
    <string name="upload_date_months_ago_phrase">month</string> 
    <string name="upload_date_years_ago_phrase">year</string> 
</resources>

In the code, we could check which time unit is meant by calling: textualDateFromYoutube.contains(R.string.upload_date_hours_ago_phrase)

I have implemented a parser TimeAgoParser.java that works nicely with other services that provide exact upload times (such as SoundCloud or podcast RSS).

mauriciocolli commented 6 years ago

Yes, I was wondering of doing something like this, and in fact, there's a whole subject to this problem, check "natural language processing" (but parsing a "static" server generated dates wouldn't be as complicated as, for example, a real human talk).

If we could find a library good enough for that, we could use it, and if none meets our requirements, that would be the perfect opportunity to start a new project. I think it fits more as a dedicated one that could support multiple languages, and therefore, multiple services. What do you think?

Then the only thing left is turn the time to relative again, for that, there's some libraries out there. PrettyTime, for example (it even has a parser, but it's not updated for some time now).

wojcik-online commented 6 years ago

@mauriciocolli There also is DateUtils.getRelativeTimeSpanString() in the Android API. It seems to automatically take the user locale into account. I will look into PrettyTime and other parsers.

A lot of other services (e.g. SoundCloud) provide the exact upload date instead of a '2 months ago' type of thing. Do you think that the dates of other services should be displayed in the same way as the YouTube dates? This would certainly create a consistent UI.

mauriciocolli commented 6 years ago

@wojcik-online definitely, other than consistency, a person can identify/process a relative time much more quickly than a exact one, and for those who want it, it'll still be there in the detail page.

wojcik-online commented 6 years ago

@mauriciocolli I think that at the end of the day it should be the responsibility of the streaming service to parse its dates properly. I don't think it is possible to create a parser that will support all the formats of all future services in every language. Therefore I think we should concentrate on a simple parser of YouTube dates and if future services use a similar format, this parser can be generalized. This will ensure the most gain for the least effort. I will finish my implementation and add a Pull Request to discuss it further.

PrettyTime seems like an overkill to me. It supports centuries and millennia. (I wonder what the Romans watched on YouTube.) And the natural language parser unfortunately only supports English.

mauriciocolli commented 6 years ago

@wojcik-online The idea of a separate project was to create a library that could be used for other projects (specifically for parsing websites) that seems to be nonexistent, and better utilize the key words to support, at least, most services, but I see that it's a bit hard to do it correctly to every single one. For now, let's do it as you said.

PrettyTime seems like an overkill to me.

Now it definitely is, only suggested PrettyTime because of the relative strings, as I didn't know Android had it built in (and it seems to have a great support for pretty much all languages).

I will finish my implementation and add a Pull Request to discuss it further.

I'm already building/gathering the phrases and key words for YouTube for all supported languages, so you're more than welcome. (Also there's some strings that don't have an number in there (e.g just now, moments ago...), but that's an issue that we can discuss in the pr).

theScrabi commented 6 years ago

Android had it built

I assume you would like to put the parser into the fronted and not into the extractor then? Could it still be considered to put it in the extractor?

mauriciocolli commented 6 years ago

Here's a gist of it:

theScrabi commented 6 years ago

I see. Yea thats awesome. :)

justanidea commented 6 years ago

Is this option going to be applied for soundcloud? :D

wojcik-online commented 6 years ago

@justanidea Yes, it's independent of the underlying service. There's one feed with the newest items of all services.

justanidea commented 6 years ago

And are we going to be able to separate them if we want?

justanidea commented 6 years ago

This topic makes me think we just could do a section of Newpipe with a big feed for all the services, and a specific feed for each section (just an idea hehe) Sorry if its makes you work more (what you have already done is awesome :D)

theScrabi commented 6 years ago

big feed for all the services, and a specific feed for each section (just an idea hehe)

Possible :)

ghost commented 6 years ago

If we make a big feed of all the services, also add a brand in each corner of result that identifies the service (YouTube, Soundcloud, etc) because we are going to be confused, the same in the history of search and videos

532910 commented 5 years ago

It's not an "enhancement". It's the second major bug (after 1080p video, that's already fixed and allows use NewPipe as youtube player. (I'll better see youtube via firefox than 720p resolution.))

Current sorting doesn't answer the question: "Is there something new I’m subscribed to?" This bug doesn't allow to use NewPipe to receive new media as it appears.

Philipp0205 commented 5 years ago

Is there any update on this? :)

Vldm2r commented 5 years ago

Wow, this requestion has been hanging for a year now and it has never been added to the program ... Will it be implemented in the future?

M86xKC commented 5 years ago

@mauriciocolli I was just going to mention that we can use a mini rss reader to get accurate date of publishing, like any rss reader. That is what I use now and it is pretty accurate !

Thank you dude for the pr 👌 Hope it gets reviewed and merged soon

Philipp0205 commented 5 years ago

Thanks for the heads-up that there is already a pull request!

rakshazi commented 5 years ago

Waiting it for years @mauriciocolli thank you for your effort :)

Denyerec commented 4 years ago

Has this been furthered? Would be awesome for subscriptions to show unwatched videos - Bites to come back after a while and see only one, as you miss out on anything in between!

T-vK commented 4 years ago

Hey, can anyone give me some input on what exactly the problem is? Maybe I can help. It sounds to me as if you just don't know how to retrieve the publishing date (instead of the upload- or update date). That's actually a super trivial task. You just take the rss URLs for all your channels and hit them with an HTTP GET request. For example: https://www.youtube.com/feeds/videos.xml?channel_id=UCXuqSBlHAE6Xw-yeJA0Tunw (Will return all the information on recently published LinusTechTips videos)

Then you simply use a feed parsing library and extract the publish date for each video. The date is in a reliably parsable format too:

<published>2019-12-07T19:29:05+00:00</published>

(it's called ISO8601 which is very commonly used and supported by most date/time libraries)

Stypox commented 4 years ago

@T-vK see the discussion about feeds in #2309 To sum up the problem with feeds is that they do not provide live streams, and normal videos only provide a localization-based rounded publish date.

T-vK commented 4 years ago

To sum up the problem with feeds is that they do not provide live streams

Having live streams in the subscription feed seems like a really low priority compared to having it actually work at all with normal videos.

normal videos only provide a localization-based rounded publish date.

Yes, they are rounded to the second if you take the data from the feed. That seems good enough to me. And no, the date is not localized, it's an ISO8601 date/time that doesn't change. I've tried it with several different IP addresses and several different "Accept-Language" HTTP request headers. It always returned the ISO8601 date/time with a +00:00 timezone.

Correct me if I'm wrong.

Stypox commented 4 years ago

What I meant by "normal videos" is videos in the channel page (without feed). Again, see #2309