youtube video

 i have an application where users can add videos by just giving the youtube URL of the video.. i extract the video id from the URL and generate the embed code accordingly.. that is working..

but i want to display the number of views and youtube rating in my application.. is that possible?? i think youtube doesnt have a .NET api yet..

0
koolprogrammer
6/18/2008 11:42:34 PM
asp.net.free-for-all 9281 articles. 0 followers. Follow

5 Replies
674 Views

Similar Articles

[PageSpeed] 46

 Hi,

There is nothing like youtube .net API or php API.. APIs are basically general meant to use in any programmingt languages and platforms.. They just give back XML results according to that standard requests..

By Youtube .Net api you may be referring to API wrappers for .Net. There are some unoffical ones available online. You can just do  google search and find it.. But I think you can simply use the general youtube APIs using .Net HttpWebRequest..

Here is the sample source code to get  all the details about a video in Youtube

 HttpWebRequest request = WebRequest.Create("http://gdata.youtube.com/feeds/api/videos/beZbEzP5LJI") as HttpWebRequest;
        // Get response 
        using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
        {
            // Load data into a dataset 
            DataSet ds = new DataSet();
            ds.ReadXml(response.GetResponseStream());  //now you have all the details for video beZbEzP5LJI inside the dataset ds...

//the details  will be put in different datatables.. you can see the data by using Dataset Visualizer.. and now get the data from here..

}
 

 
 


If this post was useful to you, please mark it as answer.

ClientSideAsp.Net | Blog
0
anzer
6/21/2008 11:29:54 AM

 hi anzer.. thanx for your response.. i made it to work with using xml nodes from the feed using the following code.. but when i saw ur code using DataSet it seemed easier and i tried it out but i got an error.. code is given below..

USING XML


        XmlDocument XmlDocObject = new XmlDocument();
        XmlDocObject.Load("http://gdata.youtube.com/feeds/api/videos/0gT2g2n9v60");

        XmlNamespaceManager nsmgr = new XmlNamespaceManager(XmlDocObject.NameTable);
        nsmgr.AddNamespace("ent", "http://www.w3.org/2005/Atom");
        nsmgr.AddNamespace("gd", "http://schemas.google.com/g/2005");
        nsmgr.AddNamespace("yt", "http://gdata.youtube.com/schemas/2007");

        XmlNode title = XmlDocObject.SelectSingleNode("//ent:title", nsmgr);
        XmlNode content = XmlDocObject.SelectSingleNode("//ent:content", nsmgr);
        XmlNode name = XmlDocObject.SelectSingleNode("//ent:name", nsmgr);
        XmlNode rating = XmlDocObject.SelectSingleNode("//gd:rating", nsmgr);
        XmlNode statistics = XmlDocObject.SelectSingleNode("//yt:statistics", nsmgr);

        Response.Write("Title : " + title.InnerXml);
        Response.Write("<br>");
        Response.Write("<br>");
        Response.Write("Content : " + content.InnerXml.Replace("\r\n", "<br>"));
        Response.Write("<br>");
        Response.Write("<br>");
        Response.Write("Author : " + name.InnerXml);
        Response.Write("<br>");
        Response.Write("<br>");
        Response.Write("Number of raters : " + rating.Attributes.GetNamedItem("numRaters").Value);
        Response.Write("<br>");
        Response.Write("Average rating : " + rating.Attributes.GetNamedItem("average").Value);
        Response.Write("<br>");
        Response.Write("<br>");
        Response.Write("View Count : " + statistics.Attributes.GetNamedItem("viewCount").Value);
 

USING DATASET


        HttpWebRequest request = WebRequest.Create("http://gdata.youtube.com/feeds/api/videos/0gT2g2n9v60") as HttpWebRequest;
       
        using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
        {
            DataSet ds = new DataSet();
            ds.ReadXml(response.GetResponseStream());

            DataTable Title = ds.Tables["title"];
            DataTable Content = ds.Tables["content"];
            DataTable Rating = ds.Tables["rating"];
            DataTable Statistics = ds.Tables["statistics"];
            DataTable Feedlink = ds.Tables["feedlink"];

            Response.Write("Title : " + Title.Rows[0]["title_Text"]);
            Response.Write("<br>");
            Response.Write("Content : " + Content.Rows[0]["content_Text"]);
            Response.Write("<br>");
            Response.Write("Average rating : " + Rating.Rows[0]["average"]);
            Response.Write("<br>");
            Response.Write("Number of raters : " + Rating.Rows[0]["numRaters"]);
            Response.Write("<br>");
            Response.Write("View Count : " + Statistics.Rows[0]["viewCount"]);

        }

The given name 'title' matches at least two names in the collection object with different namespaces.

there are two nodes with the name title.. one in the default namespace and one in media..

<title type=\"text\">Jackson Jerry - Michael Jackson impersonator Smooth Criminal</title>

<media:title type=\"plain\">Jackson Jerry - Michael Jackson impersonator Smooth Criminal</media:title>

 there 2 are seen as 2 DataTables with the same name "title" when i used the DataVisualiser.. how can i seperate these 2?

0
koolprogrammer
6/22/2008 7:57:32 PM

Sorry am not sure how to separate those data tables with same name.. actually i too about post a query in this forum regarding that ;)

Please post it here if you find out some method  to seperate it..

 

 


If this post was useful to you, please mark it as answer.

ClientSideAsp.Net | Blog
0
anzer
6/23/2008 5:23:56 AM

Hi,
It seems like we have to use XSLT  to seperate the datatables.. Please check this blog http://idunno.org/archive/2005/06/24/207.aspx

Here the autor is seperating to columns with same name using XSLT. I think we can use simlar method to seperate datatables.

I am also trying to do the same thing so if you are successful please post it here. 


If this post was useful to you, please mark it as answer.

ClientSideAsp.Net | Blog
0
anzer
6/25/2008 6:41:43 AM

 Hi again,

I got a work around for this problem... There is a property Namespace in datatable we can use that 

See my sample code 

DataTable dtTitle=new DataTable();
            foreach (DataTable dt in dsWeather.Tables)
            {
                //Response.Write(dt.Namespace + " --- " + dt.TableName + "<br />");
                //we can use the dt.Namespace field to seperate the datatables
                //but in our case since both datatable has same data we can just grab the first one
                if (dt.TableName.ToLower() == "title")
                {
                    dtTitle = dt;
                    break;
                }
            }


If this post was useful to you, please mark it as answer.

ClientSideAsp.Net | Blog
0
anzer
6/25/2008 7:13:10 AM
Reply:

Similar Artilces:

(VIDEO SERVICES | VIDEO MIX | VIDEO CHAT | VIDEO CHANNELS | VIDEO CONFERENCE | VIDEO DATING | ONLINE VIDEO CHAT) on Mixmir.net .
Name: mixerok Email: superadikdotvatgmaildotcom Product: eBay Companion Summary: (VIDEO SERVICES | VIDEO MIX | VIDEO CHAT | VIDEO CHANNELS | VIDEO CONFERENCE | VIDEO DATING | ONLINE VIDEO CHAT) on Mixmir.net . Comments: Hello !! Here are found online video chat Mixmir.net !!! <url = http://www.mixmir.net/videomix/conference/index.php> Direct Link </ url> While !! And who wants is www dating <url = http://www.mixmir.net/dating/index.php> dating free </ url> ... As well Directory of useful sites <url = http://www.mixmir...

(VIDEO SERVICES | VIDEO MIX | VIDEO CHAT | VIDEO CHANNELS | VIDEO CONFERENCE | VIDEO DATING | ONLINE VIDEO CHAT) on Mixmir.net !!
Name: mixerok Email: superadikdotvatgmaildotcom Product: eBay Companion Summary: (VIDEO SERVICES | VIDEO MIX | VIDEO CHAT | VIDEO CHANNELS | VIDEO CONFERENCE | VIDEO DATING | ONLINE VIDEO CHAT) on Mixmir.net !! Comments: Hello ! Here are found watch live broadcast tv Mixmir.net !! <url = http://www.mixmir.net/videomix/index.php> Internet Path </ url> Success !! As well is dating men <url = http://www.mixmir.net/dating/index.php> Want to make new friends? </ url> ... And who should be there Web Directory <url = http:...

Free .Net Training Videos
www.technicalvideos.net now has over 200 .Net, SQl Server and Flash training videos. Please checkout our free videos section and let us know what you think. If you like what you see you can get acess to all videos for $19.99 Hi, I tried the first of your free tutorials. The first time I saw a tutorial I didn't like the video quality because I couldn't read the text clearly. But this happened when I sized media player to full screen. When I leave the video in a smaller window it shows quite nicely. Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Workaround for non...

Download Free .Net Training Video
I have provided a new free Sample video on www.TechnicalVideos.net. If you get a few free minutes please check it out and let me know what you think Doesn't look bad. I only wished the video was full screen so I could read the text more clearly and I had to turn open my volume quite a lot. Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Workaround for non working Mark as answer buttons. I just watched the video full screen, you must have a diff screen resolution, I use 1280 by 1024. Also you are right the sound is a little low on that video for some reason, most of th...

Free Visual Basic.NET videos
Free Visual Basic.NET videos at http://www.vbdotnet.somee.com...

DOWNLOAD site:masexo.net ONLY HERE. FREE VIDEO
Name: biggace Email: fimDEGHIKLNPTatmaildotru Product: eBay Companion Summary: DOWNLOAD site:masexo.net ONLY HERE. FREE VIDEO Comments: http://nhnthfjk.freehostingz.com/123.html http://nhnthfjk.freehostingz.com/293.html http://nhnthfjk.freehostingz.com/191.html http://nhnthfjk.freehostingz.com/41.html http://nhnthfjk.freehostingz.com/297.html http://nhnthfjk.freehostingz.com/38.html http://nhnthfjk.freehostingz.com/376.html http://nhnthfjk.freehostingz.com/281.html http://nhnthfjk.freehostingz.com/111.html http://nhnthfjk.freehostingz.com/249.html http://nhnthfjk.freehostingz.com/...

Free Visual Basic.NET new videos
Free Visual Basic.NET new videos at http://www.vbdotnet.somee.com...

Recommend free Youtube video downloader for Win7
Subject. Any recommendations? I tried Source Forge's, but I don't think it's suitable for Win7. On Sat, Jun 4, 2011 at 10:04 PM, W. eWatson <wolftracks@invalid.com> wrote: > Subject. Any recommendations? I tried Source Forge's, but I don't think > it's suitable for Win7. > Not exactly FF related, but I like JDownloader -- have it running, copy a youtube link, and it'll give you a slew of options: Different quality downloads, different file formats, even save just the audio as a MP3. Plus it works great for other download sites too....

4 Free .Net and SQL Server training videos posted on our site
www.TechnicalVideos.Net now offers 4 free .Net and SQL Server traing videos on our site. A full membership is only $19.99. With that you get 100's of videos. Feel free to down load them and let us know what you think. ...

Free .Net and Sql Server Training Videos for Developers just getting started
I figured since this is the Getting started forum I would mention a great .Net training video site with some free videos.http://www.TechnicalVideos.netThanksMike James...

Problem with flash videos/youtube videos
Name: Ciaran Cullen Product: Firefox Summary: Problem with flash videos/youtube videos Comments: I have an intermittent problem playing flash videos. I'm running; Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b4) Gecko/20090423 Firefox/3.5b4 If I open a web page such as www.youtube.com, www.bestofyoutube.com or www.break.com a flash video will appear, ready to be played. But I can't click on the play button. It's as if the mouse clicks don't register at all with the flash video transport buttons. It works eventually after many repeated clicks...

youtube videos unable to play some videos
Name: virgoptrex Email: virgoptrexatyahoodotcom Product: Firefox Summary: youtube videos unable to play some videos Comments: I can play all Youtube videos in IE while some of the same videos that work well in IE don't work at all in Firefox. :( Browser Details: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1b4) Gecko/20090423 Firefox/3.5b4 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the sender for them to see it. ...

Free TV online Free Videos online TV 4 FREE Multi Language www.tv4free.org
Name: tvfreeorga Email: dsa32434aatgmaildotcom Product: eBay Companion Summary: Free TV online Free Videos online TV 4 FREE Multi Language www.tv4free.org Comments: Titta pa Tv online datorn Gratis,over 5000 kanaler och miljontals videor,animeringar videor online,business videor online,komedi videor online,dokumentarer videor online,underhallning videor online,film videor online,musik videor online,nyheter videor online,film videor online,sport videor online,fotboll videor online,fotboll live,fotboll tv online. <a href=http://www.tv4free.org>Tv Gratis</a> F...

Free TV online Free Videos online TV 4 FREE Multi Language www.tv4free.org #2
Name: tvfreeorga Email: ruthmacndas31atgmaildotcom Product: eBay Companion Summary: Free TV online Free Videos online TV 4 FREE Multi Language www.tv4free.org Comments: Assista Tv online Free no Pc,mais de 5000 canais livres de todo o mundo e milhoes de video como video animacoes,video business,video comedia,video documentarios,video entretenimento,video de film,video de musica,video de notizias en vivo,video de sport en vivo,video de futebol en video y mais tv online de todo le lingue. <a href=http://www.tv4free.org>Online TV</a> From URL: http://en-GB.www...

( Youtube videos)
Name: Michael Product: Firefox Summary: ( Youtube videos) Comments: The Youtubes videos don't are to play by orther hompages I think it's make scipt false Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5 From URL: http://hendrix.mozilla.org/ ...

Web resources about - youtube video - asp.net.free-for-all

YouTube - Wikipedia, the free encyclopedia
The company is based in San Bruno, California , and uses Adobe Flash Video and HTML5 technology to display a wide variety of user-generated and ...

YouTube - Wikipedia, the free encyclopedia
The company is based in San Bruno, California , and uses Adobe Flash Video and HTML5 technology to display a wide variety of user-generated video ...

YouTube - Wikipedia, the free encyclopedia
The site allows users to upload, view, and share videos, and it makes use of Adobe Flash Video and HTML5 technology to display a wide variety ...

YouTube - Broadcast Yourself.
¡Comparte videos con tus amigos, familiares y el mundo!

YouTube Doubler - Mashup Helper
YouTube Doubler: Twice the Fun - Play 2 YouTubes at Once

Youtube Repeat - Repeat and Loop Videos
Repeat and Loop Videos from Youtube

YouTube Repeater - Automatically Play Videos in a Loop!
Type 'repeater' between 'youtube' and '.com' and your video will automatically repeat/replay in a loop. Use a mini player without menus or toolbars. ...

A way to link to a specific part of a youtube video
Is there a way to link to a specific part of a YouTube video? Yes.

YouTube - Broadcast Yourself.
Bagi video Anda dengan teman, keluarga, dan dunia

YouTube Converter. Download Free YouTube Converter.
❶ ★★★★★ YouTube Converter is a brand new unique entertainment program allowing any user to convert youtube videos from the largest and most popular ...

Resources last updated: 1/21/2016 5:30:47 AM