# Displaying past onelives on the website

**URL:** <https://sef.discourse.group/t/displaying-past-onelives-on-the-website/18>\
**Category:** Development\
**Created:** [March 26, 2020, 12:40pm UTC](https://sef.discourse.group/t/displaying-past-onelives-on-the-website/18 "2020-03-26T12:40:48Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![anjisvj](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/anjisvj/32/9_2.png) [@anjisvj](https://sef.discourse.group/u/anjisvj)\
**Post date:** [March 26, 2020, 12:40pm UTC](https://sef.discourse.group/t/displaying-past-onelives-on-the-website/18/1 "2020-03-26T12:40:48Z")

</div>

We need a video archive page to display past one live videos. We use youtube API to get videos from the SEF youtube channel.

---

<div class="post-metadata">

**Author:** ![jaye](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/jaye/32/810_2.png) [@jaye](https://sef.discourse.group/u/jaye)\
**Post date:** [March 26, 2020, 1:14pm UTC](https://sef.discourse.group/t/displaying-past-onelives-on-the-website/18/2 "2020-03-26T13:14:24Z")

</div>

Good work @anjisvj! 🤩  
What are the next steps?

Please let us know if there’s any blockers. Also, mention if you need any help. 🙂

---

<div class="post-metadata">

**Author:** ![anjisvj](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/anjisvj/32/9_2.png) [@anjisvj](https://sef.discourse.group/u/anjisvj)\
**Post date:** [March 26, 2020, 1:20pm UTC](https://sef.discourse.group/t/displaying-past-onelives-on-the-website/18/3 "2020-03-26T13:20:19Z")

</div>

So the dummy page also have been created. but youtube url shows only 5 items in the first place. I think it should show atleast 10 items cuz main purpose of that page is to show videos.

---

<div class="post-metadata">

**Author:** ![jaye](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/jaye/32/810_2.png) [@jaye](https://sef.discourse.group/u/jaye)\
**Post date:** [March 26, 2020, 1:28pm UTC](https://sef.discourse.group/t/displaying-past-onelives-on-the-website/18/4 "2020-03-26T13:28:39Z")

</div>

How about allowing user (frontend) to decide the `maxLength`?  
According to the youtube API it can be any value between `0` - `50`.

Think about a scenario like this. What if we need to display latest 3 onelives on the main onelive page or on another page?  
If we can send the `maxLength` as a query param, I think it will be more flexible for the user. 🙂

What do you think?

---

<div class="post-metadata">

**Author:** ![anjisvj](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/anjisvj/32/9_2.png) [@anjisvj](https://sef.discourse.group/u/anjisvj)\
**Post date:** [March 26, 2020, 1:52pm UTC](https://sef.discourse.group/t/displaying-past-onelives-on-the-website/18/5 "2020-03-26T13:52:25Z")

</div>

I think it’s cool. So we have some issues to be done with the data-holder

---

<div class="post-metadata">

**Author:** ![anjisvj](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/anjisvj/32/9_2.png) [@anjisvj](https://sef.discourse.group/u/anjisvj)\
**Post date:** [March 27, 2020, 1:24pm UTC](https://sef.discourse.group/t/displaying-past-onelives-on-the-website/18/6 "2020-03-27T13:24:50Z")

</div>

@Yohan and @osusara since you are available now. can you do this [https://github.com/sef-global/sef-data-holder/issues/14](https://github.com/sef-global/sef-data-holder/issues/14) ? we need to finish this as soon as we can.

---

<div class="post-metadata">

**Author:** ![anjisvj](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/anjisvj/32/9_2.png) [@anjisvj](https://sef.discourse.group/u/anjisvj)\
**Post date:** [March 30, 2020, 6:20am UTC](https://sef.discourse.group/t/displaying-past-onelives-on-the-website/18/7 "2020-03-30T06:20:28Z")

</div>

Here’s a quick update on what going:  
There was a CORS policy issue and now it’s fixed so the first 10 videos are now displayed in the archive. next step is to work on how send nextPageToken using query param to load next 10 videos and append it to the current videos.

> <https://github.com/sef-global/sef-data-holder/pull/23>

---

<div class="post-metadata">

**Author:** ![jaye](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/jaye/32/810_2.png) [@jaye](https://sef.discourse.group/u/jaye)\
**Post date:** [March 30, 2020, 7:07am UTC](https://sef.discourse.group/t/displaying-past-onelives-on-the-website/18/8 "2020-03-30T07:07:02Z")

</div>

Great @anjisvj! Send the archive PR too. 😇

---

<div class="post-metadata">

**Author:** ![Yohan](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/yohan/32/23_2.png) [@Yohan](https://sef.discourse.group/u/Yohan)\
**Post date:** [March 30, 2020, 8:03am UTC](https://sef.discourse.group/t/displaying-past-onelives-on-the-website/18/10 "2020-03-30T08:03:56Z")

</div>

Here’s a quick update on Issue#14:

> <https://github.com/sef-global/sef-data-holder/issues/14>
>
> Is your feature request related to a problem? Please describe.
> Currently, the payloads sent as plain strings. Need them as JSON.
> Describe the...

There was a issue with when we get data. Because the payloads sent as plain strings(text).Then browser recognized it as plain text because of that we can’t get a data. Then I Set the ContentType of payloads to application/json for issue#14. then we can get payload as JSON.

PR link:

> <https://github.com/sef-global/sef-data-holder/pull/21>

---

<div class="post-metadata">

**Author:** ![anjisvj](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/anjisvj/32/9_2.png) [@anjisvj](https://sef.discourse.group/u/anjisvj)\
**Post date:** [March 31, 2020, 5:55am UTC](https://sef.discourse.group/t/displaying-past-onelives-on-the-website/18/11 "2020-03-31T05:55:34Z")

</div>

Here is the issue for the next step: @jaye Can you please review this issue.

> <https://github.com/sef-global/sef-site/issues/633>
>
> Is your feature request related to a problem? Please describe.
> Currently it loads only first 10 videos and we need to load...

---

<div class="post-metadata">

**Author:** ![jaye](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/jaye/32/810_2.png) [@jaye](https://sef.discourse.group/u/jaye)\
**Post date:** [March 31, 2020, 8:10am UTC](https://sef.discourse.group/t/displaying-past-onelives-on-the-website/18/12 "2020-03-31T08:10:51Z")

</div>

@anjisvj Currently there’s nothing on the archive page because that PR has been reverted. We have to implement it first. 🙂

---

<div class="post-metadata">

**Author:** ![jaye](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/jaye/32/810_2.png) [@jaye](https://sef.discourse.group/u/jaye)\
**Post date:** [March 31, 2020, 8:16am UTC](https://sef.discourse.group/t/displaying-past-onelives-on-the-website/18/13 "2020-03-31T08:16:49Z")

</div>

Sorry my bad! I saw it now. Next time please add the relevant PR links, screenshots, previews for this thread.

> <https://github.com/sef-global/sef-site/pull/632>

---

<div class="post-metadata">

**Author:** ![anjisvj](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/anjisvj/32/9_2.png) [@anjisvj](https://sef.discourse.group/u/anjisvj)\
**Post date:** [March 31, 2020, 12:43pm UTC](https://sef.discourse.group/t/displaying-past-onelives-on-the-website/18/14 "2020-03-31T12:43:51Z")

</div>

@Gravewalker can you review the issue above and tell me?

---

<div class="post-metadata">

**Author:** ![jaye](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/jaye/32/810_2.png) [@jaye](https://sef.discourse.group/u/jaye)\
**Post date:** [April 1, 2020, 7:39am UTC](https://sef.discourse.group/t/displaying-past-onelives-on-the-website/18/15 "2020-04-01T07:39:37Z")

</div>

Nice @anjisvj!  
I just modified it as below. Update the issue description using these details too.

Currently, the onelive archive page ( add path ) displays only the first 10 videos. We need to load and display all videos in the playlist for the user. Since this is a paginated result, you have to load the given number of videos at a time.

This is because API has been designed to send a paginated request, that is 10 videos per page at the moment. Since this api designed by wrapping the [YouTube playlist API](https://developers.google.com/youtube/v3/docs/playlists/list) (just link the word ‘YouTube playlist API’ with the link 😉 ) the paginated result is a little bit different from the traditional paginated result with offset and limit.

The payload contains the token for the next page. You have to send it with the url to get the next videos in the following format.  
[https://sef-dataholder.herokuapp.com/youtube/onelive?nextPageToken={token-for-the-next-page}](https://sef-dataholder.herokuapp.com/youtube/onelive?nextPageToken=%7Btoken-for-the-next-page%7D)  
The returning payload contains the token for the next page.

Requirement:  
Find an optimal way to store the page token and send it with the next request. 🤠  
Find a creative way to display load more strategy for the user ( a load more button, infinite scroll, or feel free to use your own cool feature 😍)

---

<div class="post-metadata">

**Author:** ![anjisvj](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/anjisvj/32/9_2.png) [@anjisvj](https://sef.discourse.group/u/anjisvj)\
**Post date:** [April 2, 2020, 4:34am UTC](https://sef.discourse.group/t/displaying-past-onelives-on-the-website/18/16 "2020-04-02T04:34:53Z")

</div>

Thank you. 🤗 I updated the issue.

---

<div class="post-metadata">

**Author:** ![jaye](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/jaye/32/810_2.png) [@jaye](https://sef.discourse.group/u/jaye)\
**Post date:** [April 2, 2020, 4:40am UTC](https://sef.discourse.group/t/displaying-past-onelives-on-the-website/18/17 "2020-04-02T04:40:46Z")

</div>

Welcome @anjisvj!  
I think it will be easy if we can implement this before going to the UI.

> [@Displaying past onelives on the website](https://sef.discourse.group/t/displaying-past-onelives-on-the-website/18/4):
>
> How about allowing user (frontend) to decide the maxLength? According to the youtube API it can be any value between 0 - 50. Think about a scenario like this. What if we need to display latest 3 onelives on the main onelive page or on another page? If we can send the maxLength as a query param, I think it will be more flexible for the user. slight_smile What do you think?

---

<div class="post-metadata">

**Author:** ![anjisvj](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/anjisvj/32/9_2.png) [@anjisvj](https://sef.discourse.group/u/anjisvj)\
**Post date:** [April 4, 2020, 2:12pm UTC](https://sef.discourse.group/t/displaying-past-onelives-on-the-website/18/18 "2020-04-04T14:12:40Z")

</div>

yeah I added max results as a query parameter using this pr so now we can get a specific number of videos. I need some help on how to send a query param I couldn’t find it how to do it.

> <https://github.com/sef-global/sef-data-holder/pull/25>

---

<div class="post-metadata">

**Author:** ![anjisvj](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/anjisvj/32/9_2.png) [@anjisvj](https://sef.discourse.group/u/anjisvj)\
**Post date:** [April 5, 2020, 4:44am UTC](https://sef.discourse.group/t/displaying-past-onelives-on-the-website/18/19 "2020-04-05T04:44:39Z")

</div>

We need to limit the video description text. Currently it shows complete description and it can be a problem if it has a long description. I’ll raise an issue for this.

---

<div class="post-metadata">

**Author:** ![jaye](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/jaye/32/810_2.png) [@jaye](https://sef.discourse.group/u/jaye)\
**Post date:** [April 5, 2020, 5:43am UTC](https://sef.discourse.group/t/displaying-past-onelives-on-the-website/18/20 "2020-04-05T05:43:07Z")

</div>

> [@anjisvj](#):
>
> yeah I added max results as a query parameter using this pr so now we can get a specific number of videos. I need some help on how to send a query param I couldn’t find it how to do it.  
> [https://github.com/sef-global/sef-data-holder/pull/25](https://github.com/sef-global/sef-data-holder/pull/25)

Thanks, @anjisvj this is exactly what I was looking for! 💜

You can send this as a hardcoded value in your ajax call in the UI.

ex:

```javascript
$.ajax({
    type: 'get'
    url: 'https://sef-dataholder.herokuapp.com/youtube/onelive?maxResults=10', 
    success:... 

```

---

<div class="post-metadata">

**Author:** ![anjisvj](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/anjisvj/32/9_2.png) [@anjisvj](https://sef.discourse.group/u/anjisvj)\
**Post date:** [April 5, 2020, 8:35am UTC](https://sef.discourse.group/t/displaying-past-onelives-on-the-website/18/21 "2020-04-05T08:35:53Z")

</div>

oh that’s great.I’ll try it. thanks @jaye 🤩

[Next page](https://sef.discourse.group/t/displaying-past-onelives-on-the-website/18.md?page=2)
