Ramco Ramco

Ramco Ramco

  • 442
  • 3.4k
  • 528.5k

How to get Video Url + Video

Dec 12 2022 6:14 AM

Hi

  I have below code . In addition to this i want to get Video Url & Video in repeater

        using (var yt = new YouTubeService(new BaseClientService.Initializer()
        {
            ApiKey = "xyz",
        }))
        {
            StringBuilder htmlTable = new StringBuilder();

            var searchRequest = yt.Search.List("snippet");
            searchRequest.ChannelId = "xyz";
            var searchResponse = searchRequest.Execute();
            var objResult = searchResponse.Items.ToList();
            if (objResult != null)
            {
                htmlTable.Append("<table class='table table-bordered table-hover datatable-highlight' id='tbldata'>");

                htmlTable.Append("<thead><tr><th style='display:none'>ChannelTitle</th><th>Title</th><th>Description</th><th>Published</th></tr></thead>");
                htmlTable.Append("<tbody>");
                foreach (var colum in objResult)
                {
                    htmlTable.Append("<tr>");

                    htmlTable.Append("<td >" + colum.Snippet.ChannelTitle + "</td>");
                    htmlTable.Append("<td >" + colum.Snippet.Title + "</td>");
                    htmlTable.Append("<td >" + colum.Snippet.Description + "</td>");
                    htmlTable.Append("<td >" + colum.Snippet.PublishedAt + "</td>");
                    htmlTable.Append("</tr>");
                }
                htmlTable.Append("</tbody>");
                htmlTable.Append("</table>");
                PlaceHolderTable.Controls.Add(new Literal { Text = htmlTable.ToString() });
            }
        }

Thanks


Answers (5)