Basically i am trying to create a MP plugin to accommodate BBC iPlayer, then download and viewing of the higher quality x264 encodes.
I am following this guide here to download a video via a web request: linky!
But I get an error in the headers instead of a redirect and I'm assuming i am doing something wrong.
What I should be getting is a message box of a header which has a redirect in it. I have checked and the header data i start with is not incorrect, as far as i can see.
I am working in C#, but rewrote it in VB as there is more chance of getting a response that way as VB programmers can try.......
If you are going to try out the code, you need to be from the UK as BBC only lets UK viewers watch the streams. I was hoping people could notice what was wrong without actually running the code though.
Thanks.
I am following this guide here to download a video via a web request: linky!
But I get an error in the headers instead of a redirect and I'm assuming i am doing something wrong.
What I should be getting is a message box of a header which has a redirect in it. I have checked and the header data i start with is not incorrect, as far as i can see.
I am working in C#, but rewrote it in VB as there is more chance of getting a response that way as VB programmers can try.......
If you are going to try out the code, you need to be from the UK as BBC only lets UK viewers watch the streams. I was hoping people could notice what was wrong without actually running the code though.
Code:
Imports System.Net
Imports System.Text.RegularExpressions
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
GetVideoLink("b00c0cd1")
End Sub
Private Sub GetVideoLink(ByVal ProgramID As String)
Dim WebRequest1 As HttpWebRequest = WebRequest.Create("http://www.bbc.co.uk/iplayer/page/item/" & ProgramID & ".shtml")
WebRequest1.UserAgent = "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3"
Dim WebResponse1 As HttpWebResponse = WebRequest1.GetResponse()
Dim CookieData As String = Regex.Match(WebResponse1.Headers.ToString(), "Set-Cookie: (.+?);").Groups(1).Value.ToString()
WebResponse1.Close()
Dim rnd As Random = New Random()
Dim WebRequest2 As HttpWebRequest = WebRequest.Create("http://www.bbc.co.uk/mediaselector/3/auth/iplayer_streaming_http_mp4/" & ProgramID & "?" & rnd.Next(0, 1000000).ToString())
WebRequest2.AllowAutoRedirect = False
WebRequest2.Accept = "*/*"
WebRequest2.Headers.Set(HttpRequestHeader.Cookie, CookieData)
WebRequest2.UserAgent = "Apple iPhone v1.1.4 CoreMedia v1.0.0.4A102"
WebRequest2.KeepAlive = False
WebRequest2.AddRange(0, 1)
Dim WebResponse2 As HttpWebResponse = WebRequest2.GetResponse()
MessageBox.Show(WebResponse2.Headers.ToString())
WebResponse2.Close()
End Sub
End Class
Thanks.