public override string GetVideoUrl(VideoInfo video)
        {
            CookieContainer newCc = new CookieContainer();
            foreach (Cookie c in cc.GetCookies(new Uri(@"https://www.filmon.com/")))
            {
                newCc.Add(c);
            }

            NameValueCollection headers = new NameValueCollection();
            headers.Add("Accept", "*/*");
            headers.Add("User-Agent", userAgent);
            headers.Add("X-Requested-With", "XMLHttpRequest");
            string webdata = GetWebData(video.VideoUrl, (string)video.Other, newCc, headers: headers);

            JToken jt = JObject.Parse(webdata) as JToken;
            JArray streams = jt.Value<JArray>("streams");
            video.PlaybackOptions = new Dictionary<string, string>();
            foreach (JToken stream in streams)
            {
                string serverUrl = stream.Value<string>("url");

                RtmpUrl res = new RtmpUrl(serverUrl);
                res.Live = true;
                res.PlayPath = stream.Value<string>("name");

                int p = serverUrl.IndexOf("live/?id");
                res.App = serverUrl.Substring(p);
                video.PlaybackOptions.Add(stream.Value<string>("quality"), res.ToString());
            }

            return video.PlaybackOptions.First().Value;
        }
        public override string GetVideoUrl(VideoInfo video)
        {
            string webData = GetWebData(video.VideoUrl);

            Match m = regEx_FileUrl.Match(webData);
            if (m.Success)
            {
                string newUrl = m.Groups["m0"].Value + "?authenticity_token=" + HttpUtility.UrlEncode(m.Groups["m1"].Value);
                webData = GetWebData(newUrl);
                m = Regex.Match(webData, @"url:\s\\""(?<url>[^\\]*)\\[^{]*{[^{]*{\\n\s*url:\s\\""[^""]*"",\\n\s*netConnectionUrl:\s\\""(?<netConnectionUrl>[^\\]*)\\""", defaultRegexOptions);
                if (m.Success)
                {
                    string ncUrl = m.Groups["netConnectionUrl"].Value;
                    string[] parts = ncUrl.Split('/');
                    string playPath = parts[4];
                    bool live = webData.Contains("live = true");
                    if (live)
                    {
                        int p = playPath.IndexOf("stream");
                        if (p >= 0) playPath = playPath.Insert(p, "/");
                    }
                    RtmpUrl result = new RtmpUrl(ncUrl)
                    {
                        PlayPath = m.Groups["url"].Value,
                        App = String.Format("{0}/{1}{2}", parts[3], parts[4], m.Groups["m1"].Value),
                        Live = live
                    };
                    return result.ToString();
                }
            }
            return String.Empty;

        }
        public override string GetVideoUrl(VideoInfo video)
        {
            string res = base.GetVideoUrl(video);
            XmlDocument doc = new XmlDocument();
            string[] urlParts = video.VideoUrl.Split('.');

            if (urlParts[1] == "four")
                res = res.Replace("@@", "c4");
            else
                res = res.Replace("@@", "tv3");

            doc.Load(res);

            video.PlaybackOptions = new Dictionary<string, string>();

            string meta_base = @"rtmpe://202.49.175.79/vod/_definst_"; // found with wireshark. apparently value in 
            //meta/base (rtmpe://vod-geo.mediaworks.co.nz/vod/_definst_) is just a decoy

            //old: doc.SelectSingleNode("//smil/head/meta").Attributes["base"].Value;

            foreach (XmlNode node in doc.SelectNodes("//smil/body/switch/video"))
            {
                int bitRate = int.Parse(node.Attributes["system-bitrate"].Value) / 1024;

                RtmpUrl rtmpUrl = new RtmpUrl(meta_base + "/" + node.Attributes["src"].Value)
                {
                    SwfVerify = true,
                    SwfUrl = @"http://static.mediaworks.co.nz/video/jw/6.50/jwplayer.flash.swf"
                };

                video.PlaybackOptions.Add(bitRate.ToString() + "K", rtmpUrl.ToString());
            }

            return video.PlaybackOptions.Last().Value;
        }
 public override string GetVideoUrl(VideoInfo video)
 {
     string res = base.GetVideoUrl(video);
     if (!String.IsNullOrEmpty(res) && res.StartsWith("rtmp:"))
     {
         RtmpUrl theUrl = new RtmpUrl(res);
         int p = res.IndexOf('/', 9);
         int q = res.LastIndexOf('/');
         theUrl.App = res.Substring(p + 1, q - p);
         theUrl.PlayPath = "mp4:" + res.Substring(q + 1);
         return theUrl.ToString();
     }
     return res;
 }
Esempio n. 5
0
        public override string GetVideoUrl(VideoInfo video)
        {

            string url;
            if (!String.IsNullOrEmpty(rtmpurl))
                url = rtmpurl;
            else
                url = base.GetVideoUrl(video);

            if (url.Contains(@"\/"))
            {
                try
                {
                    string deJSONified = JsonConvert.DeserializeObject<string>('"' + url + '"');
                    if (!string.IsNullOrEmpty(deJSONified)) url = deJSONified;
                }
                catch { }
            }

            RtmpUrl theUrl;
            NameValueCollection paramsHash;
            if (url.IndexOf(' ') >= 0)
            {
                string[] urlParts = url.Split(' ');
                theUrl = new RtmpUrl(urlParts[0]);
                paramsHash = HttpUtility.ParseQueryString(urlParts[1]);
            }
            else
            {
                theUrl = new RtmpUrl(url.Split('?')[0]);

                Uri uri = new Uri(url);
                paramsHash = HttpUtility.ParseQueryString(uri.Query);
            }

            string t;

            if ((t = GetValue(app, paramsHash["app"])) != null) theUrl.App = t;
            if ((t = GetValue(tcUrl, paramsHash["tcUrl"])) != null) theUrl.TcUrl = t;
            if ((t = GetValue(playpath, paramsHash["playpath"])) != null) theUrl.PlayPath = t;
            if ((t = GetValue(subscribepath, paramsHash["subscribepath"])) != null) theUrl.Subscribe = t;
            if ((t = GetValue(pageurl, paramsHash["pageurl"])) != null) theUrl.PageUrl = t;
            if ((t = GetValue(swfurl, paramsHash["swfurl"])) != null) theUrl.SwfUrl = t;
            if ((t = GetValue(swfVfy, paramsHash["swfVfy"])) != null) theUrl.SwfVerify = Boolean.Parse(t);
            if ((t = GetValue(live, paramsHash["live"])) != null) theUrl.Live = Boolean.Parse(t);
            if ((t = GetValue(token, paramsHash["token"])) != null) theUrl.Token = t;

            return theUrl.ToString();
        }
        public override string GetVideoUrl(VideoInfo video)
        {
            string webData = GetWebData(video.VideoUrl);
            Match m = Regex.Match(webData, fileUrlRegEx, defaultRegexOptions);
            if (m.Success)
            {
                Match tokenMatch = Regex.Match(webData, @"getJSON\(""(?<url>[^""]*)"",\sfunction", defaultRegexOptions);
                if (tokenMatch.Success)
                {
                    string tokenData = GetWebData(tokenMatch.Groups["url"].Value, referer: video.VideoUrl);
                    JToken token = JToken.Parse(tokenData);

                    RtmpUrl result = new RtmpUrl(deJSON(m.Groups["rtmpurl"].Value));
                    result.PageUrl = video.VideoUrl;
                    result.SwfUrl = deJSON(m.Groups["swfurl"].Value);
                    result.PlayPath = deJSON(m.Groups["playpath"].Value);
                    result.App = "edge/_definst_/?" + deJSON(m.Groups["app"].Value);
                    result.Token = token.Value<string>("token");
                    return result.ToString();
                }
            }
            return String.Empty;
        }
        public override string GetVideoUrl(VideoInfo video)
        {
            JToken videoInfo = GetWebData<JToken>(video.VideoUrl);
            JArray subTitles = videoInfo["media"]["subtitles"] as JArray;
            if (subTitles != null && subTitles.Count > 0)
            {
                try
                {
                    video.SubtitleText = GetWebData(subTitles[0].Value<string>("url"), forceUTF8: true);
                }
                catch
                {
                }
            }

            string papiurl = base.GetVideoUrl(video);

            string data = GetWebData(papiurl);
            byte[] bytes = Convert.FromBase64String(data);
            RijndaelManaged rijndael = new RijndaelManaged();
            byte[] iv = new byte[16];
            Array.Copy(bytes, iv, 16);
            rijndael.IV = iv;
            rijndael.Key = Encoding.ASCII.GetBytes("hjsadf89hk123ghk");
            rijndael.Mode = CipherMode.CFB;
            rijndael.Padding = PaddingMode.Zeros;
            ICryptoTransform decryptor = rijndael.CreateDecryptor(rijndael.Key, rijndael.IV);
            int padLen = 16 - bytes.Length % 16;
            byte[] newbytes = new byte[bytes.Length - 16 + padLen];
            Array.Copy(bytes, 16, newbytes, 0, bytes.Length - 16);
            Array.Clear(newbytes, newbytes.Length - padLen, padLen);
            string result = null;
            using (MemoryStream msDecrypt = new MemoryStream(newbytes))
            {
                using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))
                {
                    using (StreamReader srDecrypt = new StreamReader(csDecrypt))
                    {
                        result = srDecrypt.ReadToEnd();
                        int p = result.IndexOf("</media>");
                        result = result.Substring(0, p + 8);
                    }
                }
            }

            XmlDocument doc = new XmlDocument();
            doc.LoadXml(result);
            XmlNode urlNode = doc.SelectSingleNode("//media/onlineAsset/url");
            string rtmpUrl = urlNode.SelectSingleNode("connect").InnerText;
            string stream = urlNode.SelectSingleNode("stream").InnerText;
            RtmpUrl theUrl = new RtmpUrl(rtmpUrl.Split('?')[0])
            {
                PlayPath = stream,
                SwfUrl = @"http://areena-v3.yle.fi/static/player/1.2.8/flowplayer/flowplayer.commercial-3.2.7-encrypted.swf",
                App = "ondemand?" + rtmpUrl.Split('?')[1],
                PageUrl = video.VideoUrl.Substring(0, video.VideoUrl.Length - 5),
                TcUrl = rtmpUrl
            };
            return theUrl.ToString();
        }
        public override List<string> GetMultipleVideoUrls(VideoInfo video, bool inPlaylist = false)
        {
            List<string> result = new List<string>();
            if ("livestream".Equals(video.Other))
            {
                result.Add(video.VideoUrl + "&swfVfy=http://www.rte.ie/player/assets/player_403.swf");
                return result;
            }
            string xmlData = GetWebData(video.VideoUrl);
            xmlData = Regex.Replace(xmlData, @"url=""http[^""]*""", @"url=""""");
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(xmlData);
            XmlNamespaceManager nsmgr = GetNameSpaceManager(doc);
            XmlNode nd = doc.SelectSingleNode("//a:feed/a:entry/m:group", nsmgr);
            foreach (XmlNode node in doc.SelectNodes("//a:feed/a:entry/m:group/m:content[@r:format!='advertising']", nsmgr))
            {
                string s = node.Attributes["url"].Value;

                RtmpUrl rtmpUrl = new RtmpUrl(s)
                {
                    SwfVerify = true,
                    App = "rtevod",
                    SwfUrl = @"http://www.rte.ie/player/assets/player_403.swf"
                };

                result.Add(rtmpUrl.ToString());
            }
            return result;
        }
Esempio n. 9
0
        public override string GetVideoUrl(string url)
        {
            string webdata = WebCache.Instance.GetWebData(url);
            string timeToWait = Regex.Match(webdata, @"<span\sid=""countdown_str"">[^>]*>(?<time>[^<]+)</span>").Groups["time"].Value;
            if (Convert.ToInt32(timeToWait) < 10)
            {
                System.Threading.Thread.Sleep(Convert.ToInt32(timeToWait) * 1001);

                webdata = GetFromPost(url, webdata, false, null, new[] { "imhuman=+" });

                string file = Helpers.StringUtils.GetSubString(webdata, @"file: """, @"""");
                string streamer = Helpers.StringUtils.GetSubString(webdata, @"streamer: """, @"""");
                RtmpUrl rtmpUrl = new RtmpUrl(streamer)
                {
                    PlayPath = file
                };
                return rtmpUrl.ToString();
            }

            return String.Empty;

        }
Esempio n. 10
0
        public override string GetVideoUrl(string url)
        {
            CookieContainer cc = new CookieContainer();
            string webData = WebCache.Instance.GetWebData(url, cookies: cc);
            if (url.Contains("humancheck.php"))
            {

                CookieCollection ccol = cc.GetCookies(new Uri("http://xtshare.com/humancheck.php"));
                CookieContainer newcc = new CookieContainer();
                foreach (Cookie c in ccol)
                {
                    c.Path = String.Empty;
                    newcc.Add(c);
                }
                url = url.Replace("humancheck", "toshare");
                webData = WebCache.Instance.GetWebData(url, "submit=I+am+human+now+let+me+watch+this+video", newcc);
            }
            string file = Helpers.StringUtils.GetSubString(webData, "'file','", "'");
            string streamer = Helpers.StringUtils.GetSubString(webData, "'streamer','", "'");
            // not tested, couldn't find a video hosted by xtshare
            RtmpUrl rtmpUrl = new RtmpUrl(streamer + file)
            {
                SwfVerify = true,
                SwfUrl = @"http://xtshare.com/player.swf",
                PageUrl = url,
                TcUrl = streamer
            };
            return rtmpUrl.ToString();
        }
Esempio n. 11
0
        public override string GetVideoUrl(VideoInfo video)
        {
            if ("livestream".Equals(video.Other))
            {
                string data = GetWebData(video.VideoUrl);
                Match m2 = Regex.Match(data, @"<param\sname=""flashvars""\svalue=""assetID=(?<assetid>[^_]*)_");
                if (m2.Success)
                {
                    data = GetWebData(String.Format(@"http://www.rtve.es/api/videos/{0}/config/portada.json", m2.Groups["assetid"].Value));
                    m2 = Regex.Match(data, @"""file"":""(?<url>[^""]*)""");
                    if (m2.Success)
                    {
                        RtmpUrl rtmpUrl = new RtmpUrl(m2.Groups["url"].Value)
                        {
                            Live = true,
                            SwfUrl = @"http://www.rtve.es/swf/4.0.32/RTVEPlayerVideo.swf"
                        };
                        return rtmpUrl.ToString();
                    }
                }
                return null;
            }

            //source: http://code.google.com/p/xbmc-tvalacarta/source/browse/trunk/tvalacarta/servers/rtve.py:
            // thanks to aabilio and tvalacarta
            string[] parts = video.VideoUrl.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
            string data2 = GetWebData(String.Format(@"http://www.rtve.es/ztnr/movil/thumbnail/anubis/videos/{0}.png", parts[parts.Length - 1]), referer: @"http://www.rtve.es");
            data2 = Encoding.ASCII.GetString(Convert.FromBase64String(data2));
            Match mm = Regex.Match(data2, ".*tEXt(?<cypher>.*)#[\x00]*(?<key>[0-9]*).*");
            if (mm.Success)
            {
                string cypher = mm.Groups["cypher"].Value;
                string key = mm.Groups["key"].Value;
                string int_cypher = "";
                int inc = 1;
                int ti = 0;
                while (ti < cypher.Length)
                {
                    ti = ti + inc;
                    if (ti > 0 && ti <= cypher.Length)
                        int_cypher += cypher[ti - 1];
                    inc++;
                    if (inc == 5) inc = 1;
                }

                string plaintext = "";
                int key_ind = 0;
                inc = 4;
                while (key_ind < key.Length)
                {
                    key_ind++;
                    ti = ((byte)key[key_ind - 1] - 48) * 10;
                    key_ind += inc;
                    if (key_ind <= key.Length)
                        ti += (byte)key[key_ind - 1] - 48;
                    ti++;
                    inc++;
                    if (inc == 5) inc = 1;
                    if (ti > 0 && ti <= int_cypher.Length)
                        plaintext += int_cypher[ti - 1];
                }
                int p = plaintext.IndexOf("/resources");
                string url = @"http://flash.akamaihd.multimedia.cdn.rtve.es/auth" + plaintext.Substring(p) +
                    "?v=2.6.8&fp=WIN%2016,0,0,305&r=TDBDO&g=UZEYDOLYKFLY";

                string data = GetWebData(url);
                p = data.IndexOf('?');
                string finalUrl = plaintext.Substring(0, p) + data.Substring(0, p);
                finalUrl = Regex.Replace(finalUrl, @"(//.*?.rtve.es)", @"//mvod.lvlt.rtve.es");

                HttpUrl res = new HttpUrl(finalUrl);
                res.Cookies.Add(new Cookie("odin", "odin=banebdyede"));
                return res.ToString();
            }

            return null;
        }
Esempio n. 12
0
        public override string GetVideoUrl(string url)
        {
            string webdata = WebCache.Instance.GetWebData(url);
            string timeToWait = Regex.Match(webdata, @"<span\sid=""countdown_str"">[^>]*>(?<time>[^<]+)</span>").Groups["time"].Value;
            if (String.IsNullOrEmpty(timeToWait) && webdata.Length < 50)
                throw new OnlineVideosException(webdata);
            int time;
            if (Int32.TryParse(timeToWait, out time) && time < 10)
                System.Threading.Thread.Sleep(time * 1001);
            webdata = GetFromPost(url, webdata, false, null, new[] { "imhuman=+" });

            string file = Helpers.StringUtils.GetSubString(webdata, @"file: """, @"""");
            string streamer = Helpers.StringUtils.GetSubString(webdata, @"streamer: """, @"""");
            RtmpUrl rtmpUrl = new RtmpUrl(streamer)
            {
                PlayPath = file
            };
            return rtmpUrl.ToString();

        }
        public override string GetVideoUrl(VideoInfo video)
        {
            XmlDocument doc = new XmlDocument();
            string xmlData = GetWebData(@"http://iview.abc.net.au/auth/flash/?", userAgent: "FireFox");
            doc.LoadXml(xmlData);
            XmlNamespaceManager nsmRequest = new XmlNamespaceManager(doc.NameTable);
            nsmRequest.AddNamespace("a", "http://www.abc.net.au/iView/Services/iViewHandshaker");
            string auth = doc.SelectSingleNode(@"a:iview/a:token", nsmRequest).InnerText;

            if (video.VideoUrl.StartsWith("rtmp://"))
            {
                string[] parts = video.VideoUrl.Split('/');
                string fileName = parts[parts.Length - 1];
                return new RtmpUrl(video.VideoUrl)
                {
                    SwfVerify = true,
                    SwfUrl = @"http://www.abc.net.au/iview/images/iview.jpg",
                    PlayPath = fileName,
                    App = "live/" + fileName + "?auth=" + auth,
                    Live = true
                }.ToString();
            }
            string host = doc.SelectSingleNode(@"a:iview/a:host", nsmRequest).InnerText;

            RtmpUrl rtmpUrl;
            //if (host.Equals("Akamai", StringComparison.InvariantCultureIgnoreCase))
            {
                rtmpUrl = new RtmpUrl(@"rtmp://cp53909.edgefcs.net////flash/playback/_definst_/" + video.VideoUrl)
                {
                    TcUrl = @"rtmp://cp53909.edgefcs.net/ondemand?auth=" + auth
                };
            }
            /*else
            {
                string authUrl = doc.SelectSingleNode(@"a:iview/a:server", nsmRequest).InnerText +
                    "?auth=" + auth;
                string vidUrl = video.VideoUrl;
                if (vidUrl.EndsWith(".mp4", StringComparison.InvariantCultureIgnoreCase))
                    vidUrl = "mp4:" + vidUrl.Substring(0, vidUrl.Length - 4);
                rtmpUrl = new RtmpUrl(authUrl) { PlayPath = vidUrl };
            }*/

            rtmpUrl.SwfVerify = true;
            rtmpUrl.SwfUrl = @"http://www.abc.net.au/iview/images/iview.jpg";
            return rtmpUrl.ToString();
        }
        public override string GetVideoUrl(VideoInfo video)
        {
            string webdata = GetWebData(video.VideoUrl);
            XmlDocument doc = new XmlDocument();
            video.PlaybackOptions = new Dictionary<string, string>();

            string hoster = video.Other as string;
            switch (hoster)
            {
                case "own3d":
                    {
                        doc.LoadXml(webdata);
                        XmlNodeList streams = doc.SelectNodes("//config/channels/channel/clip/item[starts-with(@base, 'rtmp')]/stream");
                        foreach (XmlNode stream in streams)
                        {
                            string label = stream.Attributes["label"].Value;
                            RtmpUrl theUrl = new RtmpUrl(stream.ParentNode.Attributes["base"].Value)
                                {
                                    PlayPath = stream.Attributes["name"].Value,
                                    Live = true
                                };
                            if (!video.PlaybackOptions.ContainsKey(label))
                                video.PlaybackOptions.Add(label, theUrl.ToString());
                        }; break;
                    }
                case "justin":
                    {
                        string s2 = Regex.Replace(webdata, @"<((?:/)?)(\d)", "<$1a$2");
                        // fix illegal <number items
                        doc.LoadXml(s2);
                        SortedDictionary<int, string> urls = new SortedDictionary<int, string>();
                        foreach (XmlNode stream in doc.SelectSingleNode("nodes").ChildNodes)
                        {
                            string node = stream.SelectSingleNode("node").InnerText;
                            string play = stream.SelectSingleNode("play").InnerText;
                            string bitrate = stream.SelectSingleNode("bitrate").InnerText;
                            int br = Convert.ToInt32(double.Parse(bitrate));
                            string token = stream.SelectSingleNode("token").InnerText;
                            string connect = stream.SelectSingleNode("connect").InnerText;
                            RtmpUrl theUrl = new RtmpUrl(connect)
                            {
                                Jtv = token,
                                Live = true,
                                PlayPath = play,
                                SwfUrl = @"http://www-cdn.jtvnw.net/widgets/live_embed_player.r9c27c302ba389b0ff3a9f34a7a0cb495dfc3e424.swf"
                            };
                            if (!urls.ContainsKey(br))
                                urls.Add(br, theUrl.ToString());
                        }
                        video.PlaybackOptions = urls.ToDictionary(u => u.Key.ToString() + "b/s", u => u.Value);
                    }; break;
            }

            string resultUrl;
            if (video.PlaybackOptions.Count == 0) return String.Empty;
            else
                resultUrl = video.PlaybackOptions.Last().Value;
            if (video.PlaybackOptions.Count == 1) video.PlaybackOptions = null;
            return resultUrl;

        }
Esempio n. 15
0
        protected new string FillPlaybackOptions(VideoInfo video, AMFArray renditions, Match m)
        {
            video.PlaybackOptions = new Dictionary<string, string>();

            foreach (AMFObject rendition in renditions.OrderBy(u => u.GetIntProperty("encodingRate")))
            {
                string nm = String.Format("{0}x{1} {2}K",
                    rendition.GetIntProperty("frameWidth"), rendition.GetIntProperty("frameHeight"),
                    rendition.GetIntProperty("encodingRate") / 1024);
                string url = HttpUtility.UrlDecode(rendition.GetStringProperty("defaultURL")); //"rtmp://brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/&mp4:102076681001/102076681001_986209826001_26930-20110610-122117.mp4&1368558000000&0aa762d184c16de09a21fe533394c3ea"
                if (url.StartsWith("rtmp"))
                {
                    //tested with ztele
                    string auth = String.Empty;
                    if (url.Contains('?'))
                        auth = '?' + url.Split('?')[1];
                    string[] parts = url.Split('&');

                    string rtmp = parts[0] + auth; //"rtmp://brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/"
                    string playpath = parts[1].Split('?')[0] + auth; //"mp4:102076681001/102076681001_986209826001_26930-20110610-122117.mp4"
                    if (url.IndexOf("edgefcs.net") != -1)
                    {
                        /*rtmpdump --rtmp "rtmp://cp150446.edgefcs.net/ondemand/&mp4:102076681001/102076681001_1506435728001_66034-20120314-120404.mp4?__nn__=1497926354001&slist=102076681001/&auth=daEbVc2bZd2bpcZdcbxbVdld6cEdWcpb4dC-brKM2q-bWG-rnBBssvx_ABAo_DDCB_GuD&aifp=bcosuds" --app="ondemand?__nn__=1497926354001&slist=102076681001/&auth=daEbVc2bZd2bpcZdcbxbVdld6cEdWcpb4dC-brKM2q-bWG-rnBBssvx_ABAo_DDCB_GuD&aifp=bcosuds&videoId=1506302142001&lineUpId=&pubId=102076681001&playerId=2202962695001" --swfUrl="http://admin.brightcove.com/viewer/us20121213.1025/federatedVideoUI/BrightcovePlayer.swf?uid=1355746343102" --playpath="mp4:102076681001/102076681001_1506435728001_66034-20120314-120404.mp4?__nn__=1497926354001&slist=102076681001/&auth=daEbVc2bZd2bpcZdcbxbVdld6cEdWcpb4dC-brKM2q-bWG-rnBBssvx_ABAo_DDCB_GuD&aifp=bcosuds&videoId=1506302142001" --pageUrl="http://www.eitb.tv/es/#/video/1506302142001" -o "Aduriz-La_cocina_de_las_palabras_-_Aduriz-Hitzen_sukaldea-.mp4"*/
                        url = new MPUrlSourceFilter.RtmpUrl(rtmp) { PlayPath = playpath }.ToString();
                    }
                    else
                    {
                        /*
                         rtmpdump --rtmp "rtmp://brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/&mp4:102076681001/102076681001_986252687001_26930-20110610-122117.mp4&1368558000000&0aa762d184c16de09a21fe533394c3ea" --app="a500/e1/uds/rtmp/ondemand?videoId=986121629001&lineUpId=&pubId=102076681001&playerId=2202962695001" --swfUrl="http://admin.brightcove.com/viewer/us20121218.1107/federatedVideoUI/BrightcovePlayer.swf?uid=1355158765470" --playpath="mp4:102076681001/102076681001_986252687001_26930-20110610-122117.mp4?videoId=986121629001&lineUpId=&pubId=102076681001&playerId=2202962695001" --pageUrl="http://www.eitb.tv/es/#/video/986121629001" -C "B:0" -C "S:mp4:102076681001/102076681001_986252687001_26930-20110610-122117.mp4&1368558000000&0aa762d184c16de09a21fe533394c3ea" -o "Sukalde_maisuak_-_Aduriz-Hitzen_sukaldea-.mp4"
                         */
                        string cadena = url.Substring(url.IndexOf(".net/") + 5);
                        cadena = cadena.Remove(cadena.IndexOf("/&"));
                        cadena += "?videoId=" + video.VideoUrl.Substring(video.VideoUrl.LastIndexOf("/") + 1) 
                            + "&lineUpId=&pubId=" + array4 + "&playerId=" + m.Groups["experienceId"].Value;
                        RtmpUrl rtmpUrl = new RtmpUrl(rtmp)
                        {
                            PlayPath = playpath,
                            //App = "a500/e1/uds/rtmp/ondemand?videoId=986121629001&lineUpId=&pubId=102076681001&playerId=2202962695001"
                            App = cadena
                        };
                        RtmpBooleanArbitraryData p1 = new RtmpBooleanArbitraryData(false);
                        RtmpStringArbitraryData p2 = new RtmpStringArbitraryData(parts[1]+"&"+parts[2]+"&"+parts[3]);
                        rtmpUrl.ArbitraryData.Add(p1);
                        rtmpUrl.ArbitraryData.Add(p2);
                        
                        url = rtmpUrl.ToString();
                    }

                }
                video.PlaybackOptions.Add(nm, url);
            }

            if (video.PlaybackOptions.Count == 0) return "";// if no match, return empty url -> error
            else
                if (video.PlaybackOptions.Count == 1)
                {
                    string resultUrl = video.PlaybackOptions.Last().Value;
                    video.PlaybackOptions = null;// only one url found, PlaybackOptions not needed
                    return resultUrl;
                }
                else
                {
                    return video.PlaybackOptions.Last().Value;
                }
        }