Re: [WebDNA] API - YouTube

This WebDNA talk-list message is from

2011


It keeps the original formatting.
numero = 106441
interpreted = N
texte = Wow! Great stuff David! -Matt On 3/28/2011 2:29 PM, David Bastedo wrote: > So another unauthenticated call - but this is really powerful - nonetheless. > Again, it's really about what you want to do with data once you have it. > > This example pulls all the data down about every video on a YouTube > Channel. . . . so, say you want to compare videos from two competitors > over time - or keep track of what is happenig to your own videos. > > This will pull down all the stats. Hook it up to a trigger at the same > time every day , and you have a consistent time line of data. This can > be used will all sorts of things. > > I used this to pull down information about videos posted by every > maker car manufacturer as a test case. So all you need is a list of > channels and then to loop through the results. The info comes down in > sets of 50 results, so you need to first get the number of videos, to > set the number of times you have to loop. > > I left the entire thing intact here for you. > > This is again, the basic structure for all YouTube calls. So you need > to change very little to get the information on say one video . . . > > d. > > [text]channelName=[YouTubeChannel][/text] > > [text]MyTestVariable=[!] > [/!][TCPConnect host=gdata.youtube.com][TCPSend skipheader=T]GET > /feeds/api/users/[channelName]/uploads?start-index=1&max-results=50&v=2 > HTTP/1.0[UnURL]%0D%0A[/Unurl]Host: > gdata.youtube.com[UnURL]%0D%0A%0D%0A[/UnURL][/TCPSend] > [/TCPConnect][/text] > > [!]------------[/!] > [xmlparse var=xml_var2][MyTestVariable][/xmlparse] > > MyTestVariable: [MyTestVariable]
> > [!]---------------------------[/!] > > > [xmlnodes ref=xml_var2&path=named:feed&name=openSearch:totalResults] > [text]TotalVideos=[value][/text] > [/xmlnodes] > > > TotalVideos: [TotalVideos]
> channelName: [channelName]
> channelType: [LOOKUP > db=databases/channelType.db&value=[channelName]&lookInField=channelName&returnField=channelType]
> [!]---------------------[/!] > > > [loop start=1&end=[TotalVideos]&advance=50] > > > [text]MyTestVariable=[!] > [/!][TCPConnect host=gdata.youtube.com][TCPSend skipheader=T]GET > /feeds/api/users/[channelName]/uploads?start-index=[index]&max-results=50&v=2 > HTTP/1.0[UnURL]%0D%0A[/Unurl]Host: > gdata.youtube.com[UnURL]%0D%0A%0D%0A[/UnURL][/TCPSend] > [/TCPConnect][/text] > > [xmlparse var=xml_var1][MyTestVariable][/xmlparse] > > > [loop start=1&end=50] > > > [xmlnode ref=xml_var1&path=named:feed/entry([index])/id] > [listwords words=[value]&delimiters=:] > > [showif [index]=4] > [text]theVideoID=[word][/text] > [/showif] > [/listwords] > [/xmlnode] > > > [!]------------- > TheVideoID=[theVideoID]

> ------------[/!] > > [addfields db=databases/videoData.db]dateNum=&channelName=&timeNum=[/addfields] > [replace db=databases/videoData.db&eqvideoIDdatarq=[theVideoID]&eqdateNumdatarq=[date_Num]&eqtimeNumdatarq=[time_num]&append=t]videoID=[theVideoID]&dateNum=[date_num]&channelName=[channelName]&channelType=[channelType]&theCategory=2&timeNum=[time_num][/replace] > > [!]---------------------------------------------- >
--------------------------------
> &eqvideoIDdata=[theVideoID]&eqdateNumdatarq=[date_num]&append=t]videoID=[theVideoID]&dateNum=[date_num]&channelName=[channelName] >
--------------------------------
> ----------------------------------------------[/!] > [addfields db=databases/videoData.db]theCategory=[/addfields] > [xmlnodes ref=xml_var1&path=named:feed/entry([index])] > [addfields db=databases/videoData.db][name]=[/addfields] > > [replace db=databases/videoData.db&eqvideoIDdatarq=[theVideoID]&eqdateNumdatarq=[date_num]&eqtimeNumdatarq=[time_num]&append=t][name]=[url][value][/url]&dateNum=[date_num]&channelName=[channelName]&channelType=[channelType]&theCategory=2&timeNum=[time_num][/replace] > [text]firstNode=[name][/text] > > [!]------------- > -[name]=[value]
> ------------[/!] > > [xmlnodeattributes] > [!]------------- > -- [name]=[value]
> ------------[/!] > > [addfields db=databases/videoData.db][firstNode]_[name]=[/addfields] > [replace db=databases/videoData.db&eqvideoIDdatarq=[theVideoID]&eqdateNumdatarq=[date_num]&eqtimeNumdatarq=[time_num]&append=t][firstNode]_[name]=[url][value][/url]&timeNum=[time_num]&dateNum=[date_num]&channelName=[channelName]&channelType=[channelType]&theCategory=2[/replace] > > [/xmlnodeattributes] > > [xmlnodes] > > [!]------------- > ---[name]=[value]
> ------------[/!] > > [text]firstNodeB=[name][/text] > [addfields db=databases/videoData.db][name]=[/addfields] > [replace db=databases/videoData.db&eqvideoIDdatarq=[theVideoID]&eqdateNumdatarq=[date_num]&eqtimeNumdatarq=[time_num]&append=t][name]=[url][value][/url]&dateNum=[date_num]&channelName=[channelName]&channelType=[channelType]&theCategory=2&timeNum=[time_num][/replace] > [xmlnodeattributes] > > [!]------------- > ----[name]=[value]
> ------------[/!] > > [addfields db=databases/videoData.db][firstNodeB]_[name]=[/addfields] > [replace db=databases/videoData.db&eqvideoIDdatarq=[theVideoID]&eqdateNumdatarq=[date_num]&eqtimeNumdatarq=[time_num]&append=t][firstNodeB]_[name]=[url][value][/url]&dateNum=[date_num]&channelName=[channelName]&channelType=[channelType]&theCategory=2&timeNum=[time_num][/replace] > [/xmlnodeattributes] > > [xmlnodes] > > > [/xmlnodes] > > [/xmlnodes] > > [/xmlnodes] > > > > [/loop] > [/loop] > --------------------------------------------------------- > This message is sent to you because you are subscribed to > the mailing list. > To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us > Bug Reporting: support@webdna.us > > -- Matthew A Perosi Corporate Consultant Mobile Marketing Expert Senior Web Developer SEO Analyst& Educator Psi Prime, Inc. 323 Union Blvd. Totowa, NJ 07512 Service: 973.413.8211 Training: 973.413.8214 Fax: 973.413.8217 http://www.perosi.com Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] API - YouTube ("Psi Prime Inc, Matthew A Perosi " 2011)
  2. [WebDNA] API - YouTube (David Bastedo 2011)
Wow! Great stuff David! -Matt On 3/28/2011 2:29 PM, David Bastedo wrote: > So another unauthenticated call - but this is really powerful - nonetheless. > Again, it's really about what you want to do with data once you have it. > > This example pulls all the data down about every video on a YouTube > Channel. . . . so, say you want to compare videos from two competitors > over time - or keep track of what is happenig to your own videos. > > This will pull down all the stats. Hook it up to a trigger at the same > time every day , and you have a consistent time line of data. This can > be used will all sorts of things. > > I used this to pull down information about videos posted by every > maker car manufacturer as a test case. So all you need is a list of > channels and then to loop through the results. The info comes down in > sets of 50 results, so you need to first get the number of videos, to > set the number of times you have to loop. > > I left the entire thing intact here for you. > > This is again, the basic structure for all YouTube calls. So you need > to change very little to get the information on say one video . . . > > d. > > [text]channelName=[YouTubeChannel][/text] > > [text]MyTestVariable=[!] > [/!][TCPConnect host=gdata.youtube.com][TCPSend skipheader=T]GET > /feeds/api/users/[channelName]/uploads?start-index=1&max-results=50&v=2 > HTTP/1.0[unurl]%0D%0A[/Unurl]Host: > gdata.youtube.com[unurl]%0D%0A%0D%0A[/UnURL][/TCPSend] > [/TCPConnect][/text] > > [!]------------[/!] > [xmlparse var=xml_var2][MyTestVariable][/xmlparse] > > MyTestVariable: [MyTestVariable]
> > [!]---------------------------[/!] > > > [xmlnodes ref=xml_var2&path=named:feed&name=openSearch:totalResults] > [text]TotalVideos=[value][/text] > [/xmlnodes] > > > TotalVideos: [TotalVideos]
> channelName: [channelName]
> channelType: [LOOKUP > db=databases/channelType.db&value=[channelName]&lookInField=channelName&returnField=channelType]
> [!]---------------------[/!] > > > [loop start=1&end=[TotalVideos]&advance=50] > > > [text]MyTestVariable=[!] > [/!][TCPConnect host=gdata.youtube.com][TCPSend skipheader=T]GET > /feeds/api/users/[channelName]/uploads?start-index=[index]&max-results=50&v=2 > HTTP/1.0[unurl]%0D%0A[/Unurl]Host: > gdata.youtube.com[unurl]%0D%0A%0D%0A[/UnURL][/TCPSend] > [/TCPConnect][/text] > > [xmlparse var=xml_var1][MyTestVariable][/xmlparse] > > > [loop start=1&end=50] > > > [xmlnode ref=xml_var1&path=named:feed/entry([index])/id] > [listwords words=[value]&delimiters=:] > > [showif [index]=4] > [text]theVideoID=[word][/text] > [/showif] > [/listwords] > [/xmlnode] > > > [!]------------- > TheVideoID=[theVideoID]

> ------------[/!] > > [addfields db=databases/videoData.db]dateNum=&channelName=&timeNum=[/addfields] > [replace db=databases/videoData.db&eqvideoIDdatarq=[theVideoID]&eqdateNumdatarq=[date_Num]&eqtimeNumdatarq=[time_num]&append=t]videoID=[theVideoID]&dateNum=[date_num]&channelName=[channelName]&channelType=[channelType]&theCategory=2&timeNum=[time_num][/replace] > > [!]---------------------------------------------- >
--------------------------------
> &eqvideoIDdata=[theVideoID]&eqdateNumdatarq=[date_num]&append=t]videoID=[theVideoID]&dateNum=[date_num]&channelName=[channelName] >
--------------------------------
> ----------------------------------------------[/!] > [addfields db=databases/videoData.db]theCategory=[/addfields] > [xmlnodes ref=xml_var1&path=named:feed/entry([index])] > [addfields db=databases/videoData.db][name]=[/addfields] > > [replace db=databases/videoData.db&eqvideoIDdatarq=[theVideoID]&eqdateNumdatarq=[date_num]&eqtimeNumdatarq=[time_num]&append=t][name]=[url][value][/url]&dateNum=[date_num]&channelName=[channelName]&channelType=[channelType]&theCategory=2&timeNum=[time_num][/replace] > [text]firstNode=[name][/text] > > [!]------------- > -[name]=[value]
> ------------[/!] > > [xmlnodeattributes] > [!]------------- > -- [name]=[value]
> ------------[/!] > > [addfields db=databases/videoData.db][firstNode]_[name]=[/addfields] > [replace db=databases/videoData.db&eqvideoIDdatarq=[theVideoID]&eqdateNumdatarq=[date_num]&eqtimeNumdatarq=[time_num]&append=t][firstNode]_[name]=[url][value][/url]&timeNum=[time_num]&dateNum=[date_num]&channelName=[channelName]&channelType=[channelType]&theCategory=2[/replace] > > [/xmlnodeattributes] > > [xmlnodes] > > [!]------------- > ---[name]=[value]
> ------------[/!] > > [text]firstNodeB=[name][/text] > [addfields db=databases/videoData.db][name]=[/addfields] > [replace db=databases/videoData.db&eqvideoIDdatarq=[theVideoID]&eqdateNumdatarq=[date_num]&eqtimeNumdatarq=[time_num]&append=t][name]=[url][value][/url]&dateNum=[date_num]&channelName=[channelName]&channelType=[channelType]&theCategory=2&timeNum=[time_num][/replace] > [xmlnodeattributes] > > [!]------------- > ----[name]=[value]
> ------------[/!] > > [addfields db=databases/videoData.db][firstNodeB]_[name]=[/addfields] > [replace db=databases/videoData.db&eqvideoIDdatarq=[theVideoID]&eqdateNumdatarq=[date_num]&eqtimeNumdatarq=[time_num]&append=t][firstNodeB]_[name]=[url][value][/url]&dateNum=[date_num]&channelName=[channelName]&channelType=[channelType]&theCategory=2&timeNum=[time_num][/replace] > [/xmlnodeattributes] > > [xmlnodes] > > > [/xmlnodes] > > [/xmlnodes] > > [/xmlnodes] > > > > [/loop] > [/loop] > --------------------------------------------------------- > This message is sent to you because you are subscribed to > the mailing list. > To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us > Bug Reporting: support@webdna.us > > -- Matthew A Perosi Corporate Consultant Mobile Marketing Expert Senior Web Developer SEO Analyst& Educator Psi Prime, Inc. 323 Union Blvd. Totowa, NJ 07512 Service: 973.413.8211 Training: 973.413.8214 Fax: 973.413.8217 http://www.perosi.com "Psi Prime Inc, Matthew A Perosi "

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

Possible Bug in 2.0b15.acgi (1997) WebTen? (1997) [shownext] and sort (1998) Looking for easy way to back up dbs... (2003) creator code (1997) Re:Emailer and encryption (1997) SQL on OSX Client (2001) Feature Request: DB Field manipulation (1998) [WebDNA] Webdna and CMS (2012) Special characters in field names (1998) form data submission gets truncated (1997) [FoundItems] solved - thanks (1997) Review comparison by PC Magazine: Open for On-line Business (1997) Summing fields (1997) system crashes, event log (1997) WebCat2b13 Command Reference Doc error (1997) Progress !! WAS: Trouble with formula.db (1997) PSC recommends what date format yr 2000??? (1997) Order file numbers different than the cart number. why? (2000) WebCat & WebTen (1997)