1

I would like to programatically get straming URL to this video. The page uses JWPlayer, but there is no URL in the source coe.

I figured out that the URL for this particular video would be http://photon.trollvid.net/videos/076b127c.mp4, but I have no idea how to get the &st parameter. I'm using c# with html agility pack What should I do?

John Conde
  • 217,595
  • 99
  • 455
  • 496
Chiro
  • 47
  • 1
  • 8

1 Answers1

2
HttpClient client = new HttpClient();
var html = await client.GetStringAsync(url);

//result is in atob('....') as base64 encoded....
var base64 = Regex.Match(html, @"atob\(\'(.+?)\'\)").Groups[1].Value;
//make enough '=' padding
base64 = base64.PadRight(base64.Length + (4 - base64.Length % 4) % 4, '=');

var buf = Convert.FromBase64String(base64);
var videourl = WebUtility.UrlDecode(Encoding.UTF8.GetString(buf));

Output: http://photon.trollvid.net/videos/076b127c.mp4?st=2G8wyq0wtRqsQVYBzVJW_w&e=1439320535

Eser
  • 12,346
  • 1
  • 22
  • 32
  • This doesn't seem to work. It throws an exception - Exception {"Invalid length for a Base-64 char array or string."} System.Exception {System.FormatException} – Chiro Aug 11 '15 at 17:54
  • Well, I have many videos that are hosted on this site. It works for some, but not for all of them. Worked for episode 1: (previous link) but not for ep 4: http://sv3.trollvid.net/embed.php?file=06a6440f&w=550&h=420&bg=http://www.animestatic.tv/images/animestatic.jpg other links: http://sv3.trollvid.net/embed.php?file=d040a3cb&w=550&h=420&bg=http://www.animestatic.tv/images/animestatic.jpg http://sv3.trollvid.net/embed.php?file=13799329&w=550&h=420&bg=http://www.animestatic.tv/images/animestatic.jpg – Chiro Aug 11 '15 at 18:24
  • Have you uploaded these files to the site? – emaxsaun Aug 11 '15 at 19:15