コード例 #1
0
        /// <summary>
        /// 生成电影页面
        /// </summary>
        /// <param name="id"></param>
        protected void CreateMoviePage(int id)
        {
            MovieInfo m = MovieInfoView.GetModelByID(id.ToS());
            if (m.Id > 0)
            {
                Class c = MovieInfoView.GetClass(m);
                Voodoo.Basement.CreatePage.CreateContentPage(m, c);

                var Dramas = MovieDramaView.GetModelList(string.Format("movieid={0}", id));
                var Baidus = MovieUrlBaiduView.GetModelList(string.Format("movieid={0}", id));
                var Kuaibos = MovieUrlKuaibView.GetModelList(string.Format("movieid={0}", id));

                foreach (var d in Dramas)
                {
                    Voodoo.Basement.CreatePage.CreateDramapage(d, c);
                }
                foreach (var d in Baidus)
                {
                    Voodoo.Basement.CreatePage.CreateDramapage(d, c);
                }
                foreach (var d in Kuaibos)
                {
                    Voodoo.Basement.CreatePage.CreateDramapage(d, c);
                }

                Response.Write("电影" + m.Title + "完成");
            }
            else
            {
                Response.Write("不存在");
            }
        }
コード例 #2
0
        protected void LoadInfo()
        {
            switch (type)
            {
            case "kuaib":
                var kuaibUrl = MovieUrlKuaibView.GetModelByID(id.ToS());
                txt_BookTitle.Text = kuaibUrl.MovieTitle;
                txt_Title.Text     = kuaibUrl.Title;
                txt_Url.Text       = kuaibUrl.Url;
                movieID            = kuaibUrl.MovieID;
                break;

            case "baidu":
                var baiduUrl = MovieUrlBaiduView.GetModelByID(id.ToS());
                txt_BookTitle.Text = baiduUrl.MovieTitle;
                txt_Title.Text     = baiduUrl.Title;
                txt_Url.Text       = baiduUrl.Url;
                movieID            = baiduUrl.MovieID;
                break;

            case "mag":
                var magUrl = MovieUrlMagView.GetModelByID(id.ToS());
                txt_BookTitle.Text = magUrl.MovieTitle;
                txt_Title.Text     = magUrl.Title;
                txt_Url.Text       = magUrl.Url;
                movieID            = magUrl.MovieID;
                break;
            }
        }
コード例 #3
0
        protected void BindList()
        {
            switch (type)
            {
            case "kuaib":
                var cpl = MovieUrlKuaibView.GetModelList(string.Format("MovieID={0}", id));
                rp_List.DataSource = cpl;
                rp_List.DataBind();
                break;

            case "baidu":
                var cpl_baidu = MovieUrlBaiduView.GetModelList(string.Format("MovieID={0}", id));
                rp_List.DataSource = cpl_baidu;
                rp_List.DataBind();
                break;

            case "mag":
                var cpl_mag = MovieUrlMagView.GetModelList(string.Format("MovieID={0}", id));
                rp_List.DataSource = cpl_mag;
                rp_List.DataBind();
                break;

            default:
                var df = MovieUrlKuaibView.GetModelList(string.Format("MovieID={0}", id));
                rp_List.DataSource = df;
                rp_List.DataBind();
                break;
            }
        }
コード例 #4
0
        /// <summary>
        /// 获取Source文件地址----快播
        /// </summary>
        /// <param name="RuleName"></param>
        /// <param name="url"></param>
        /// <param name="Title"></param>
        /// <param name="MovieID"></param>
        /// <param name="MovieTitle"></param>
        protected void GetKuaiboSourceUrl(string RuleName, string url, string Title, int MovieID, string MovieTitle)
        {
            url = url.UrlDecode().HtmlDeCode();

            MovieRule _r = Rules.Where(p => p.Name == RuleName).First();
            MovieRule r  = _r.Clone();

            string html     = Url.GetHtml(url, r.Encoding).ToLower().AsciiToNative();
            Match  m        = html.GetMatchGroup(r.SourceKuaibRule.Replace("{title}", Title));
            var    sysDrama = MovieUrlKuaibView.Find(string.Format("MovieID={0} and Title=N'{1}'", MovieID, Title));

            if (sysDrama.Id <= 0)
            {
                if (m.Success)
                {
                    sysDrama.Enable     = true;
                    sysDrama.MovieID    = MovieID;
                    sysDrama.MovieTitle = MovieTitle;
                    sysDrama.Title      = Title;
                    sysDrama.UpdateTime = DateTime.UtcNow.AddHours(8);
                    sysDrama.Url        = m.Groups["key"].Value;
                    sysDrama.Url        = Regex.Replace(sysDrama.Url, "\\\\u.*?\\.", string.Format("{0}-{1}.", sysDrama.MovieTitle, sysDrama.Title));

                    MovieUrlKuaibView.Insert(sysDrama);

                    //CreatePage.CreateDramapage(sysDrama, MovieInfoView.GetClass(sysDrama));
                }
            }
            Response.Clear();
            Response.Write(JsonConvert.SerializeObject(sysDrama));
        }
コード例 #5
0
        /// <summary>
        /// 快播
        /// </summary>
        /// <param name="id"></param>
        protected void Kuaib(int id)
        {
            MovieUrlKuaib k = MovieUrlKuaibView.GetModelByID(id.ToS());

            Response.Clear();
            Response.Write(CreateDramapage(k, MovieInfoView.GetClass(k)));
        }
コード例 #6
0
        /// <summary>
        /// 获取播放页面的url-source ----快播
        /// </summary>
        /// <param name="RuleName"></param>
        /// <param name="url"></param>
        /// <param name="Title"></param>
        /// <param name="MovieID"></param>
        /// <param name="MovieTitle"></param>
        protected void GetKuaiboDrama(string RuleName, string url, string Title, int MovieID, string MovieTitle)
        {
            url = url.UrlDecode().HtmlDeCode();

            MovieRule _r = Rules.Where(p => p.Name == RuleName).First();
            MovieRule r  = _r.Clone();

            string html     = Url.GetHtml(url, r.Encoding);
            Match  m        = html.GetMatchGroup(r.DramaPageKuaibRule);
            var    sysDrama = MovieUrlKuaibView.Find(string.Format("MovieID={0} and Title=N'{1}'", MovieID, Title));

            if (m.Success)
            {
                if (sysDrama.Id <= 0)
                {
                    sysDrama.Enable     = true;
                    sysDrama.MovieID    = MovieID;
                    sysDrama.MovieTitle = MovieTitle;
                    sysDrama.Title      = Title;
                    sysDrama.UpdateTime = DateTime.UtcNow.AddHours(8);
                    sysDrama.Url        = m.Groups["url"].Value;
                    sysDrama.SourceUrl  = m.Groups["source"].Value.AppendToDomain(url);

                    if (m.Groups["url"].Value.IsNullOrEmpty() == false)
                    {
                        //如果url为空,则不写入数据库,不为空,就写入数据库
                        MovieUrlKuaibView.Insert(sysDrama);
                    }
                }
            }
            Response.Clear();
            Response.Write(JsonConvert.SerializeObject(sysDrama));
        }
コード例 #7
0
        /// <summary>
        /// 获取快播上一集地址
        /// </summary>
        /// <param name="kuai"></param>
        /// <returns></returns>
        public static MovieUrlKuaib GetPreKuaibo(MovieUrlKuaib kuai)
        {
            List <MovieUrlKuaib> lresult = MovieUrlKuaibView.GetModelList(string.Format("MovieID={0} and id<{1} order by id desc", kuai.MovieID, kuai.Id));

            if (lresult.Count == 0)
            {
                return(null);
            }
            else
            {
                return(lresult.First());
            }
        }
コード例 #8
0
 /// <summary>
 /// 生成快播页面
 /// </summary>
 /// <param name="id"></param>
 protected void CreateKuaiboPage(long id)
 {
     MovieUrlKuaib k = MovieUrlKuaibView.GetModelByID(id.ToS());
     if (k.Id > 0)
     {
         Class c = MovieInfoView.GetClass(k);
         Voodoo.Basement.CreatePage.CreateDramapage(k, c);
         Response.Write(string.Format("《{0}》-快播剧集《{1}》完成", k.MovieTitle, k.Title));
     }
     else
     {
         Response.Write("不存在");
     }
 }
コード例 #9
0
        protected void SaveDramas(int MovieID, List <Drama> dramas)
        {
            if (dramas.Count == 0)
            {
                return;
            }

            MovieInfo mv = MovieInfoView.GetModelByID(MovieID.ToS());

            List <MovieUrlBaidu> baidus  = new List <MovieUrlBaidu>();
            List <MovieUrlKuaib> kuaibos = new List <MovieUrlKuaib>();

            if (dramas[0].Type == "baidu")
            {
                baidus = MovieUrlBaiduView.GetModelList(string.Format("movieid={0}", MovieID));

                foreach (var drama in dramas)
                {
                    if (baidus.Where(p => p.Title == drama.Title).Count() == 0)
                    {
                        MovieUrlBaidu m = new MovieUrlBaidu();
                        m.Enable     = true;
                        m.MovieID    = mv.Id;
                        m.MovieTitle = mv.Title;
                        m.Title      = drama.Title;
                        m.UpdateTime = DateTime.UtcNow.AddHours(8);
                        m.Url        = drama.Url;
                        MovieUrlBaiduView.Insert(m);
                    }
                }
            }
            else
            {
                kuaibos = MovieUrlKuaibView.GetModelList(string.Format("movieid={0}", MovieID));
                foreach (var drama in dramas)
                {
                    if (kuaibos.Where(p => p.Title == drama.Title).Count() == 0)
                    {
                        MovieUrlKuaib m = new MovieUrlKuaib();
                        m.Enable     = true;
                        m.MovieID    = mv.Id;
                        m.MovieTitle = mv.Title;
                        m.Title      = drama.Title;
                        m.UpdateTime = DateTime.UtcNow.AddHours(8);
                        m.Url        = drama.Url;
                        MovieUrlKuaibView.Insert(m);
                    }
                }
            }
        }
コード例 #10
0
        /// <summary>
        /// 获取快播下一集地址
        /// </summary>
        /// <param name="kuai"></param>
        /// <returns></returns>
        public static MovieUrlKuaib GetNextKuaibo(MovieUrlKuaib kuai)
        {
            if (kuai == null)
            {
                return(new MovieUrlKuaib()
                {
                    Id = int.MinValue
                });
            }
            List <MovieUrlKuaib> lresult = MovieUrlKuaibView.GetModelList(string.Format("MovieID={0} and id>{1} order by id asc", kuai.MovieID, kuai.Id));

            if (lresult.Count == 0)
            {
                return(null);
            }
            else
            {
                return(lresult.First());
            }
        }
コード例 #11
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string ids = WS.RequestString("id");

            switch (type)
            {
            case "kuaib":
                MovieUrlKuaibView.Del(string.Format("id in ({0})", ids));
                break;

            case "baidu":
                MovieUrlBaiduView.Del(string.Format("id in ({0})", ids));
                break;

            case "mag":
                MovieUrlMagView.Del(string.Format("id in ({0})", ids));
                break;
            }

            Response.Redirect(string.Format("UrlList.aspx?bookid={0}", id));
        }
コード例 #12
0
        protected void btn_createPage_Click(object sender, EventArgs e)
        {
            Class c = ClassView.GetModelByID(cls.ToS());

            string[] ids = WS.RequestString("id").Split(',');
            foreach (string id in ids)
            {
                MovieInfo mv = MovieInfoView.GetModelByID(id);
                CreatePage.CreateContentPage(mv, c);
                var kuaibos = MovieUrlKuaibView.GetModelList(string.Format("MovieID={0}", id));
                var baidus  = MovieUrlBaiduView.GetModelList(string.Format("MovieID={0}", id));
                var dramas  = MovieDramaView.GetModelList(string.Format("MovieID={0}", id));
                foreach (var kuaib in kuaibos)
                {
                    CreatePage.CreateDramapage(kuaib, c);
                }
                foreach (var baidu in baidus)
                {
                    CreatePage.CreateDramapage(baidu, c);
                }
                foreach (var drama in dramas)
                {
                    CreatePage.CreateDramapage(drama, c);
                }
            }

            if (cls > 0)
            {
                try
                {
                    CreatePage.CreateListPage(c, 1);
                }
                catch { }
            }
            CreatePage.GreateIndexPage();
            Js.Jump(url);
        }
コード例 #13
0
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            movieID = WS.RequestInt("movieid", 0);
            MovieInfo movie = MovieInfoView.GetModelByID(movieID.ToS());

            #region deal
            switch (type)
            {
            case "kuaib":
                var kuaibUrl = MovieUrlKuaibView.GetModelByID(id.ToS());
                kuaibUrl.MovieTitle = movie.Title;
                kuaibUrl.Title      = txt_Title.Text;
                kuaibUrl.Url        = txt_Url.Text;
                kuaibUrl.MovieID    = movie.Id;
                kuaibUrl.UpdateTime = DateTime.Now;
                if (kuaibUrl.Id > 0)
                {
                    MovieUrlKuaibView.Update(kuaibUrl);
                }
                else
                {
                    MovieUrlKuaibView.Insert(kuaibUrl);
                }
                break;

            case "baidu":
                var baiduUrl = MovieUrlBaiduView.GetModelByID(id.ToS());
                baiduUrl.MovieTitle = movie.Title;
                baiduUrl.Title      = txt_Title.Text;
                baiduUrl.Url        = txt_Url.Text;
                baiduUrl.MovieID    = movie.Id;
                baiduUrl.UpdateTime = DateTime.Now;
                if (baiduUrl.Id > 0)
                {
                    MovieUrlBaiduView.Update(baiduUrl);
                }
                else
                {
                    MovieUrlBaiduView.Insert(baiduUrl);
                }
                break;

            case "mag":
                var magUrl = MovieUrlMagView.GetModelByID(id.ToS());
                magUrl.MovieTitle = movie.Title;
                magUrl.Title      = txt_Title.Text;
                magUrl.Url        = txt_Url.Text;
                magUrl.MovieID    = movie.Id;
                magUrl.UpdateTime = DateTime.Now;
                if (magUrl.Id > 0)
                {
                    MovieUrlMagView.Update(magUrl);
                }
                else
                {
                    MovieUrlMagView.Insert(magUrl);
                }
                break;
            }
            #endregion

            Response.Redirect("UrlList.aspx?type=" + type + "&movieid=" + movieID);
        }
コード例 #14
0
        /// <summary>
        /// 保存影视信息
        /// </summary>
        /// <param name="mv"></param>
        protected void SaveMovie(MovieInfo mv, bool IsSearchRule, string SiteName)
        {
            #region 处理分类
            Class cls = ClassView.Find(string.Format("ClassName=N'{0}'", mv.ClassName));
            if (cls.ID <= 0)
            {
                cls.IsLeafClass = true;
                cls.Alter       = mv.ClassName;
                cls.ClassForder = mv.ClassName;
                cls.ShowInNav   = true;
                cls.ParentID    = 0;
                cls.ClassName   = mv.ClassName;
                cls.ModelID     = 6;

                ClassView.Insert(cls);
            }
            mv.ClassID = cls.ID;
            #endregion

            #region 保存影视
            MovieInfo sysMv = MovieInfoView.Find(string.Format("Title=N'{0}' and ClassName=N'{1}'", mv.Title, mv.ClassName));
            if (sysMv.Id <= 0)
            {
                sysMv            = mv;
                sysMv.ClickCount = 0;
                sysMv.Enable     = true;
                sysMv.InsertTime = DateTime.UtcNow.AddHours(8);
                sysMv.ReplyCount = 0;
                sysMv.ScoreAvg   = 10;
                sysMv.ScoreTime  = 0;//评分次数
                sysMv.Status     = 0;
                sysMv.TjCount    = 0;
                sysMv.UpdateTime = DateTime.UtcNow.AddHours(8);

                MovieInfoView.Insert(sysMv);
            }
            else
            {
                sysMv.BaiduDramas  = mv.BaiduDramas;
                sysMv.KuaiboDramas = mv.KuaiboDramas;
            }
            #endregion

            #region  载封面
            try
            {
                Url.DownFile(sysMv.FaceImage, Server.MapPath(string.Format("~/u/MoviekFace/{0}.jpg", sysMv.Id)));
                sysMv.FaceImage = string.Format("/u/MoviekFace/{0}.jpg", sysMv.Id);
            }
            catch
            {
                sysMv.FaceImage = "/u/MoviekFace/0.jpg";
            }

            MovieInfoView.Update(sysMv);
            #endregion

            #region 保存单集资源
            if (IsSearchRule == false)
            {
                #region  是电影搜索
                foreach (var drama in sysMv.BaiduDramas)
                {
                    var sysDrama = MovieUrlBaiduView.Find(string.Format("MovieID={0} and Title=M'{0}' ", sysMv.Id, drama.Title));
                    if (sysDrama.Id <= 0)
                    {
                        sysDrama.Title = drama.Title;
                        sysDrama.Url   = drama.Url;

                        sysDrama.Enable     = true;
                        sysDrama.MovieID    = sysMv.Id;
                        sysDrama.MovieTitle = sysMv.Title;
                        sysDrama.UpdateTime = DateTime.UtcNow.AddHours(8);

                        MovieUrlBaiduView.Insert(sysDrama);

                        sysMv.LastDramaTitle = sysDrama.Title;
                        sysMv.LastDramaID    = sysDrama.Id;
                        MovieInfoView.Update(sysMv);

                        CreatePage.CreateDramapage(sysDrama, cls);//生成

                        Response.Write(string.Format("百度影音《{0}》《{1}》保存成功!:-D<br />", sysDrama.MovieTitle, sysDrama.Title));
                    }
                    else
                    {
                        Response.Write(string.Format("已经存在%>_<%<br />"));
                    }
                }

                foreach (var drama in sysMv.KuaiboDramas)
                {
                    var sysDrama = MovieUrlKuaibView.Find(string.Format("MovieID={0} and Title=N'{0}' ", sysMv.Id, drama.Title));
                    if (sysDrama.Id <= 0)
                    {
                        sysDrama.Title = drama.Title;
                        sysDrama.Url   = drama.Url;

                        sysDrama.Enable     = true;
                        sysDrama.MovieID    = sysMv.Id;
                        sysDrama.MovieTitle = sysMv.Title;
                        sysDrama.UpdateTime = DateTime.UtcNow.AddHours(8);

                        MovieUrlKuaibView.Insert(sysDrama);

                        sysMv.LastDramaTitle = sysDrama.Title;
                        sysMv.LastDramaID    = sysDrama.Id;
                        MovieInfoView.Update(sysMv);

                        CreatePage.CreateDramapage(sysDrama, cls);

                        Response.Write(string.Format("快播《{0}》《{1}》保存成功!:-D<br />", sysDrama.MovieTitle, sysDrama.Title));
                    }
                    else
                    {
                        Response.Write(string.Format("已经存在%>_<%<br />"));
                    }
                }
                #endregion
            }
            else
            {
                //电影搜索不需要保存资源地址 只需要保存 新建剧集和播放页面地址
                #region 快播地址
                foreach (var drama in mv.KuaiboDramas)
                {
                    var sysDrama = MovieDramaView.Find(string.Format("MovieTitle=N'{0}' and Title=N'{1}'", drama.MovieTitle, drama.Title));
                    if (sysDrama.Id <= 0)
                    {
                        sysDrama.Enable     = true;
                        sysDrama.MovieID    = mv.Id;
                        sysDrama.MovieTitle = mv.Title;
                        sysDrama.Title      = drama.Title;
                        sysDrama.UpdateTime = DateTime.UtcNow.AddHours(8);
                        MovieDramaView.Insert(sysDrama);
                    }

                    var sysUrl = MovieDramaUrlView.Find(string.Format("MovieID={0} and MovieDramaID={1} and SourceSite=N'{2}'", drama.MovieID, drama.Id, SiteName));
                    if (sysUrl.Id <= 0)
                    {
                        sysUrl.Enable          = true;
                        sysUrl.MovieDramaID    = drama.Id;
                        sysUrl.MovieDramaTitle = drama.Title;
                        sysUrl.MovieID         = mv.Id;
                        sysUrl.MovieTitle      = mv.Title;
                        sysUrl.SourceSite      = SiteName;
                        sysUrl.Title           = drama.Title;
                        sysUrl.UpdateTime      = DateTime.UtcNow.AddHours(8);
                        sysUrl.Url             = drama.PlayUrl.IsNull(mv.Url);
                    }
                }
                #endregion

                #region 百度影音

                foreach (var drama in mv.BaiduDramas)
                {
                    var sysDrama = MovieDramaView.Find(string.Format("MovieTitle=N'{0}' and Title=N'{1}'", drama.MovieTitle, drama.Title));
                    if (sysDrama.Id <= 0)
                    {
                        sysDrama.Enable     = true;
                        sysDrama.MovieID    = mv.Id;
                        sysDrama.MovieTitle = mv.Title;
                        sysDrama.Title      = drama.Title;
                        sysDrama.UpdateTime = DateTime.UtcNow.AddHours(8);
                        MovieDramaView.Insert(sysDrama);
                    }

                    var sysUrl = MovieDramaUrlView.Find(string.Format("MovieID={0} and MovieDramaID={1} and SourceSite=N'{2}'", drama.MovieID, drama.Id, SiteName));
                    if (sysUrl.Id <= 0)
                    {
                        sysUrl.Enable          = true;
                        sysUrl.MovieDramaID    = drama.Id;
                        sysUrl.MovieDramaTitle = drama.Title;
                        sysUrl.MovieID         = mv.Id;
                        sysUrl.MovieTitle      = mv.Title;
                        sysUrl.SourceSite      = SiteName;
                        sysUrl.Title           = drama.Title;
                        sysUrl.UpdateTime      = DateTime.UtcNow.AddHours(8);
                        sysUrl.Url             = drama.PlayUrl.IsNull(mv.Url);
                    }
                }

                #endregion
            }


            #endregion

            #region 生成

            Response.Write(string.Format("生成《{0}》信息页<br />", sysMv.Title));
            CreatePage.CreateContentPage(sysMv, cls);

            Response.Write(string.Format("生成“{0}”分类<br />", cls.ClassName));
            CreatePage.CreateListPage(cls, 1);

            #endregion
        }
コード例 #15
0
        /// <summary>
        /// 旧的电影采集
        /// </summary>
        protected void OldCollect()
        {
            Response.Buffer = false;


            //打开列表页面
            Response.Write("打开列表页面<br/>");
            string listUrl = "http://kuaib.tv.sohu.com/html/more_list21.htm";

openurl:
            string html_List = Url.GetHtml(listUrl, "utf-8");

            //打开信息页面
            Match m_list = html_List.GetMatchGroup("<img src=\"(?<image>.*?)\" width=\"120\" height=\"165\" alt=\"\" />[\\s\\S]*?<h4><a href=\"(?<url>.*?)\" target=\"_blank\">(?<title>.*?)</a></h4>");

            while (m_list.Success)
            {
                //判断是否存在
                if (MovieInfoView.Exist(string.Format("Title=N'{0}'", m_list.Groups["title"].Value)))
                {
                    m_list = m_list.NextMatch();
                    continue;
                }

                Response.Write("下载封面<br/>");
                //如果不存在,则先下载封面,内容页面是没有封面的
                try
                {
                    Url.DownFile(m_list.Groups["image"].Value, Server.MapPath("~/config/movieface.jpg"));
                }
                catch (Exception ex)
                {
                    Response.Write(ex.Message + "<br/>");
                }
                //打开内容页面
                Response.Write("打开内容页面<br/>");
                string html_content = Url.GetHtml(m_list.Groups["url"].Value, "utf-8");
                Match  m_movie      = html_content.GetMatchGroup("<em id='specialID'>《(?<title>.*?)》</em>[\\s\\S]*?<param name='URL' value='(?<url>.*?)'>[\\s\\S]*?<div id=\"introID\">[\\s]*?<p>(?<intro>[\\s\\S]*?)</p>[\\s\\S]*?var VRS_DIRECTOR=\"(?<director>.*?)\";[\\s\\S]*?var VRS_CATEGORY=\"(?<tags>.*?)\";[\\s\\S]*?var VRS_ACTOR=\"(?<actor>.*?)\";[\\s\\S]*?var VRS_AREA=\"(?<location>.*?)\";[\\s\\S]*?var VRS_PLAY_YEAR=\"(?<year>.*?)\";");
                if (!m_movie.Success)
                {
                    Response.Write("!!!!!内容匹配失败<br/>");
                }
                string title    = m_movie.Groups["title"].Value;
                string intro    = m_movie.Groups["intro"].Value;
                string director = m_movie.Groups["director"].Value;
                string actor    = m_movie.Groups["actor"].Value;
                string location = m_movie.Groups["location"].Value;
                string url      = m_movie.Groups["url"].Value;
                string year     = m_movie.Groups["year"].Value;
                string tags     = m_movie.Groups["tags"].Value;

                Response.Write("处理类别:" + location + "<br/>");
                Class cls = ClassView.Find(string.Format("classname=N'{0}'", location));
                if (cls.ID <= 0)
                {
                    cls.Alter         = location;
                    cls.ClassKeywords = location + "在线观看";
                    cls.ClassName     = location;
                    cls.IsLeafClass   = true;
                    cls.ShowInNav     = true;
                    cls.ClassForder   = location;
                    cls.ModelID       = 6;

                    ClassView.Insert(cls);
                }

                MovieInfo mv = new MovieInfo();
                mv.Actors     = actor;
                mv.ClassID    = cls.ID;
                mv.ClassName  = cls.ClassName;
                mv.ClickCount = 0;
                mv.Director   = director;
                mv.Enable     = true;
                mv.InsertTime = DateTime.Now;
                mv.Intro      = intro;
                mv.IsMove     = true;
                mv.Location   = location;
                mv.PublicYear = year;
                mv.ReplyCount = 0;
                mv.ScoreAvg   = 10;
                mv.ScoreTime  = 0;
                mv.Status     = 1;
                mv.Tags       = tags;
                mv.Title      = title;
                mv.TjCount    = 0;
                mv.UpdateTime = DateTime.Now;

                Response.Write("保存:" + title + "<br/>");
                MovieInfoView.Insert(mv);

                //设置封面
                Response.Write("设置封面<br/>");
                mv.FaceImage = string.Format("/u/MoviekFace/{0}.jpg", mv.Id);
                try
                {
                    Voodoo.IO.File.Move(Server.MapPath("~/config/movieface.jpg"), Server.MapPath(mv.FaceImage));
                }
                catch
                {
                    Voodoo.IO.File.Copy(Server.MapPath("~/config/0.jpg"), Server.MapPath(mv.FaceImage));
                }

                MovieInfoView.Update(mv);

                //添加地址
                Response.Write("添加地址:" + url + "<br/>");
                MovieUrlKuaib mk = new MovieUrlKuaib();
                mk.Enable     = true;
                mk.MovieID    = mv.Id;
                mk.MovieTitle = mv.Title;
                mk.Title      = "全集";
                mk.UpdateTime = DateTime.Now;
                mk.Url        = url;
                MovieUrlKuaibView.Insert(mk);

                //生成
                Response.Write("生成<br/>");
                //CreatePage.CreateDramapage(mk,cls);

                //CreatePage.CreateContentPage(mv,cls);

                //CreatePage.CreateListPage(cls,0);

                //CreatePage.GreateIndexPage();

                Response.Write(title + "-完成<br/><br/><br/>");

                m_list = m_list.NextMatch();
            }

            //处理列表下一页

            Match m_next = html_List.GetMatchGroup("<a href='(?<key>[^'/]*?)'>下一页</a>");

            if (m_next.Success)
            {
                listUrl = m_next.Groups["key"].Value.AppendToDomain(listUrl);
                goto openurl;
            }
        }
コード例 #16
0
        /// <summary>
        /// 获取保存电影详细信息
        /// </summary>
        /// <param name="rulename">规则名称</param>
        /// <param name="url">地址</param>
        /// <param name="cls">分类名称</param>
        /// <param name="title">标题</param>
        /// <param name="director">导演</param>
        /// <param name="actors">演员</param>
        /// <param name="tags">tag</param>
        /// <param name="location">位置</param>
        /// <param name="publicyear">上映年代</param>
        /// <param name="intro">简介</param>
        /// <param name="image">图片</param>
        protected void GetMovieInfo(string rulename, string url, string cls, string title, string director, string actors, string tags, string location, string publicyear, string intro, string image)
        {
            url = url.UrlDecode();
            MovieRule _r = Rules.Where(p => p.Name == rulename).First();
            MovieRule r  = _r.Clone();

            Class c = new Class();

            string html   = Url.GetHtml(url, r.Encoding);
            Match  m_info = html.GetMatchGroup(r.InfoRule);

            MovieInfo mv = MovieInfoView.Find(string.Format("title=N'{0}'", m_info.Groups["title"].Value));

            if (mv.Id <= 0)
            {
                if (m_info.Success)
                {
                    //开始获取信息
                    mv.Actors     = m_info.Groups["actors"].Value.IsNull(actors).TrimHTML();
                    mv.ClassName  = m_info.Groups["class"].Value.IsNull(cls).IsNull(r.DefaultClass);
                    mv.Director   = m_info.Groups["director"].Value.IsNull(director);
                    mv.Enable     = true;
                    mv.FaceImage  = m_info.Groups["image"].Value.IsNull(image).AppendToDomain(url);
                    mv.Intro      = m_info.Groups["intro"].Value.IsNull(intro).TrimHTML();
                    mv.Location   = m_info.Groups["location"].Value.IsNull(location);
                    mv.PublicYear = m_info.Groups["publicyear"].Value.IsNull(publicyear);
                    mv.Tags       = m_info.Groups["tags"].Value.IsNull(tags);
                    mv.Title      = m_info.Groups["title"].Value.IsNull(title);


                    mv.Info = Regex.Replace(mv.Intro, "<a.*?>", "", RegexOptions.IgnoreCase);
                    mv.Info = Regex.Replace(mv.Intro, "</a>", "", RegexOptions.IgnoreCase);

                    mv.Intro = mv.Info.TrimHTML().CutString(200);

                    mv.ClickCount    = 0;
                    mv.InsertTime    = DateTime.UtcNow.AddHours(8);
                    mv.IsMove        = r.IsMovie;
                    mv.ReplyCount    = 0;
                    mv.ScoreAvg      = 10;
                    mv.ScoreTime     = 0;
                    mv.Status        = 0;
                    mv.TjCount       = 0;
                    mv.DayClick      = 0;
                    mv.WeekClick     = 0;
                    mv.MonthClick    = 0;
                    mv.LastClickTime = DateTime.UtcNow.AddHours(8);
                    mv.UpdateTime    = DateTime.UtcNow.AddHours(8);

                    #region 处理分类
                    c = ClassView.Find(string.Format("ClassName=N'{0}'", mv.ClassName));
                    if (c.ID <= 0)
                    {
                        c.IsLeafClass = true;
                        c.Alter       = mv.ClassName;
                        c.ClassForder = mv.ClassName;
                        c.ShowInNav   = true;
                        c.ParentID    = 0;
                        c.ClassName   = mv.ClassName;
                        c.ModelID     = 6;

                        ClassView.Insert(c);
                    }
                    mv.ClassID = c.ID;
                    #endregion


                    //不存在这个电影就要保存到数据库
                    MovieInfoView.Insert(mv);

                    #region  载封面
                    try
                    {
                        Url.DownFile(mv.FaceImage, Server.MapPath(string.Format("~/u/MoviekFace/{0}.jpg", mv.Id)));
                        mv.FaceImage = string.Format("/u/MoviekFace/{0}.jpg", mv.Id);
                    }
                    catch
                    {
                        mv.FaceImage = "/u/MoviekFace/0.jpg";
                    }
                    MovieInfoView.Update(mv);
                    #endregion
                }
                else
                {
                    throw new Exception("电影信息匹配失败!");
                }
            }
            else
            {
                c = ClassView.GetModelByID(mv.ClassID.ToString());
            }


            mv.BaiduDramas  = new List <MovieUrlBaidu>();
            mv.KuaiboDramas = new List <MovieUrlKuaib>();


            #region 获取快播剧集
            Match m_kuaiboArea = html.GetMatchGroup(r.KuaibAreaRule);
            if (m_kuaiboArea.Success && r.KuaibAreaRule.IsNullOrEmpty() == false)
            {
                string html_kuaiboArea = m_kuaiboArea.Groups[1].Value;

                Match m_kuaibo = html_kuaiboArea.GetMatchGroup(r.KuaibDramaRule);
                while (m_kuaibo.Success)
                {
                    //判断是够存在
                    if (MovieUrlKuaibView.Exist(string.Format("MovieId={0} and Title=N'{1}'", mv.Id, m_kuaibo.Groups["title"].Value)))
                    {
                        m_kuaibo = m_kuaibo.NextMatch();
                        continue;
                    }
                    mv.KuaiboDramas.Add(new MovieUrlKuaib()
                    {
                        MovieID    = mv.Id,
                        Enable     = true,
                        PlayUrl    = m_kuaibo.Groups["playurl"].Value.AppendToDomain(url),
                        MovieTitle = mv.Title,
                        Title      = m_kuaibo.Groups["title"].Value.IsNull("全集"),
                        UpdateTime = DateTime.UtcNow.AddHours(8),
                        Url        = m_kuaibo.Groups["url"].Value
                    });
                    m_kuaibo = m_kuaibo.NextMatch();
                }
            }
            #endregion

            #region 获取百度剧集
            Match m_baiduArea = html.GetMatchGroup(r.BaiduAreaRule);
            if (m_baiduArea.Success && r.BaiduAreaRule.IsNullOrEmpty() == false)
            {
                string html_baiduArea = m_baiduArea.Groups[1].Value;

                Match m_baidu = html_baiduArea.GetMatchGroup(r.BaiduDramaRule);
                while (m_baidu.Success)
                {
                    //判断是够存在
                    if (MovieUrlBaiduView.Exist(string.Format("MovieId={0} and Title=N'{1}'", mv.Id, m_baidu.Groups["title"].Value)))
                    {
                        m_baidu = m_baidu = m_baidu.NextMatch();
                        continue;
                    }
                    mv.BaiduDramas.Add(new MovieUrlBaidu()
                    {
                        MovieID    = mv.Id,
                        Enable     = true,
                        PlayUrl    = m_baidu.Groups["playurl"].Value.AppendToDomain(url),
                        MovieTitle = mv.Title,
                        Title      = m_baidu.Groups["title"].Value.IsNull("全集"),
                        UpdateTime = DateTime.UtcNow.AddHours(8),
                        Url        = m_baidu.Groups["url"].Value
                    });
                    m_baidu = m_baidu = m_baidu.NextMatch();
                }
            }
            #endregion

            #region 如果是搜索系统,则只保存播放地址即可
            if (r.IsSearchRule)
            {
                foreach (var drama in mv.KuaiboDramas)
                {
                    #region 处理剧集
                    var sysDrama = MovieDramaView.Find(string.Format("MovieTitle=N'{0}' and Title=N'{1}'", drama.MovieTitle, drama.Title));
                    if (sysDrama.Id <= 0)
                    {
                        sysDrama.Enable     = true;
                        sysDrama.MovieID    = mv.Id;
                        sysDrama.MovieTitle = mv.Title;
                        sysDrama.Title      = drama.Title;
                        sysDrama.UpdateTime = drama.UpdateTime;
                        MovieDramaView.Insert(sysDrama);
                    }
                    #endregion

                    #region 处理播放地址
                    var playUrl = MovieDramaUrlView.Find(string.Format("MovieDramaID={0} and Url=N'{1}'", sysDrama.Id, drama.PlayUrl.IsNull(url)));
                    if (playUrl.Id <= 0)
                    {
                        playUrl.Enable          = true;
                        playUrl.MovieDramaID    = sysDrama.Id;
                        playUrl.MovieDramaTitle = sysDrama.Title;
                        playUrl.MovieID         = mv.Id;
                        playUrl.MovieTitle      = mv.Title;
                        playUrl.SourceSite      = r.SiteName;
                        playUrl.Title           = r.SiteName;
                        playUrl.UpdateTime      = DateTime.Now.AddHours(8);
                        playUrl.Url             = drama.PlayUrl.IsNull(url);
                        MovieDramaUrlView.Insert(playUrl);
                    }
                    #endregion
                }

                foreach (var drama in mv.BaiduDramas)
                {
                    #region 处理剧集
                    var sysDrama = MovieDramaView.Find(string.Format("MovieTitle=N'{0}' and Title=N'{1}'", drama.MovieTitle, drama.Title));
                    if (sysDrama.Id <= 0)
                    {
                        sysDrama.Enable     = true;
                        sysDrama.MovieID    = mv.Id;
                        sysDrama.MovieTitle = mv.Title;
                        sysDrama.Title      = drama.Title;
                        sysDrama.UpdateTime = drama.UpdateTime;
                        MovieDramaView.Insert(sysDrama);
                    }
                    #endregion

                    #region 处理播放地址
                    var playUrl = MovieDramaUrlView.Find(string.Format("MovieDramaID={0} and Url=N'{1}'", sysDrama.Id, drama.PlayUrl.IsNull(url)));
                    if (playUrl.Id <= 0)
                    {
                        playUrl.Enable          = true;
                        playUrl.MovieDramaID    = sysDrama.Id;
                        playUrl.MovieDramaTitle = sysDrama.Title;
                        playUrl.MovieID         = mv.Id;
                        playUrl.MovieTitle      = mv.Title;
                        playUrl.SourceSite      = r.SiteName;
                        playUrl.Title           = r.SiteName;
                        playUrl.UpdateTime      = DateTime.Now.AddHours(8);
                        playUrl.Url             = drama.PlayUrl.IsNull(url);
                        MovieDramaUrlView.Insert(playUrl);
                    }
                    #endregion
                }
                if (mv.BaiduDramas.Count > 0)
                {
                    mv.LastDramaTitle = mv.BaiduDramas.Last().Title;
                    mv.UpdateTime     = DateTime.UtcNow.AddHours(8);
                    MovieInfoView.Update(mv);
                }
            }
            #endregion

            #region 处理快播和百度影音
            else
            {
                bool needCreate = false;

                foreach (var drama in mv.KuaiboDramas)
                {
                    if (drama.Url.IsNullOrEmpty() == false)
                    {
                        var sysDrama = MovieUrlKuaibView.Find(string.Format("MovieID={0} and Title=N'{1}'", mv.Id, drama.Title));
                        if (sysDrama.Id <= 0)
                        {
                            MovieUrlKuaibView.Insert(drama);

                            //保存完成 生成
                            //CreatePage.CreateDramapage(drama, c);
                            //needCreate = true;
                        }
                    }
                }

                foreach (var drama in mv.BaiduDramas)
                {
                    if (drama.Url.IsNullOrEmpty() == false)
                    {
                        var sysDrama = MovieUrlBaiduView.Find(string.Format("MovieID={0} and Title=N'{1}'", mv.Id, drama.Title));
                        if (sysDrama.Id <= 0)
                        {
                            MovieUrlBaiduView.Insert(drama);
                            //保存完成 生成
                            //CreatePage.CreateDramapage(drama, c);
                            //needCreate = true;
                        }
                    }
                }
                if (needCreate)
                {
                    //CreatePage.CreateContentPage(mv, c);
                }
                if (mv.BaiduDramas.Count > 0)
                {
                    mv.LastDramaTitle = mv.BaiduDramas.Last().Title;
                    mv.UpdateTime     = DateTime.UtcNow.AddHours(8);
                    MovieInfoView.Update(mv);
                }
            }
            #endregion

            // 完成咯
            Response.Clear();
            Response.Write(JsonConvert.SerializeObject(mv));
        }