Exemplo n.º 1
0
        private async void ExtractM3u8(string url)
        {
            isExtracting = true;
            extractor    = new M3u8Extractor(url);

            if (extractor.IsUrlValid())
            {
                Informations info = null;

                await Task.Run(() =>
                {
                    info = extractor.GetInformations();

                    if (info != null)
                    {
                        bool isFOD = info.department.Equals(FOD) ? true : false;
                        info.url   = extractor.GetM3u8Url(isFOD);
                    }
                });

                if (info != null)
                {
                    ListViewItem item = new ListViewItem(info.ToArray());
                    item.UseItemStyleForSubItems = false;
                    Font f = new Font(item.Font.Name, item.Font.Size + 8);
                    item.SubItems[0].Font      = f;
                    item.SubItems[0].ForeColor = Color.Green;

                    DownloadList.Items.Add(item);
                }
            }

            extractor.DestroyDriver();
            extractor = null;

            if (extractUrls.Count > 0)
            {
                ExtractM3u8(extractUrls.Dequeue());
            }

            isExtracting = false;
        }
Exemplo n.º 2
0
        public Informations GetInformations()
        {
            Informations info = new Informations();

            if (IsUrlValid())
            {
                if (driver == null)
                {
                    GetDriver();
                }

                Console.WriteLine(driver.SessionId);

                driver.Url = extractUrl;
                driver.Navigate();

                try
                {
                    string _temp = driver.FindElementByCssSelector(".title span.tv").Text;
                    info.department = Regex.Match(_temp, @"^(.*)? ").Groups[1].ToString();
                    if (info.department == "")
                    {
                        info.department = _temp;
                        info.date       = driver.FindElementByCssSelector(".title span.red").Text;
                    }
                    else
                    {
                        info.date = Regex.Match(_temp, @"\d.*$").ToString();
                    }

                    info.title    = driver.FindElementByCssSelector(".title h1").Text;
                    info.subtitle = driver.FindElementByCssSelector(".title p span.summary").Text;
                } catch (NoSuchElementException e)
                {
                    Console.WriteLine(e.Message);
                    info = null;
                }
            }

            return(info);
        }