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!-MattOn 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 PerosiCorporate ConsultantMobile Marketing ExpertSenior Web DeveloperSEO Analyst& EducatorPsi Prime, Inc.323 Union Blvd.Totowa, NJ 07512Service: 973.413.8211Training: 973.413.8214Fax: 973.413.8217http://www.perosi.com
Associated Messages, from the most recent to the oldest:
|
- Re: [WebDNA] API - YouTube ("Psi Prime Inc, Matthew A Perosi " 2011)
- [WebDNA] API - YouTube (David Bastedo 2011)
|
Wow!Great stuff David!-MattOn 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 PerosiCorporate ConsultantMobile Marketing ExpertSenior Web DeveloperSEO Analyst& EducatorPsi Prime, Inc.323 Union Blvd.Totowa, NJ 07512Service: 973.413.8211Training: 973.413.8214Fax: 973.413.8217http://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:
Problems setting MIME Headers (1998)
[WebDNA] Variable mystery (2009)
Urgent help needed (1998)
Return records from another (1997)
Wanted webcatalog coder to build 4 stores (2005)
same products but different (1998)
WC 2.0 frames feature (1997)
Protect Tage and Groups (1998)
Another question (1997)
Items XX to XX shown (1997)
SendMail on OS X (2003)
[WebDNA] SCOPE:, ---- was:--- Date: header on emails - timezone problem perhaps (emai)
storing javascript variables (2005)
Emailer again (1997)
WebCommerce: Folder organization ? (1997)
WebCat2 several catalogs? (1997)
Re1000001: Setting up shop (1997)
[WebDNA] WebDNA 8.6 announced - New features (2018)
Bulletin Board.... (2000)
Help! WebCat2 bug (1997)