Hallo Forum,
vorab erstmal ein großes Lob an das Forum, ich lese hier schon seit einer gewissen Zeit mit und habe hier schon jede Menge
hilfreiche Threads gefunden.
Nun habe ich allerdings ein Problem, zu dem ich keinen passenden Post gefunden habe.
Daher hier mein Problem: Ich möchte in einer VB Form Informationen eines Youtube-Videos aus einer XML-Datei auslesen. Dazu nutze ich MSXML2, was auch eigentlich in der Vergangenheit gut geklappt hat, aber leider nicht bei meinem aktuellen Vorhaben.
Die XML sieht so aus:
Und so sieht meine VB Abfrage aus:
Leider ohne Erfolg. Weder der Titel des Videos noch etwas anderes wird mir ausgegeben.
Über Eure Hilfe würde ich mich freuen und bedanke mich schon einmal in Vorraus!
vorab erstmal ein großes Lob an das Forum, ich lese hier schon seit einer gewissen Zeit mit und habe hier schon jede Menge
hilfreiche Threads gefunden.
Nun habe ich allerdings ein Problem, zu dem ich keinen passenden Post gefunden habe.
Daher hier mein Problem: Ich möchte in einer VB Form Informationen eines Youtube-Videos aus einer XML-Datei auslesen. Dazu nutze ich MSXML2, was auch eigentlich in der Vergangenheit gut geklappt hat, aber leider nicht bei meinem aktuellen Vorhaben.
Die XML sieht so aus:
XML-Quellcode
- <?xml version='1.0' encoding='UTF-8'?>
- <feed xmlns='http://www.w3.org/2005/Atom' xmlns:media='http://search.yahoo.com/mrss/' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:gd='http://schemas.google.com/g/2005' xmlns:yt='http://gdata.youtube.com/schemas/2007'>
- <id>http://gdata.youtube.com/feeds/api/videos</id>
- <updated>2013-03-07T22:24:47.964Z</updated>
- <category scheme='http://schemas.google.com/g/2005#kind' term='http://gdata.youtube.com/schemas/2007#video'/>
- <title type='text'>Videos matching: cPGL4pUbBls</title>
- <logo>http://www.youtube.com/img/pic_youtubelogo_123x63.gif</logo>
- <link rel='alternate' type='text/html' href='http://www.youtube.com'/>
- <link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/videos'/>
- <link rel='http://schemas.google.com/g/2005#batch' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/videos/batch'/>
- <link rel='self' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/videos?q=cPGL4pUbBls&start-index=1&max-results=25'/>
- <author>
- <name>YouTube</name>
- <uri>http://www.youtube.com/</uri>
- </author>
- <generator version='2.1' uri='http://gdata.youtube.com'>YouTube data API</generator>
- <openSearch:totalResults>1</openSearch:totalResults>
- <openSearch:startIndex>1</openSearch:startIndex>
- <openSearch:itemsPerPage>25</openSearch:itemsPerPage>
- <entry>
- <id>http://gdata.youtube.com/feeds/api/videos/cPGL4pUbBls</id>
- <published>2011-01-15T18:14:54.000Z</published>
- <updated>2013-02-19T17:24:31.000Z</updated>
- <category scheme='http://schemas.google.com/g/2005#kind' term='http://gdata.youtube.com/schemas/2007#video'/>
- <category scheme='http://gdata.youtube.com/schemas/2007/categories.cat' term='Sports' label='Sport'/>
- <title type='text'>Tor des Jahres 2010</title>
- <content type='text'>... aus der Sportschau vom 15.01.2011</content>
- <link rel='alternate' type='text/html' href='http://www.youtube.com/watch?v=cPGL4pUbBls&feature=youtube_gdata'/>
- <link rel='http://gdata.youtube.com/schemas/2007#video.responses' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/videos/cPGL4pUbBls/responses'/>
- <link rel='http://gdata.youtube.com/schemas/2007#video.related' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/videos/cPGL4pUbBls/related'/>
- <link rel='http://gdata.youtube.com/schemas/2007#mobile' type='text/html' href='http://m.youtube.com/details?v=cPGL4pUbBls'/>
- <link rel='self' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/videos/cPGL4pUbBls'/>
- <author>
- <name>schneand</name>
- <uri>http://gdata.youtube.com/feeds/api/users/schneand</uri>
- </author>
- <gd:comments>
- <gd:feedLink rel='http://gdata.youtube.com/schemas/2007#comments' href='http://gdata.youtube.com/feeds/api/videos/cPGL4pUbBls/comments' countHint='150'/></gd:comments>
- <media:group>
- <media:category label='Sport' scheme='http://gdata.youtube.com/schemas/2007/categories.cat'>Sports</media:category>
- <media:content url='http://www.youtube.com/v/cPGL4pUbBls?version=3&f=videos&app=youtube_gdata' type='application/x-shockwave-flash' medium='video' isDefault='true' expression='full' duration='147' yt:format='5'/>
- <media:content url='rtsp://v7.cache7.c.youtube.com/CiILENy73wIaGQlbBhuV4ovxcBMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp' type='video/3gpp' medium='video' expression='full' duration='147' yt:format='1'/>
- <media:content url='rtsp://v7.cache7.c.youtube.com/CiILENy73wIaGQlbBhuV4ovxcBMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp' type='video/3gpp' medium='video' expression='full' duration='147' yt:format='6'/>
- <media:description type='plain'>... aus der Sportschau vom 15.01.2011</media:description>
- <media:keywords/>
- <media:player url='http://www.youtube.com/watch?v=cPGL4pUbBls&feature=youtube_gdata_player'/>
- <media:thumbnail url='http://i.ytimg.com/vi/cPGL4pUbBls/0.jpg' height='360' width='480' time='00:01:13.500'/>
- <media:thumbnail url='http://i.ytimg.com/vi/cPGL4pUbBls/1.jpg' height='90' width='120' time='00:00:36.750'/>
- <media:thumbnail url='http://i.ytimg.com/vi/cPGL4pUbBls/2.jpg' height='90' width='120' time='00:01:13.500'/>
- <media:thumbnail url='http://i.ytimg.com/vi/cPGL4pUbBls/3.jpg' height='90' width='120' time='00:01:50.250'/>
- <media:title type='plain'>Tor des Jahres 2010</media:title><yt:duration seconds='147'/></media:group>
- <gd:rating average='4.3714285' max='5' min='1' numRaters='70' rel='http://schemas.google.com/g/2005#overall'/>
- <yt:statistics favoriteCount='0' viewCount='96487'/>
- </entry>
- </feed>
Und so sieht meine VB Abfrage aus:
Quellcode
- Private Sub btnTitel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTitel.Click
- Dim objDoc As MSXML2.DOMDocument
- Dim objNodeList As IXMLDOMNodeList
- Dim objNode As IXMLDOMNode
- Dim strXML As String
- strXML = "http://gdata.youtube.com/feeds/api/videos?q=cPGL4pUbBls"
- 'Erstellen und Laden des XML Dokuments
- objDoc = New MSXML2.DOMDocument
- objDoc.async = False
- objDoc.load(strXML)
- 'Alle Einträge der Klasse title type='text' erkennen
- objNodeList = objDoc.selectNodes("//media:title")
- For Each objNode In objNodeList
- MsgBox(objNode.text)
- Next objNode
- objNodeList = Nothing
- objDoc = Nothing
- End Sub
Leider ohne Erfolg. Weder der Titel des Videos noch etwas anderes wird mir ausgegeben.
Über Eure Hilfe würde ich mich freuen und bedanke mich schon einmal in Vorraus!