/// <summary> /// 根据分类ID获取视频 /// </summary> /// <param name="page">分页</param> /// <param name="IMEI">手机IMEI码</param> /// <param name="categoryId">分类ID</param> /// <returns></returns> public Entity.MovieListEntity.Root getCategoryVideo(string page, string IMEI, string categoryId) { try { Entity.UserEntity userEntity = new Entity.UserEntity(); userEntity.page = page; userEntity.imei = IMEI; userEntity.category = categoryId; string verUrl = Utils.SecurityHelper.Decode(ApiHost) + Utils.SecurityHelper.Decode(uStr) + "/CategoryVideo?Page=" + page + "&Category=" + categoryId + "&IMEI=" + IMEI + "&postkey=" + getThisKey("CategoryVideo", userEntity); Console.WriteLine("根据分类ID获取视频verUrl:" + verUrl); req = (HttpWebRequest)HttpWebRequest.Create(verUrl); //设置它提交数据的方式GET req.Method = "GET"; SecurityHelper.SetHeaderValue(req.Headers, "Host", Utils.SecurityHelper.Decode(hostStr)); StreamReader sr = new StreamReader(req.GetResponse().GetResponseStream()); //获取返回的数据 string Reader = sr.ReadToEnd(); JavaScriptSerializer jss = new JavaScriptSerializer(); Entity.MovieListEntity.Root it = jss.Deserialize <Entity.MovieListEntity.Root>(Reader); return(it); } catch (Exception ex) { Logger.Singleton.Error("获取分类视频失败,原因为:", ex); throw ex; } }
/// <summary> /// 通过索引或标签进行视频搜索 /// </summary> /// <param name="page">页码</param> /// <param name="tag">搜索内容</param> /// <param name="IMEI">手机IMEI码</param> /// <returns></returns> public Entity.MovieListEntity.Root searchVideoByTag(string page, string tag, string IMEI) { try { Entity.UserEntity userEntity = new Entity.UserEntity(); userEntity.search = tag; userEntity.imei = IMEI; userEntity.page = page; string verUrl = Utils.SecurityHelper.Decode(ApiHost) + Utils.SecurityHelper.Decode(uStr) + "/SearchVideo?Page=" + page + "&Search=" + SecurityHelper.EncodeUrl(tag) + "&IMEI=" + IMEI + "&postkey=" + getThisKey("SearchVideo", userEntity); Console.WriteLine("通过索引或标签进行视频搜索verUrl:" + verUrl); req = (HttpWebRequest)HttpWebRequest.Create(verUrl); //设置它提交数据的方式GET req.Method = "GET"; SecurityHelper.SetHeaderValue(req.Headers, "Host", Utils.SecurityHelper.Decode(hostStr)); StreamReader sr = new StreamReader(req.GetResponse().GetResponseStream()); //获取返回的数据 string Reader = sr.ReadToEnd(); JavaScriptSerializer jss = new JavaScriptSerializer(); Entity.MovieListEntity.Root it = jss.Deserialize <Entity.MovieListEntity.Root>(Reader); return(it); } catch (Exception ex) { Logger.Singleton.Error("通过标签搜索视频失败,原因为:", ex); throw ex; } }
/// <summary> /// 获取免费视频 /// </summary> /// <param name="IMEI">手机IMEI码</param> /// <returns></returns> public Entity.MovieListEntity.Root getFreeVideo(string IMEI) { try { string verUrl = Utils.SecurityHelper.Decode(ApiHost) + Utils.SecurityHelper.Decode(uStr) + "/FreeVideo?IMEI=" + IMEI + "&postkey=" + getThisKey("FreeVideo", new Entity.UserEntity()); req = (HttpWebRequest)HttpWebRequest.Create(verUrl); //设置它提交数据的方式GET req.Method = "GET"; SecurityHelper.SetHeaderValue(req.Headers, "Host", Utils.SecurityHelper.Decode(hostStr)); StreamReader sr = new StreamReader(req.GetResponse().GetResponseStream()); //获取返回的数据 string Reader = sr.ReadToEnd(); JavaScriptSerializer jss = new JavaScriptSerializer(); Entity.MovieListEntity.Root it = jss.Deserialize <Entity.MovieListEntity.Root>(Reader); return(it); } catch (Exception ex) { Logger.Singleton.Error("获取免费视频失败,原因为:", ex); throw ex; } }