html - Get First Vid From Youtube VB.NET -


im trying first youtube link youtube or google can't work. can please me out?

dim m new regex("<a href=""/watch?v=.*""")

dim request2 system.net.httpwebrequest = system.net.httpwebrequest.create("https://www.youtube.com/results?search_query=" + listbox1.selecteditem + " " + listbox2.selecteditem)

dim responseyoutube system.net.httpwebresponse = request2.getresponse textbox2.text = (request2.address.tostring) dim sr system.io.streamreader = new system.io.streamreader(responseyoutube.getresponsestream()) dim rssourcecodey string = sr.readtoend dim matches matchcollection = m.matches(rssourcecodey) textbox1.text = rssourcecodey each itemcode2 match in matches youtube = itemcode2.value.split("=").getvalue(1) listbox2.items.add(youtube)

? special meta char in regex makes previous token optional 1 (not 1 after * or +). need escape ? symbol in-order match literal ? symbol.

dim m new regex("<a href=""/watch[?]v=.*""") 

or

dim m new regex("<a href=""/watch\\?v=.*""") 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -