PDC2008 Quick Video Link List (Updated: Now with Keynotes)
Last List Update: 11/8/2008 @ 2:20 PM PST (Catalog/List now based on Channel9 RSS feed, which resulted in 9 new entries, including the Keynotes! ;)
Past Update: 11/1/2008 @ 11:25 AM PDT (Fixed MP4, ZIP link issues and now with links, on titles, to the very cool Channel 9 PDC2008 pages)
Because I’m lazy (err… I mean… um… efficient with my time? Yeah… that) I wanted an easier way to get at all the videos for PDC2008. So being a developer, I reverse engineered the PDC video page and hacked together a quick and dirty list of Session and related video/pptx links. ;)
Please note that some of these links may not yet work, may never work, may be changed by Microsoft at any time, YMMV, etc, etc, etc. If it doesn’t work, please try accessing the session via the “one true source.”
Quick Video List, sort by Title (as of 11/8/2008 @ 2:20 PM PST)
Source
It seems that many of the other links (MP4, Zune, Zip, etc) are not yet live, so I’ve not included them (yet). one thing I might add is to ping each URL to see if it returns a 404 or not.. but that’s for later.
Here’s the code I used (see I told you it was quick and dirty… yes, I know I need to learn to use Linq better…). The majority of the magic is done through my fav HTML parsing tool the HTML Agility Pack.
Public Class MainForm
Private Sub BuildListButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BuildListButton.Click
Dim htmWeb As New HtmlAgilityPack.HtmlWeb
Dim htmDoc As HtmlAgilityPack.HtmlDocument = htmWeb.Load(CatalogTextBox.Text)
Dim links As HtmlAgilityPack.HtmlNodeCollection = htmDoc.DocumentNode.SelectNodes("//div[@class='title']")
Dim ls = New Generic.List(Of HtmlAgilityPack.HtmlNode)
For Each link As HtmlAgilityPack.HtmlNode In links
ls.Add(link)
Next
Dim q = From link In ls Order By link.InnerText
Dim sb = New System.Text.StringBuilder
sb.Append("<html><body>")
sb.Append("<table>")
sb.Append(GetHeader())
For Each link As HtmlAgilityPack.HtmlNode In q
sb.Append("<tr>")
Dim title = link.InnerText
Dim code = title.Substring(0, title.IndexOf(" "c))
If Not code.Contains("-") Then
sb.Append("<td>")
sb.Append(title)
sb.Append("</td>")
sb.AppendLine(GetVideoLinks(code))
End If
sb.Append("</tr>")
Next
sb.Append("</table>")
sb.Append("</body></html>")
WebBrowser1.DocumentText = sb.ToString
End Sub
Private Function GetVideoLinks(ByVal code As String) As String
Dim sb = New System.Text.StringBuilder
If WMVHQCheckBox.Checked Then
sb.AppendLine(GetVideoLink("http://mschnlnine.vo.llnwd.net/d1/pdc08/WMV-HQ/", code, "wmv", "WMV-HQ"))
End If
If WMVCheckBox.Checked Then
sb.AppendLine(GetVideoLink("http://mschnlnine.vo.llnwd.net/d1/pdc08/WMV/", code, "wmv", "WMV"))
End If
If ZuneCheckBox.Checked Then
sb.AppendLine(GetVideoLink("http://mschnlnine.vo.llnwd.net/d1/pdc08/ZUNE/", code, "wmv", "Zune"))
End If
If MP4CheckBox.Checked Then
sb.AppendLine(GetVideoLink("http://mschnlnine.vo.llnwd.net/d1/pdc08/MP4/", code, "mp4", "MP4"))
End If
If ZIPCheckBox.Checked Then
sb.AppendLine(GetVideoLink("http://mschnlnine.vo.llnwd.net/d1/pdc08/ZIP/", code, "ZIP", "ZIP"))
End If
If PPTXCheckBox.Checked Then
sb.AppendLine(GetVideoLink("http://mschnlnine.vo.llnwd.net/d1/pdc08/PPTX/", code, "pptx", "PPTX"))
End If
Return sb.ToString
End Function
Private Function GetHeader() As String
Dim sb = New System.Text.StringBuilder
sb.Append("<thead>")
sb.Append("<tr>")
sb.Append("<th width=0>")
sb.Append("Title")
sb.Append("</th>")
If WMVHQCheckBox.Checked Then
sb.Append("<th width=60>")
sb.Append("WMV-HQ")
sb.Append("</th>")
End If
If WMVCheckBox.Checked Then
sb.Append("<th>")
sb.Append("WMV")
sb.Append("</th>")
End If
If ZuneCheckBox.Checked Then
sb.Append("<th>")
sb.Append("Zune")
sb.Append("</th>")
End If
If MP4CheckBox.Checked Then
sb.Append("<th>")
sb.Append("MP4")
sb.Append("</th>")
End If
If ZIPCheckBox.Checked Then
sb.Append("<th>")
sb.Append("ZIP")
sb.Append("</th>")
End If
If PPTXCheckBox.Checked Then
sb.Append("<th>")
sb.Append("PPTX")
sb.Append("</th>")
End If
sb.Append("</tr>")
sb.Append("</thead>")
Return sb.ToString
End Function
Private Function GetVideoLink(ByVal URLPrefix As String, ByVal code As String, ByVal extension As String, ByVal name As String) As String
Dim sb = New System.Text.StringBuilder
sb.Append("<td>")
sb.Append("<a href=")
sb.Append(Chr(34))
sb.Append(URLPrefix)
sb.Append(code)
sb.Append(".")
sb.Append(extension)
sb.Append(Chr(34))
sb.Append(">")
sb.Append(name)
sb.Append("</a>")
sb.Append("</td>")
Return sb.ToString
End Function
End Class
Update #1 10/31/2008 @8:00AM PDT:
Link verification added to the code and the list updated. So now only those links that do not return a 404 are active.
Here’s the updated code:
Private Function GetVideoLink(ByVal URLPrefix As String, ByVal code As String, ByVal extension As String, ByVal name As String) As String
Dim sb = New System.Text.StringBuilder
Dim url = URLPrefix & code & "." & extension
sb.Append("<td>")
If PageExists(url) Then
sb.Append("<a href=")
sb.Append(Chr(34))
sb.Append(url)
sb.Append(Chr(34))
sb.Append(">")
sb.Append(name)
sb.Append("</a>")
Else
sb.Append("N/A")
End If
sb.Append("</td>")
Return sb.ToString
End Function
Private Function PageExists(ByVal URL As String) As Boolean
'Code leached and converted from http://blogs.microsoft.co.il/blogs/dorr/archive/2008/09/02/how-to-check-if-a-file-exists-over-http.aspx
Try
Dim request = System.Net.HttpWebRequest.Create(URL)
request.Method = "HEAD" ' Just get the document headers, not the data.
request.Credentials = System.Net.CredentialCache.DefaultCredentials
'This may throw a WebException:
Using response As System.Net.HttpWebResponse = CType(request.GetResponse(), System.Net.HttpWebResponse)
If response.StatusCode = System.Net.HttpStatusCode.OK Then
Return True
Else
Return False
End If
End Using
Catch ex As System.Net.WebException
Dim webResponse As System.Net.HttpWebResponse = CType(ex.Response, System.Net.HttpWebResponse)
'// Determine the cause of the exception, was it 404?
If webResponse.StatusCode = System.Net.HttpStatusCode.NotFound Then
Return False
End If
End Try
End Function
Update #2 11/1/2008 @10:50AM PDT:
Fixed an casing issue for MP4’s (Should have been “…d1/pdc08/MP4/” and not “…d1/pdc08/mp4/”)
Fixed an casing issue for ZIP’s (The file extension should have been ".ZIP” and not “.zip”)
Added links on the titles to the very cool Channel 9 PDC2008 page for the given session.
Update #3 11/2/2008 @9:00AM PST:
The source has been uploaded to a new CodePlex project, PDC Resource List Maker.
Please use it responsibly…
Update #4 11/8/2008 @9:00AM PST:
Updated to use the Channel9 RSS Feed, which resulted in 9 additional rows, including the Keynotes.