benzap / redditv

Subreddit Video Player
http://redditv.ca
Eclipse Public License 1.0
17 stars 1 forks source link

Support "next" pages #3

Open ghost opened 7 years ago

ghost commented 7 years ago

From my subreddit, these links both work fine:

and first page works with redditv:

http://redditv.ca#r/stationalpha

but next page does not, even with varying levels of encoding:

benzap commented 6 years ago

Interesting! I can look into implementing this as the next feature.

benzap commented 6 years ago

Hey @svnpenn ,

So I while back, I implemented the ability to retrieve more than the default count of 100 items from reddit. I think this falls close to this feature. Based on your example url, the equivalent would be something like:

http://redditv.ca/#/r/stationalpha/7utx4j?count=1000 http://redditv.ca/#/r/stationalpha/6w98h8?count=1000 (Video doesn't playback, since it was removed)

Note that the reddit post name is provided as the first argument (6w98h8 versus t3_6w98h8), and a count argument can be provided to specify how many reddit posts to retrieve.

Since that video doesn't playback, here's a similar link

I'm looking into identifying videos that don't playback, so they automatically get skipped. As it stands, the previous implementation was removed because it was also skipping videos that had a different start-time.

ghost commented 6 years ago

@benzap this is interesting, but couple of issues here - you say default count is 100 - but this:

http://redditv.ca/#/r/stationalpha

yield 200 - only this yields 100:

http://redditv.ca/#/r/stationalpha?count=100


perhaps a better fix would be something like this, with reddit you can use the "after" token and it loads items found after said video:

http://reddit.com/r/stationalpha?after=t3_7tdjqo

ReddiTv does this sometimes:

http://redditv.ca/#/r/stationalpha/7tdjqo

but sometimes it just slaps the selected video in front of the most recent videos, rather than in front of the videos that naturally follow it:

http://redditv.ca/#/r/stationalpha/78cx2q

benzap commented 6 years ago

Hey @svnpenn,

I guess I should have explained what has changed!

So as a workaround for your issue, the counts you suggested could be bumped up to 1000, but i'm guessing you want to play only 100 videos on a loop? I was thinking you could just set the count to 1000, so you get your video in the correct playlist location.

If the video with the given reddit post id doesn't exist within the current playlist, it is pasted at the front of the playlist. This is done through a completely separate retrieval of that particular reddit post.

The after query parameter functionality you are suggesting can be implemented, I just never considered the case that someone would want only certain sections of a subreddit. I already somewhat have the implementation in place to include that functionality, so i'll take a look at it today, and see if I can throw it in.

Cheers

ghost commented 6 years ago

@benzap its about performance - i dont feel good about loading 1000 videos at once. reddit allows you to do this

http://reddit.com/r/stationalpha?limit=100

then when youre ready you can click the next button which takes you here

http://reddit.com/r/stationalpha?limit=100&after=t3_7m1mxe

and it doesnt append the new videos, it replaces them with 100 new ones - this is good for memory because if it just appended them (like you get with infinite scroll) you would quickly run of of memory after a few pages.

benzap commented 6 years ago

Hey @svnpenn,

I finished implementing the after query parameter, this should work now:

http://redditv.ca/#/r/stationalpha/7lz0t5?after=t3_7m1mxe&count=100

Let me know if this is what you're after :)

Cheers

ghost commented 6 years ago

@benzap so this works:

http://redditv.ca/#/r/stationalpha?after=t3_7m1mxe

the only thing that would need to be added at this point is some kind of next button. if i go here:

http://redditv.ca/#/r/stationalpha

the last video is

http://redditv.ca/#/r/stationalpha/78cybx

if i do nothing, the playlist will loop back to first video, so i have to manually change the URL to

http://redditv.ca/#/r/stationalpha?after=t3_78cybx

this would be easy enough that i could do it with a bookmarklet, but it would be cool if the site had its own "next" button - thanks

benzap commented 6 years ago

ah I see where you're getting at, I guess the next step will be to have a button that shows up in the playlist to load the next set of videos. I'll see when I can get around to doing that.

Thanks for the feature requests!

ghost commented 6 years ago

@benzap as a workaround - here is a bookmarklet that implements "next":

x = location.href.split('?').shift();
location = x + '?after=t3_' + x.split('/').pop();
location.reload();

http://github.com/svnpenn/umber/tree/master/bmklet/redditv