1 文件已重命名
57个文件已修改
7个文件已添加
| | |
| | | <groupId>com.aliyun</groupId> |
| | | <artifactId>tea-openapi</artifactId> |
| | | <version>0.0.19</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>com.aliyun</groupId> |
| | | <artifactId>tea</artifactId> |
| | | </exclusion> |
| | | |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.aliyun</groupId> |
| | | <artifactId>alidns20150109</artifactId> |
| | | <version>2.0.1</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>com.aliyun</groupId> |
| | | <artifactId>tea-openapi</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>com.aliyun</groupId> |
| | | <artifactId>tea-util</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <!-- 腾讯云日志采集CLS --> |
| | |
| | | out.print(JsonUtil.loadFalseJson("签名错误")); |
| | | return null; |
| | | } |
| | | } else if ("com.hanju.video.ios".equalsIgnoreCase(acceptData.getPackage())) { |
| | | } else if ("com.xinlian.hjtv.ios".equalsIgnoreCase(acceptData.getPackage())) { |
| | | //IOS韩剧签名方式 |
| | | String sign = getNewSign(request, "8888B&*@-hanJu88/',@@^"); |
| | | if (!sign.equalsIgnoreCase(acceptData.getSign())) { |
| | |
| | | case "getPlayUrl": |
| | | homeParser.getPlayUrl(acceptData, request, out); |
| | | break; |
| | | // 获取韩剧的播放链接 |
| | | case "getHjPlayUrl": |
| | | homeParser.getHjPlayUrl(acceptData, request, out); |
| | | break; |
| | | case "getMoreVideo": |
| | | homeParser.getMoreVideo(acceptData, request, out); |
| | | break; |
| | |
| | | package com.yeshi.buwan.controller.api; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.*; |
| | | import com.yeshi.buwan.controller.parser.UserParser; |
| | | import com.yeshi.buwan.domain.user.LoginUser; |
| | | import com.yeshi.buwan.domain.user.LoginUserExtra; |
| | |
| | | import com.yeshi.buwan.util.factory.vo.UserInfoVOFactory; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import com.yeshi.buwan.vo.client.user.UserInfoVO; |
| | | import org.json.JSONObject; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpSession; |
| | | import java.lang.reflect.Type; |
| | | import java.text.DateFormat; |
| | | import java.util.Date; |
| | | |
| | | @Controller |
| | | @RequestMapping("api/v2/user") |
| | |
| | | loginUserService.setUtdId(loginUid, acceptData.getUtdId()); |
| | | } |
| | | }); |
| | | |
| | | return JsonUtil.loadTrueJson(new Gson().toJson(vo)); |
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform())) { |
| | | if(StringUtil.isNullOrEmpty(vo.getBirthday())){ |
| | | vo.setBirthday(loginUser.getBirthday()); |
| | | } |
| | | if(StringUtil.isNullOrEmpty(vo.getSex())){ |
| | | vo.setSex(loginUser.getSex()); |
| | | } |
| | | if(StringUtil.isNullOrEmpty(vo.getSign())){ |
| | | vo.setSign(loginUser.getSign()); |
| | | } |
| | | Gson gson = new GsonBuilder().enableComplexMapKeySerialization() |
| | | .setDateFormat(DateFormat.LONG).registerTypeAdapter(Date.class, new JsonSerializer<Date>() { |
| | | @Override |
| | | public JsonElement serialize(Date value, Type theType, JsonSerializationContext context) { |
| | | if (value == null) { |
| | | return new JsonPrimitive("0"); |
| | | } else { |
| | | return new JsonPrimitive(value.getTime()); |
| | | } |
| | | } |
| | | }).setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE)// 会把字段首字母大写 |
| | | .setPrettyPrinting().setVersion(1.0).create(); |
| | | net.sf.json.JSONObject root= net.sf.json.JSONObject.fromObject(gson.toJson(vo)); |
| | | root.put("Nickname",vo.getNickName()); |
| | | return JsonUtil.loadTrueJson(root.toString()); |
| | | } else { |
| | | return JsonUtil.loadTrueJson(new Gson().toJson(vo)); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | import com.yeshi.buwan.exception.video.VideoPlayException; |
| | | import com.yeshi.buwan.service.inter.video.VideoResourceInfoMapService; |
| | | import com.yeshi.buwan.service.manager.APPManager; |
| | | import com.yeshi.buwan.videos.hanmi.HanmiUtil; |
| | | import com.yeshi.buwan.videos.mogotv.MogoTVUtil; |
| | | import com.yeshi.buwan.videos.pptv.PPTVApiUtil; |
| | | import com.yeshi.buwan.videos.pptv.PPTVUtil; |
| | |
| | | |
| | | @Resource |
| | | private VideoResourceInfoMapService videoResourceInfoMapService; |
| | | |
| | | @Resource |
| | | private HanmiUtil hanmiUtil; |
| | | |
| | | private final Logger userPlayLogger = LoggerFactory.getLogger("videoPlayUser"); |
| | | |
| | |
| | | |
| | | |
| | | public HomeType convertHomeVideoList(HomeType type) { |
| | | List<VideoInfo> vlist = new ArrayList<VideoInfo>(); |
| | | List<VideoInfo> vlist = new ArrayList<>(); |
| | | List<HomeVideo> list = type.getHomeVideoList(); |
| | | if (list != null) |
| | | for (HomeVideo hv : list) { |
| | |
| | | try { |
| | | info = tencentVideoUtil.getVideoInfo(internetSearchVideo, pageSize); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | logger.error("全网搜视频详情出错:" + videoId); |
| | | out.print(JsonUtil.loadFalseAdmin(e.getMessage())); |
| | | return; |
| | |
| | | } else if (Integer.parseInt(resourceId) == BilibiliUtil.RESOURCE_ID) { |
| | | try { |
| | | info = bilibiliUtil.getVideoInfo(internetSearchVideo, pageSize); |
| | | } catch (Exception e) { |
| | | logger.error("全网搜视频详情出错:" + videoId); |
| | | out.print(JsonUtil.loadFalseAdmin(e.getMessage())); |
| | | return; |
| | | } |
| | | }else if (Integer.parseInt(resourceId) == HanmiUtil.RESOURCE_ID) { |
| | | try { |
| | | info = hanmiUtil.getVideoInfo(internetSearchVideo, pageSize); |
| | | } catch (Exception e) { |
| | | logger.error("全网搜视频详情出错:" + videoId); |
| | | out.print(JsonUtil.loadFalseAdmin(e.getMessage())); |
| | |
| | | } |
| | | |
| | | |
| | | // 获取韩剧的播放链接 |
| | | public void getHjPlayUrl(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | String resourceId = request.getParameter("ResourceId"); |
| | | String id = request.getParameter("Id"); |
| | | String eid = request.getParameter("EId"); |
| | | String type = request.getParameter("Type"); |
| | | String videoId = request.getParameter("VideoId"); |
| | | |
| | | if (StringUtil.isNullOrEmpty(resourceId)) { |
| | | out.print(JsonUtil.loadFalseJson("请上传ResourceId")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(id) && StringUtil.isNullOrEmpty(eid)) { |
| | | out.print(JsonUtil.loadFalseJson("请上传id")); |
| | | return; |
| | | } |
| | | |
| | | // if (StringUtil.isNullOrEmpty(type)) { |
| | | // out.print(JsonUtil.loadFalseJson("请上传type")); |
| | | // return; |
| | | // } |
| | | |
| | | if (StringUtil.isNullOrEmpty(id)) |
| | | id = eid; |
| | | |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); |
| | | |
| | | PlayUrl pu = null; |
| | | try { |
| | | pu = videoDeailUtil.getPlayUrl(acceptData, detailSystem.getId(), id, type, Integer.parseInt(resourceId), videoId); |
| | | } catch (VideoPlayException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | if (pu != null) { |
| | | if (!StringUtil.isNullOrEmpty(pu.getUrl())) |
| | | pu.setUrl(pu.getUrl()); |
| | | JSONObject object = JSONObject.fromObject(StringUtil.outPutResultJson(pu)); |
| | | out.print(JsonUtil.loadTrueJson(object.toString())); |
| | | } else { |
| | | out.print(JsonUtil.loadFalseJson("找不到该视频")); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public List<HomeVideo> getZhiBoVideoList() throws Exception { |
| | | List<HomeVideo> list = new ArrayList<HomeVideo>(); |
| | | String result = get("http://www.kktv1.com/CDN/output/M/3/I/10002002/P/start-0_offset-6_platform-2/json.js"); |
| | |
| | | package com.yeshi.buwan.controller.parser; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.yeshi.buwan.domain.Collection; |
| | | import com.yeshi.buwan.domain.*; |
| | |
| | | import com.yeshi.buwan.dto.search.SolrShortVideoSearchFilter; |
| | | import com.yeshi.buwan.dto.search.SolrVideoSearchFilter; |
| | | import com.yeshi.buwan.dto.user.LoginInfoDto; |
| | | import com.yeshi.buwan.dto.user.QQUserInfo; |
| | | import com.yeshi.buwan.exception.SMSException; |
| | | import com.yeshi.buwan.exception.user.LoginUserException; |
| | | import com.yeshi.buwan.exception.user.RegisterUserException; |
| | |
| | | import com.yeshi.buwan.util.factory.vo.UserInfoVOFactory; |
| | | import com.yeshi.buwan.util.log.LoggerUtil; |
| | | import com.yeshi.buwan.util.log.UserActiveLogFactory; |
| | | import com.yeshi.buwan.util.login.QQLoginUtil; |
| | | import com.yeshi.buwan.util.video.VideoCategoryConstant; |
| | | import com.yeshi.buwan.util.video.VideoConstant; |
| | | import com.yeshi.buwan.util.video.VideoUtil; |
| | | import com.yeshi.buwan.util.wx.MyWXLoginUtil; |
| | | import com.yeshi.buwan.videos.pptv.PPTVUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import com.yeshi.buwan.vo.video.VideoListResultVO; |
| | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.yeshi.utils.entity.wx.WeiXinUser; |
| | | import org.yeshi.utils.exception.MailSendException; |
| | | import org.yeshi.utils.mail.EmailApiUtil; |
| | | import org.yeshi.utils.mail.EmailInfo; |
| | |
| | | |
| | | @Resource |
| | | private SMSService smsService; |
| | | |
| | | @Resource |
| | | DetailSystemConfigService detailSystemConfigService; |
| | | |
| | | public void getUid(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); |
| | |
| | | return; |
| | | } |
| | | |
| | | if (!StringUtil.isNullOrEmpty(account) && !account.trim().endsWith("@qq.com")) { |
| | | if (!StringUtil.isNullOrEmpty(account) && !account.trim().endsWith("@qq.com") && !acceptData.getPackage().equalsIgnoreCase("com.yeshi.buwanshequ.ios")) { |
| | | out.print(JsonUtil.loadFalseJson("只支持QQ邮箱注册")); |
| | | return; |
| | | } |
| | |
| | | out.print(JsonUtil.loadFalseJson("请上传Email")); |
| | | return; |
| | | } |
| | | if (!StringUtil.isNullOrEmpty(account) && !account.trim().endsWith("@qq.com")) { |
| | | if (!StringUtil.isNullOrEmpty(account) && !account.trim().endsWith("@qq.com") && !acceptData.getPackage().equalsIgnoreCase("com.yeshi.buwanshequ.ios")) { |
| | | out.print(JsonUtil.loadFalseJson("只支持QQ邮箱注册")); |
| | | return; |
| | | } |
| | |
| | | * @param out |
| | | */ |
| | | public void login(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | String account = request.getParameter("Email");// 邮箱 |
| | | String pwd = request.getParameter("Pwd");// 密码 |
| | | if (StringUtil.isNullOrEmpty(account)) { |
| | | out.print(JsonUtil.loadFalseJson("请上传Email")); |
| | | return; |
| | | String loginType = request.getParameter("LoginType"); |
| | | int logintTypeInt = LoginUser.LOGIN_TYPE_EMAIL; |
| | | if (!StringUtil.isNullOrEmpty(loginType)) { |
| | | logintTypeInt = Integer.parseInt(loginType); |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(pwd)) { |
| | | out.print(JsonUtil.loadFalseJson("请上传Pwd")); |
| | | return; |
| | | } |
| | | |
| | | // DetailSystem ds = |
| | | // systemService.getDetailSystemByPackage(packageName); |
| | | // 注册 --用户名,昵称,密码 |
| | | |
| | | LoginInfoDto loginInfoDto = new LoginInfoDto(); |
| | | loginInfoDto.setLoginType(LoginUser.LOGIN_TYPE_EMAIL); |
| | | loginInfoDto.setSystemId(acceptData.getDetailSystem().getSystem().getId()); |
| | | loginInfoDto.setEmail(account); |
| | | loginInfoDto.setPwd(StringUtil.Md5(pwd)); |
| | | loginInfoDto.setIpInfo(IPUtil.getRemotIP(request) + ":" + request.getRemotePort()); |
| | | switch (logintTypeInt) { |
| | | case LoginUser.LOGIN_TYPE_EMAIL: { |
| | | String account = request.getParameter("Email");// 邮箱 |
| | | String pwd = request.getParameter("Pwd");// 密码 |
| | | if (StringUtil.isNullOrEmpty(account)) { |
| | | out.print(JsonUtil.loadFalseJson("请上传Email")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(pwd)) { |
| | | out.print(JsonUtil.loadFalseJson("请上传Pwd")); |
| | | return; |
| | | } |
| | | loginInfoDto.setLoginType(LoginUser.LOGIN_TYPE_EMAIL); |
| | | loginInfoDto.setSystemId(acceptData.getDetailSystem().getSystem().getId()); |
| | | loginInfoDto.setEmail(account); |
| | | loginInfoDto.setPwd(StringUtil.Md5(pwd)); |
| | | } |
| | | break; |
| | | case LoginUser.LOGIN_TYPE_PHONE: { |
| | | String account = request.getParameter("Phone");// 邮箱 |
| | | String pwd = request.getParameter("Pwd");// 密码 |
| | | if (StringUtil.isNullOrEmpty(account)) { |
| | | out.print(JsonUtil.loadFalseJson("请上传电话号码")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(pwd)) { |
| | | out.print(JsonUtil.loadFalseJson("请上传密码")); |
| | | return; |
| | | } |
| | | loginInfoDto.setLoginType(LoginUser.LOGIN_TYPE_PHONE); |
| | | loginInfoDto.setPhone(account); |
| | | loginInfoDto.setPwd(StringUtil.Md5(pwd)); |
| | | |
| | | } |
| | | break; |
| | | case LoginUser.LOGIN_TYPE_QQ: { |
| | | String accessToken = request.getParameter("AccessToken"); |
| | | String openId = request.getParameter("OpenId"); |
| | | if (StringUtil.isNullOrEmpty(accessToken) || StringUtil.isNullOrEmpty(openId)) { |
| | | out.print(JsonUtil.loadFalseJson("请上传QQ授权信息")); |
| | | return; |
| | | } |
| | | |
| | | String qqAppId = detailSystemConfigService.getConfigValueByKey("qq_app_id", acceptData.getDetailSystem().getId(), acceptData.getVersion()); |
| | | if (StringUtil.isNullOrEmpty(qqAppId)) { |
| | | out.print(JsonUtil.loadFalseJson("QQ APPID获取出错")); |
| | | return; |
| | | } |
| | | QQLoginUtil.QQUserInfoEntity userEntity = QQLoginUtil.getUserInfo(qqAppId.trim(), accessToken, openId); |
| | | if (userEntity == null) { |
| | | out.print(JsonUtil.loadFalseJson("QQ用户信息解析出错")); |
| | | return; |
| | | } |
| | | |
| | | QQUserInfo userInfo = new QQUserInfo(); |
| | | userInfo.setSex(userEntity.getGender()); |
| | | userInfo.setPortrait(userEntity.getFigureurl()); |
| | | userInfo.setOpenId(openId); |
| | | userInfo.setName(userEntity.getNickname()); |
| | | loginInfoDto.setLoginType(LoginUser.LOGIN_TYPE_QQ); |
| | | loginInfoDto.setQqUserInfo(userInfo); |
| | | } |
| | | break; |
| | | case LoginUser.LOGIN_TYPE_WX: { |
| | | String code = request.getParameter("Code"); |
| | | if (StringUtil.isNullOrEmpty(code)) { |
| | | out.print(JsonUtil.loadFalseJson("请上传微信授权码")); |
| | | return; |
| | | } |
| | | |
| | | WeiXinUser weiXinUser = MyWXLoginUtil.getUserInfo(code, MyWXLoginUtil.WEIXIN_APPID, MyWXLoginUtil.WEIXIN_SECRET); |
| | | if (weiXinUser == null) { |
| | | out.print(JsonUtil.loadFalseJson("获取授权信息失败,请稍后再试")); |
| | | return; |
| | | } |
| | | loginInfoDto.setLoginType(LoginUser.LOGIN_TYPE_WX); |
| | | loginInfoDto.setWeiXinUser(weiXinUser); |
| | | } |
| | | break; |
| | | default: |
| | | out.print(JsonUtil.loadFalseJson("登录方式错误")); |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | LoginUser user = userService.login(loginInfoDto); |
| | | out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(user))); |
| | | } catch (LoginUserException e) { |
| | | out.print(JsonUtil.loadFalseJson(e.getMessage())); |
| | | if ((logintTypeInt == LoginUser.LOGIN_TYPE_WX || logintTypeInt == LoginUser.LOGIN_TYPE_QQ) && e.getCode() == LoginUserException.CODE_NO_USER) { |
| | | //注册 |
| | | try { |
| | | LoginUser lu = userService.register(loginInfoDto); |
| | | if (lu != null) { |
| | | JSONObject object = new JSONObject(); |
| | | object.put("user", new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().toJson(lu)); |
| | | out.print(JsonUtil.loadTrueJson(object.toString())); |
| | | } else { |
| | | out.print(JsonUtil.loadFalseJson("登录失败")); |
| | | } |
| | | } catch (RegisterUserException e1) { |
| | | out.print(JsonUtil.loadFalseJson("登录失败")); |
| | | } |
| | | } else { |
| | | out.print(JsonUtil.loadFalseJson(e.getMessage())); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | user.setPortrait(potrait); |
| | | if (!StringUtil.isNullOrEmpty(sex)) |
| | | user.setSex(sex); |
| | | if (!StringUtil.isNullOrEmpty(acceptData.getSign())) |
| | | if (!StringUtil.isNullOrEmpty(personalSign)) |
| | | user.setSign(personalSign); |
| | | if (!StringUtil.isNullOrEmpty(birthDay)) |
| | | user.setBirthday(birthDay); |
| | |
| | | * @param out |
| | | */ |
| | | public void setPwd(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | |
| | | |
| | | String email = request.getParameter("Email");// 个性签名 |
| | | String pwd = request.getParameter("Pwd");// 密码 |
| | | String verifyCode = request.getParameter("VerifyCode");// 验证码 |
| | |
| | | } |
| | | |
| | | // 注册 --用户名,昵称,密码 |
| | | LoginUser user = userService.getLoginUserByOpenId(email); |
| | | LoginUser user = userService.getValidLoginUserByEmail(email, acceptData.getDetailSystem().getSystem().getId()); |
| | | if (user == null) { |
| | | out.print(JsonUtil.loadFalseJson("该用户不存在")); |
| | | } else { |
| | |
| | | public static String savePortrait(String base64, HttpSession session) { |
| | | if (StringUtil.isNullOrEmpty(base64)) |
| | | return ""; |
| | | base64 = base64.replace("\r\n",""); |
| | | base64 = base64.replace("\r\n", ""); |
| | | |
| | | String fileName = "portrait_" + System.currentTimeMillis() + ".jpg"; |
| | | // 定义上传路径 |
| | |
| | | return findList(query); |
| | | } |
| | | |
| | | public long countAll() { |
| | | Query query = new Query(); |
| | | return count(query); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | @Repository |
| | | public class TencentCoverInfoDao extends MongodbBaseDao<TencentCoverInfo>{ |
| | | |
| | | public void updateSelective(TencentCoverInfo bean) { |
| | | Query query = new Query(); |
| | | Update update=new Update(); |
| | | query.addCriteria(Criteria.where("id").is(bean.getId())); |
| | | if(bean.getDouban_score() != null) { |
| | | update.set("douban_score", bean.getDouban_score()); |
| | | } |
| | | if(bean.getPay_status() != null) { |
| | | update.set("pay_status", bean.getPay_status()); |
| | | } |
| | | if(bean.getYear() != null) { |
| | | update.set("year", bean.getYear()); |
| | | } |
| | | if(bean.getEpisode_updated() != null) { |
| | | update.set("episode_updated", bean.getEpisode_updated()); |
| | | } |
| | | if(bean.getEpisode_all() != null) { |
| | | update.set("episode_all", bean.getEpisode_all()); |
| | | } |
| | | if(bean.getCurrent_num() != null) { |
| | | update.set("current_num", bean.getCurrent_num()); |
| | | } |
| | | if(bean.getPublish_date() != null) { |
| | | update.set("publish_date", bean.getPublish_date()); |
| | | } |
| | | if(bean.getTitle() != null) { |
| | | update.set("title", bean.getTitle()); |
| | | } |
| | | if(bean.getDescription() != null) { |
| | | update.set("description", bean.getDescription()); |
| | | } |
| | | if(bean.getCover_id() != null) { |
| | | update.set("cover_id", bean.getCover_id()); |
| | | } |
| | | if(bean.getType_name() != null) { |
| | | update.set("type_name", bean.getType_name()); |
| | | } |
| | | if(bean.getArea_name() != null) { |
| | | update.set("area_name", bean.getArea_name()); |
| | | } |
| | | if(bean.getHorizontal_pic_url() != null) { |
| | | update.set("horizontal_pic_url", bean.getHorizontal_pic_url()); |
| | | } |
| | | if(bean.getVertical_pic_url() != null) { |
| | | update.set("vertical_pic_url", bean.getVertical_pic_url()); |
| | | } |
| | | if(bean.getSecond_title() != null) { |
| | | update.set("second_title", bean.getSecond_title()); |
| | | } |
| | | if(bean.getLangue() != null) { |
| | | update.set("langue", bean.getLangue()); |
| | | } |
| | | if(bean.getMain_genre() != null) { |
| | | update.set("main_genre", bean.getMain_genre()); |
| | | } |
| | | if(bean.getScore() != null) { |
| | | update.set("score", bean.getScore()); |
| | | } |
| | | if(bean.getDirector() != null) { |
| | | update.set("director", bean.getDirector()); |
| | | } |
| | | if(bean.getLeading_actor() != null) { |
| | | update.set("leading_actor", bean.getLeading_actor()); |
| | | } |
| | | if(bean.getVip_ids() != null) { |
| | | update.set("vip_ids", bean.getVip_ids()); |
| | | } |
| | | if(bean.getSubtype() != null) { |
| | | update.set("subtype", bean.getSubtype()); |
| | | } |
| | | if(bean.getSub_genre() != null) { |
| | | update.set("sub_genre", bean.getSub_genre()); |
| | | } |
| | | if(bean.getCreateTime() != null) { |
| | | update.set("createTime", bean.getCreateTime()); |
| | | } |
| | | update.set("updateTime", new Date()); |
| | | update(query, update); |
| | | } |
| | | } |
| | |
| | | @Repository |
| | | public class TencentCoverVideoDao extends MongodbBaseDao<TencentCoverVideo> { |
| | | |
| | | public void updateSelective(TencentCoverVideo bean) { |
| | | Query query = new Query(); |
| | | Update update = new Update(); |
| | | query.addCriteria(Criteria.where("videoId").is(bean.getVideoId())); |
| | | if (bean.getCoverId() != null) { |
| | | update.set("coverId", bean.getCoverId()); |
| | | } |
| | | if (bean.getStage() != null) { |
| | | update.set("stage", bean.getStage()); |
| | | } |
| | | if (bean.getPosition() != null) { |
| | | update.set("position", bean.getPosition()); |
| | | } |
| | | if (bean.getDate() != null) { |
| | | update.set("date", bean.getDate()); |
| | | } |
| | | |
| | | update.set("updateTime", new Date()); |
| | | update(query, update); |
| | | } |
| | | } |
| | |
| | | params.add(loginUser.getQqOpenId()); |
| | | } |
| | | |
| | | |
| | | if (loginUser.getPwd() != null) { |
| | | sets.add("u.pwd=?"); |
| | | params.add(loginUser.getPwd()); |
| | | } |
| | | |
| | | |
| | | if (sets.size() > 0) { |
| | | params.add(loginUser.getId()); |
| | | Serializable[] ps = new Serializable[params.size()]; |
| | |
| | | import com.yeshi.buwan.service.inter.system.SystemConfigService; |
| | | import com.yeshi.buwan.util.rank.IqiyiRankUtil; |
| | | import com.yeshi.buwan.util.rank.TencentRankUtil; |
| | | import org.json.JSONArray; |
| | | import org.json.JSONObject; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | |
| | | //10409568 |
| | | @Component |
| | |
| | | @Resource |
| | | private SystemConfigService systemConfigService; |
| | | |
| | | private static List<String> concatRank(int count, List<String>... ranks) { |
| | | List<String> flist = new ArrayList<>(); |
| | | Set<String> keys=new HashSet<>(); |
| | | for (int i = 0; i < count; i++) { |
| | | for (List<String> rank : ranks) { |
| | | if (rank == null) { |
| | | continue; |
| | | } |
| | | if (rank.size() > i) { |
| | | if (!keys.contains(rank.get(i).replace(" ",""))) { |
| | | flist.add(rank.get(i)); |
| | | keys.add(rank.get(i).replace(" ","")); |
| | | } |
| | | } |
| | | if (flist.size() >= count) { |
| | | break; |
| | | } |
| | | } |
| | | if (flist.size() >= count) { |
| | | break; |
| | | } |
| | | } |
| | | return flist; |
| | | } |
| | | |
| | | |
| | | //爱奇艺排行 |
| | | @XxlJob("rank-iqiyi-update") |
| | | public ReturnT<String> updateIqiyiRank(String params) throws Exception { |
| | | public ReturnT<String> updateRank(String params) throws Exception { |
| | | Map<String, List<String>> map = IqiyiRankUtil.getRank(10); |
| | | Map<String, List<String>> tencentMap = TencentRankUtil.getRank(10); |
| | | if(tencentMap.get("总榜单")!=null) { |
| | | map.put("热搜", tencentMap.get("总榜单")); |
| | | } |
| | | map.put("动漫", tencentMap.get("动漫")); |
| | | Map<String,Integer> typeRank=new HashMap<>(); |
| | | typeRank.put("热搜",0); |
| | | typeRank.put("电视剧",1); |
| | | typeRank.put("动漫",2); |
| | | typeRank.put("电影",3); |
| | | typeRank.put("综艺",4); |
| | | |
| | | Map<String,List<String>> fmap=new TreeMap<>(new Comparator<String>() { |
| | | @Override |
| | | public int compare(String o1, String o2) { |
| | | return typeRank.get(o1) - typeRank.get(o2); |
| | | } |
| | | }); |
| | | fmap.put("热搜", concatRank(10, map.get("总榜"), tencentMap.get("热搜"))); |
| | | fmap.put("电视剧", concatRank(10, map.get("电视剧"), tencentMap.get("电视剧"))); |
| | | fmap.put("动漫", tencentMap.get("动漫")); |
| | | fmap.put("电影", concatRank(10, map.get("电影"), tencentMap.get("电影"))); |
| | | fmap.put("综艺", concatRank(10, map.get("综艺"), tencentMap.get("综艺"))); |
| | | if (map != null && map.size() > 0) { |
| | | String json = new Gson().toJson(map); |
| | | String json = new Gson().toJson(fmap); |
| | | systemConfigService.setValue("searchRank", json); |
| | | } |
| | | return ReturnT.SUCCESS; |
| | |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | new RankJob().updateRank(""); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | throw new Exception("area不能为空"); |
| | | } |
| | | |
| | | for (int i = 19; i >= 0; i--) { |
| | | try { |
| | | List<TencentWebUtil.TencentWebVideoInfo> list = TencentWebUtil.getVideoList(TencentWebUtil.parseParams(urlParams.getUrl()), i + 1); |
| | | if (list.size() == 0) |
| | | continue; |
| | | Collections.reverse(list); |
| | | for (TencentWebUtil.TencentWebVideoInfo videoInfo : list) { |
| | | solrShortVideoDataManager.saveOrUpdate(SolrShortVideoFactory.create(videoInfo, urlParams.getArea(), urlParams.getVideoType())); |
| | | } |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | } |
| | | // for (int i = 19; i >= 0; i--) { |
| | | // try { |
| | | // List<TencentWebUtil.TencentWebVideoInfo> list = TencentWebUtil.getVideoList(TencentWebUtil.parseParams(urlParams.getUrl()), i + 1); |
| | | // if (list.size() == 0) |
| | | // continue; |
| | | // Collections.reverse(list); |
| | | // for (TencentWebUtil.TencentWebVideoInfo videoInfo : list) { |
| | | // solrShortVideoDataManager.saveOrUpdate(SolrShortVideoFactory.create(videoInfo, urlParams.getArea(), urlParams.getVideoType())); |
| | | // } |
| | | // } catch (Exception e) { |
| | | // |
| | | // } |
| | | // } |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | } |
| | |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | | import com.xxl.job.core.handler.annotation.XxlJob; |
| | | import com.yeshi.buwan.service.inter.juhe.TencentVideoService; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.videos.tencent.TencentVideoApiUtil; |
| | | import com.yeshi.buwan.videos.tencent.entity.TencentCoverInfo; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.video.web.TencentWebUtil; |
| | | import com.yeshi.buwan.videos.tencent.factory.TencentCoverInfoFactory; |
| | | import com.yeshi.buwan.videos.tencent.vo.TencentCoverInfoVO; |
| | | import net.sf.json.JSONObject; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | @Component |
| | | public class TencentVideoUpdate { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(TencentVideoUpdate.class); |
| | | private final static Logger logger = LoggerFactory.getLogger("debug"); |
| | | |
| | | @Resource |
| | | private TencentVideoService tencentVideoService; |
| | | |
| | | |
| | | private TencentCoverInfo getCoverDetail(String coverId) throws Exception { |
| | | TencentCoverInfo detail = TencentVideoApiUtil.getCoverInfo(String.format("https://v.qq.com/x/cover/%s.html", coverId)); |
| | | return detail; |
| | | TencentCoverInfoVO detail = TencentVideoApiUtil.getCoverInfo(String.format("https://v.qq.com/x/cover/%s.html", coverId)); |
| | | return TencentCoverInfoFactory.create(detail); |
| | | } |
| | | |
| | | private void updateCategory(String channel) { |
| | | int totalPage = 50; |
| | | for (int i = 0; i < totalPage; i++) { |
| | | List<TencentCoverInfo> coverInfoList = TencentVideoApiUtil.getVideoListByCategory(channel, i + 1); |
| | | public void updateCategory(String channel,int startPage,int endPage, Integer areaId) { |
| | | logger.info("更新分类:"+channel); |
| | | for (int i = startPage; i <= endPage; i++) { |
| | | List<TencentCoverInfoVO> coverInfoList = TencentVideoApiUtil.getVideoListByCategory(channel, i, areaId); |
| | | save(coverInfoList); |
| | | } |
| | | } |
| | | |
| | | private void save(List<TencentCoverInfo> coverInfoList) { |
| | | private void save(List<TencentCoverInfoVO> coverInfoList) { |
| | | if (coverInfoList != null) |
| | | for (TencentCoverInfo coverInfo : coverInfoList) { |
| | | for (TencentCoverInfoVO coverInfo : coverInfoList) { |
| | | System.out.println(coverInfo.getTitle() + ":" + coverInfo.getCover_id()); |
| | | try { |
| | | tencentVideoService.addToInternetSearch(coverInfo); |
| | | // tencentVideoService.save(TencentCoverInfoFactory.create(coverInfo)); |
| | | tencentVideoService.addToInternetSearch( TencentCoverInfoFactory.create(coverInfo),true); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | logger.error("保存出错",e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private String getChannel(String cate) throws Exception { |
| | | switch (cate) { |
| | | case "综艺": |
| | | return "variety"; |
| | | case "电影": |
| | | return "movie"; |
| | | case "电视剧": |
| | | return "tv"; |
| | | case "动漫": |
| | | return "cartoon"; |
| | | } |
| | | |
| | | throw new Exception("类型不匹配"); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 更新最近几天的视频 |
| | |
| | | }; |
| | | |
| | | if (!StringUtil.isNullOrEmpty(param)) { |
| | | updateCategory(getChannel(param)); |
| | | updateCategory(param,1,1,null); |
| | | } else { |
| | | for (String type : types) { |
| | | updateCategory(getChannel(type)); |
| | | updateCategory(type,1,1, null); |
| | | } |
| | | } |
| | | return ReturnT.SUCCESS; |
| | |
| | | JSONObject json = JSONObject.fromObject(param); |
| | | int page = json.optInt("page"); |
| | | String url = json.optString("url"); |
| | | List<TencentCoverInfo> list = TencentVideoApiUtil.getVideoList(TencentWebUtil.getApiUrl(url, page)); |
| | | save(list); |
| | | // List<TencentCoverInfoVO> list = TencentVideoApiUtil.getVideoList(TencentWebUtil.getApiUrl(url, page)); |
| | | // save(list); |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | |
| | | for (String cid : cids) { |
| | | try { |
| | | TencentCoverInfo detail = getCoverDetail(cid); |
| | | tencentVideoService.addToInternetSearch(detail); |
| | | tencentVideoService.addToInternetSearch(detail, true); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | } |
| | | |
| | | private void updateCategory(String categoryName) throws Exception { |
| | | YouKuApiUtil.ListResultDTO dto = YouKuApiUtil.getShowListByCategory(categoryName, 1, 20); |
| | | if (dto != null) { |
| | | int pageSize = 100; |
| | | int totalPage = dto.getTotal() % pageSize == 0 ? dto.getTotal() / pageSize : dto.getTotal() / pageSize + 1; |
| | | totalPage = totalPage > 20 ? 20 : totalPage; |
| | | for (int i = 0; i < totalPage; i++) { |
| | | dto = YouKuApiUtil.getShowListByCategory(categoryName, i + 1, pageSize); |
| | | for (YouKuShowSimple simple : (List<YouKuShowSimple>) dto.getList()) { |
| | | System.out.println(simple.getName() + ":" + simple.getId()); |
| | | try { |
| | | YouKuShowDetail detail = getShowDetail(simple.getId()); |
| | | youKuService.addToInternetSearch(detail); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | for(int i=0;i<2;i++){ |
| | | YouKuApiUtil.ListResultDTO dto = YouKuApiUtil.getHotShowListByCategory(categoryName, i+1, 24); |
| | | for (YouKuShowSimple simple : (List<YouKuShowSimple>) dto.getList()) { |
| | | System.out.println(simple.getName() + ":" + simple.getId()); |
| | | try { |
| | | YouKuShowDetail detail = getShowDetail(simple.getId()); |
| | | youKuService.addToInternetSearch(detail); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.yeshi.buwan.service.imp; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.*; |
| | | |
| | | import com.yeshi.buwan.dao.VideoResourceMapExtraInfoDao; |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @description 根据ResourceId查询 |
| | | * @date 10:58 2024/8/16 |
| | | * @param: resourceId |
| | | * @param: page |
| | | * @param: pageSize |
| | | * @return java.util.List<com.yeshi.buwan.domain.ResourceVideo> |
| | | **/ |
| | | public List<ResourceVideo> listResourceVideo(Long resourceId,int page, int pageSize){ |
| | | return resourceVideoDao.list("from ResourceVideo rv where rv.resource.id=? ", (page-1)*pageSize, pageSize,new Serializable[]{resourceId+""}); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据视频ID与ResourceId查询 |
| | |
| | | @Service |
| | | public class SearchService { |
| | | private Logger logger = LoggerFactory.getLogger(SearchService.class); |
| | | private Logger debugLogger = LoggerFactory.getLogger("debug"); |
| | | |
| | | private final String ALBUM_SEARCH_FUZZY_KEYS = "《,》,。"; |
| | | |
| | |
| | | long albumCount = 0L; |
| | | List<VideoInfo> list = new ArrayList<>(); |
| | | List<VideoInfo> localList = null; |
| | | long startt = System.currentTimeMillis(); |
| | | try { |
| | | long startt = System.currentTimeMillis(); |
| | | |
| | | localList = null; |
| | | |
| | | localList = new ArrayList<>(); |
| | |
| | | searchResult = searchAlbum(videoType, key, resourceList, page, pageSize, true); |
| | | } |
| | | |
| | | debugLogger.info(String.format("搜索-solr专辑搜索耗时:(%s)-%s",key,(System.currentTimeMillis() - startt))); |
| | | startt = System.currentTimeMillis(); |
| | | if (searchResult != null && searchResult.videoInfoList != null) { |
| | | localList.addAll(searchResult.videoInfoList); |
| | | } |
| | |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | |
| | | debugLogger.error("常规搜索错误:{}","",e); |
| | | }finally { |
| | | debugLogger.info(String.format("搜索-solr常规搜索耗时:(%s)-%s",key,(System.currentTimeMillis() - startt))); |
| | | startt = System.currentTimeMillis(); |
| | | } |
| | | |
| | | |
| | | } |
| | | System.out.println("搜索耗时:" + (System.currentTimeMillis() - startt)); |
| | | |
| | | startt = System.currentTimeMillis(); |
| | | filterSearchResult(localList, resourceList); |
| | | debugLogger.info(String.format("搜索-过滤耗时:(%s)-%s",key,(System.currentTimeMillis() - startt))); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | |
| | | if (localList != null && localList.size() > 0) { |
| | | list.addAll(localList); |
| | | } |
| | | |
| | | startt = System.currentTimeMillis(); |
| | | //获取附加信息 |
| | | list = videoInfoExtraService.batchExtra(list, resourceList); |
| | | |
| | | debugLogger.info(String.format("搜索-附加信息耗时:(%s)-%s",key,(System.currentTimeMillis() - startt))); |
| | | return new VideoListResultVO(list, videoType == 0 ? albumCount : 1000L); |
| | | } |
| | | |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | public LoginUser getValidLoginUserByEmail(String email, String systemId) { |
| | | List<LoginUser> userList = loginUserDao.list("from LoginUser lu where lu.systemId=? and lu.email=? and lu.state=?", systemId, email, LoginUser.STATE_NORMAL); |
| | | if(userList!=null&&userList.size()>0){ |
| | | return userList.get(0); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 用户注销 |
| | | * |
| | |
| | | import com.yeshi.buwan.domain.*; |
| | | import com.yeshi.buwan.domain.entity.PlayUrl; |
| | | import com.yeshi.buwan.domain.push.VideoPushHistory; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import com.yeshi.buwan.util.config.SystemConfigUtil; |
| | | import com.yeshi.buwan.videos.funtv.FunTVUtil; |
| | | import com.yeshi.buwan.videos.funtv.entity.FunTVAlbum; |
| | | import com.yeshi.buwan.videos.funtv.entity.FunTVAlbumVideoMap; |
| | |
| | | |
| | | @Resource |
| | | private ResourceVideoService resourceVideoService; |
| | | |
| | | @Resource |
| | | private DetailSystemConfigService detailSystemConfigService; |
| | | |
| | | static Logger logger = Logger.getLogger(FunTVService.class); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | Serializable videoId = null; |
| | | |
| | | if (infoList != null && infoList.size() > 0 && isSame) {// 无需加入 |
| | | updateVideoInfo(info, video, p, isUpdate); |
| | | videoId = video.getId(); |
| | | } else {// 需要新加入videoinfo |
| | | Serializable id = addVideoInfo(info, p); |
| | | videoId = addVideoInfo(info, p); |
| | | } |
| | | |
| | | if (id != null) { |
| | | info.setId(id.toString()); |
| | | |
| | | if (videoId != null) { |
| | | info.setId(videoId.toString()); |
| | | try { |
| | | for (Integer ty : typeList) { |
| | | CategoryVideo cv = new CategoryVideo(); |
| | | cv.setVideo(new VideoInfo(info.getId())); |
| | | cv.setVideoType(new VideoType(ty)); |
| | | videoService.addCategoryVideo(cv); |
| | | } |
| | | }catch(Exception e){ |
| | | |
| | | VideoFunTV vft = new VideoFunTV(); |
| | | vft.setAid(p.getAid()); |
| | | vft.setVideoId(Long.parseLong(info.getId())); |
| | | vft.setVid(null); |
| | | vft.setId(vft.createId()); |
| | | saveVideoFunTV(vft); |
| | | |
| | | videoResourceService.excuteSQL(String.format( |
| | | "insert into wk_resource_video(videoid,resourceid) values(%s,%s)", info.getId(), 19 + "")); |
| | | } |
| | | |
| | | VideoFunTV vft = new VideoFunTV(); |
| | | vft.setAid(p.getAid()); |
| | | vft.setVideoId(Long.parseLong(info.getId())); |
| | | vft.setVid(null); |
| | | vft.setId(vft.createId()); |
| | | saveVideoFunTV(vft); |
| | | |
| | | List<VideoResource> videoResources = videoResourceService.getResourceByVideo(info); |
| | | for(VideoResource vr:videoResources){ |
| | | if(vr.getId().equalsIgnoreCase(19+"")){ |
| | | return; |
| | | } |
| | | } |
| | | videoResourceService.excuteSQL(String.format( |
| | | "insert into wk_resource_video(videoid,resourceid) values(%s,%s)", info.getId(), 19 + "")); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | |
| | | } |
| | | |
| | | public void addVideoToVideoInfo(final FunTVVideo p) { |
| | | // 将数据转为VideoInfo对象 |
| | | VideoInfo info = FunTVUtil.convertVideoToVideoInfo(p); |
| | | try { |
| | | synchronized (p.getTitle().intern()) { // 发现了有重复生成VideoInfo.所有根据名称加个锁(一定要加intern())cxx |
| | | |
| | | // 根据名称/类型/年代查询 |
| | | List<VideoInfo> infoList = videoInfoDao.list("from VideoInfo vi where vi.name=?", |
| | | new Serializable[]{p.getTitle()}); |
| | | new Serializable[]{info.getName()}); |
| | | if (infoList != null && infoList.size() > 0) {// 无需加入 |
| | | // updateVideoInfo(info, infoList.get(0), p, genre); |
| | | return; |
| | |
| | | } |
| | | |
| | | @SuppressWarnings("unchecked") |
| | | public PlayUrl getPlayUrl(String detailSystemId, String id, String type, int resourceid, String videoId) { |
| | | public PlayUrl getPlayUrl(String detailSystemId, String id, String type, int resourceid, String videoId, String channel, int versionCode) { |
| | | logger.info(String.format("%s#%s#%s#%s", detailSystemId, resourceid, type, id)); |
| | | PlayUrl playUrl = new PlayUrl(); |
| | | |
| | |
| | | playUrl.setParams(object.toString()); |
| | | if (fvideo.getPlayMUrl() != null) |
| | | playUrl.setUrl(fvideo.getPlayMUrl().replace("alliance=2501", "malliance=0")); |
| | | playUrl.setPlayType(1);// 全部跳转网页 |
| | | |
| | | String firstOnLineValue = detailSystemConfigService.getConfigValueByKey("first_online_versions",detailSystemId, versionCode); |
| | | if( SystemConfigUtil.isFirstOnLine(firstOnLineValue, channel, versionCode)){ |
| | | // 首次上线跳转原生 |
| | | playUrl.setPlayType(2);// 原生跳转 |
| | | } else { |
| | | playUrl.setPlayType(1);// 全部跳转网页 |
| | | } |
| | | return playUrl; |
| | | } |
| | | |
| | |
| | | if (vft != null && vft.getAid() != null) {// 按节目查找视频 |
| | | String aid = vft.getAid(); |
| | | FunTVAlbum album = funTVAlbumDao.get(aid); |
| | | if (album == null) { |
| | | resourceVideoService.delete(videoid, FunTVUtil.RESOURCE_ID + ""); |
| | | } |
| | | // if (album == null) { |
| | | // resourceVideoService.delete(videoid, FunTVUtil.RESOURCE_ID + ""); |
| | | // } |
| | | final String type = album.getVideoType(); |
| | | Sort.Direction sort = Sort.Direction.ASC; |
| | | if (type != null) |
| | |
| | | // 查询出对应的VID与videoid |
| | | final FunTVVideo video = getFunTVVideoByVid(vid); |
| | | if (video != null) { |
| | | funTVVideoDao.deleteByPrimaryKey(video.getVid()); |
| | | String videoId = (String) videoResourceDao.excute(new HibernateCallback<String>() { |
| | | |
| | | @SuppressWarnings("unchecked") |
| | |
| | | String videoid = null; |
| | | |
| | | //TODO 处理 |
| | | List<FunTVVideo> list = session |
| | | .createQuery("select m.video from FunTVAlbumVideoMap m where m.album.id=" + video.getId()) |
| | | .list(); |
| | | session.getTransaction().begin(); |
| | | try { |
| | | |
| | | for (FunTVVideo tv : list) {// 删除视频 |
| | | session.delete(tv); |
| | | } |
| | | session.delete(video);// 删除专辑 |
| | | List<VideoFunTV> ftlist = session |
| | | .createQuery( |
| | | "from VideoFunTV vf where vf.vid=" + video.getVid()) |
| | |
| | | package com.yeshi.buwan.service.imp.juhe; |
| | | |
| | | import com.yeshi.buwan.dao.VideoInfoDao; |
| | | import com.yeshi.buwan.dao.juhe.hanmi.HanmiShowDao; |
| | | import com.yeshi.buwan.dao.juhe.hanmi.HanmiShowEpisodeDao; |
| | | import com.yeshi.buwan.dao.juhe.hanmi.VideoHanmiMapDao; |
| | | import com.yeshi.buwan.dao.video.AlbumVideoMapDao; |
| | | import com.yeshi.buwan.domain.AdminInfo; |
| | | import com.yeshi.buwan.domain.VideoDetailInfo; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.VideoResource; |
| | | import com.yeshi.buwan.domain.entity.PlayUrl; |
| | | import com.yeshi.buwan.domain.video.AlbumVideoMap; |
| | | import com.yeshi.buwan.service.imp.CategoryVideoService; |
| | | import com.yeshi.buwan.service.imp.ResourceVideoService; |
| | | import com.yeshi.buwan.service.imp.VideoInfoService; |
| | | import com.yeshi.buwan.domain.video.InternetSearchVideo; |
| | | import com.yeshi.buwan.service.imp.VideoResourceService; |
| | | import com.yeshi.buwan.service.inter.juhe.HanmiService; |
| | | import com.yeshi.buwan.service.inter.juhe.InternetSearchVideoService; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | import com.yeshi.buwan.util.mq.CMQManager; |
| | | import com.yeshi.buwan.util.factory.InternetSearchVideoFactory; |
| | | import com.yeshi.buwan.videos.hanmi.HanmiUtil; |
| | | import com.yeshi.buwan.videos.hanmi.entity.HanmiShow; |
| | | import com.yeshi.buwan.videos.hanmi.entity.HanmiShowEpisode; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | private VideoHanmiMapDao videoHanmiMapDao; |
| | | |
| | | @Resource |
| | | private VideoInfoService videoInfoService; |
| | | |
| | | @Resource |
| | | private VideoInfoDao videoInfoDao; |
| | | |
| | | @Resource |
| | | private ResourceVideoService resourceVideoService; |
| | | |
| | | @Resource |
| | | private CategoryVideoService categoryVideoService; |
| | | private InternetSearchVideoService internetSearchVideoService; |
| | | |
| | | @Resource |
| | | private VideoResourceService videoResourceService; |
| | | |
| | | @Resource |
| | | private AlbumVideoMapDao albumVideoMapDao; |
| | | |
| | | public List<VideoDetailInfo> getVideoDetailList(String videoId, int page, int pageSize) { |
| | | //查询专辑 |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void addToVideoInfo(HanmiShow show) { |
| | | |
| | | public void addToInternetSearch(HanmiShow show) throws Exception { |
| | | if (StringUtil.isNullOrEmpty(show.getTitle())) { |
| | | return; |
| | | } |
| | | |
| | | VideoInfo newVideoInfo = convertShowToVideoInfo(show); |
| | | VideoHanmiMap map = videoHanmiMapDao.selectByShowId(show.getId()); |
| | | if (map != null) {//渠道视频已经存在 |
| | | VideoInfo videoInfo = videoInfoService.getVideoInfo(map.getVideoId() + ""); |
| | | if (videoInfo == null) |
| | | return; |
| | | newVideoInfo.setId(videoInfo.getId()); |
| | | if (!newVideoInfo.getTag().equalsIgnoreCase(videoInfo.getTag()) || newVideoInfo.getVideocount() != videoInfo.getVideocount()) { |
| | | newVideoInfo.setCreatetime(videoInfo.getCreatetime()); |
| | | //更新信息tag信息 |
| | | videoInfo.setLatestHpicture(newVideoInfo.getLatestHpicture()); |
| | | videoInfo.setLatestVpicture(newVideoInfo.getLatestVpicture()); |
| | | videoInfo.setVideocount(newVideoInfo.getVideocount()); |
| | | videoInfo.setTag(newVideoInfo.getTag()); |
| | | videoInfo.setPicture(newVideoInfo.getPicture()); |
| | | videoInfo.setHpicture(newVideoInfo.getHpicture()); |
| | | videoInfo.setVpicture(newVideoInfo.getVpicture()); |
| | | videoInfo.setShow(newVideoInfo.getShow()); |
| | | videoInfo.setVideoType(newVideoInfo.getVideoType()); |
| | | videoInfo.setUpdatetime(newVideoInfo.getUpdatetime()); |
| | | videoInfoService.update(videoInfo); |
| | | } |
| | | } else {//视频不存在 |
| | | //判断2个视频实体是否为同一视频 |
| | | VideoInfo oldVideo = videoInfoService.getExistSameVideoWithTime(newVideoInfo); |
| | | if (oldVideo == null) { |
| | | //添加视频 |
| | | Serializable id = videoInfoService.save(newVideoInfo); |
| | | newVideoInfo.setId(id + ""); |
| | | } else {//为同一视频 |
| | | //更新tag |
| | | newVideoInfo.setId(oldVideo.getId()); |
| | | oldVideo.setLatestHpicture(newVideoInfo.getLatestHpicture()); |
| | | oldVideo.setLatestVpicture(newVideoInfo.getLatestVpicture()); |
| | | oldVideo.setVideocount(newVideoInfo.getVideocount()); |
| | | oldVideo.setTag(newVideoInfo.getTag()); |
| | | oldVideo.setPicture(newVideoInfo.getPicture()); |
| | | oldVideo.setHpicture(newVideoInfo.getHpicture()); |
| | | oldVideo.setVpicture(newVideoInfo.getVpicture()); |
| | | oldVideo.setShow(newVideoInfo.getShow()); |
| | | oldVideo.setVideoType(newVideoInfo.getVideoType()); |
| | | oldVideo.setUpdatetime(newVideoInfo.getUpdatetime()); |
| | | videoInfoService.update(oldVideo); |
| | | } |
| | | |
| | | //加入专辑视频映射 |
| | | AlbumVideoMap vmap = new AlbumVideoMap(); |
| | | vmap.setId(newVideoInfo.getId()); |
| | | vmap.setCreateTime(new Date()); |
| | | vmap.setVideoId(newVideoInfo.getId()); |
| | | vmap.setRootVideoType(newVideoInfo.getVideoType().getId()); |
| | | vmap.setVideoCount(newVideoInfo.getVideocount()); |
| | | albumVideoMapDao.save(vmap); |
| | | |
| | | |
| | | //加入映射 |
| | | VideoHanmiMap vi = new VideoHanmiMap(); |
| | | vi.setShowId(show.getId()); |
| | | vi.setVideoId(newVideoInfo.getId()); |
| | | videoHanmiMapDao.save(vi); |
| | | InternetSearchVideo video = InternetSearchVideoFactory.create(show); |
| | | if (internetSearchVideoService.save(video) == null) { |
| | | return; |
| | | } |
| | | |
| | | //添加视频来源映射 |
| | | resourceVideoService.addVideoResource(newVideoInfo.getId(), HanmiUtil.RESOURCE_ID + ""); |
| | | //添加视频分类映射 |
| | | categoryVideoService.addCategoryVideo(newVideoInfo.getId(), newVideoInfo.getVideoType().getId()); |
| | | |
| | | //加入专辑搜索引擎 |
| | | CMQManager.getInstance().addSolrMsg(newVideoInfo.getId()); |
| | | VideoHanmiMap map = new VideoHanmiMap(); |
| | | map.setShowId(show.getId()); |
| | | map.setVideoId(video.getId()); |
| | | map.setCreateTime(new Date()); |
| | | videoHanmiMapDao.save(map); |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (map != null) { |
| | | HanmiShow show = hanmiShowDao.get(map.getShowId()); |
| | | if (show != null) { |
| | | if ("韩剧".equalsIgnoreCase(show.getType())) { |
| | | if ("电视剧".equalsIgnoreCase(show.getType())) { |
| | | return 2; |
| | | } |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | @Override |
| | | public VideoInfo convertShowToVideoInfo(HanmiShow show) { |
| | | Calendar ca = Calendar.getInstance(); |
| | | ca.setTimeInMillis(TimeUtil.convertGernalTime(show.getRelaseDate(), "yyyy-MM-dd")); |
| | | int day = ca.get(Calendar.DAY_OF_MONTH); |
| | | int month = ca.get(Calendar.MONTH) + 1; |
| | | int year = ca.get(Calendar.YEAR); |
| | | |
| | | VideoInfo video = new VideoInfo(); |
| | | video.setArea(show.getArea()); |
| | | video.setBaseurl(show.getUrl()); |
| | | video.setCanSave(false); |
| | | video.setCommentCount(0); |
| | | video.setCreatetime(System.currentTimeMillis()); |
| | | video.setDay(day + ""); |
| | | video.setYear(year + ""); |
| | | video.setMonth(month + ""); |
| | | video.setDirector(show.getDirector()); |
| | | video.setFinish("1"); |
| | | video.setIntroduction(show.getDesc()); |
| | | video.setMainActor(show.getActors()); |
| | | video.setName(show.getTitle()); |
| | | video.setNowNumber(show.getEpisodeList().size() + ""); |
| | | |
| | | video.setOrderby("0" + ""); |
| | | video.setPicture(show.getPicture()); |
| | | video.setVpicture(show.getPicture()); |
| | | |
| | | video.setScore(show.getScore()); |
| | | video.setShare("0"); |
| | | video.setShow("1"); |
| | | |
| | | video.setThirdType("1"); |
| | | video.setTotalNumber("0"); |
| | | |
| | | video.setWatchCount(0 + ""); |
| | | |
| | | video.setAdmin(new AdminInfo("1")); |
| | | video.setContentType(1); |
| | | video.setCommentCount(0); |
| | | |
| | | String tag = show.getTag(); |
| | | video.setTag(tag); |
| | | |
| | | |
| | | long videoCount = show.getEpisodeList().size(); |
| | | if (videoCount == 0L) |
| | | videoCount = 1; |
| | | |
| | | video.setVideocount((int) videoCount); |
| | | |
| | | video.setUpdatetime(System.currentTimeMillis() + ""); |
| | | |
| | | video.setVideoType(HanmiUtil.getVideoType(show)); |
| | | return video; |
| | | } |
| | | |
| | | @Override |
| | |
| | | hanmiShowEpisodeDao.delete(episode.getId()); |
| | | } |
| | | } |
| | | |
| | | |
| | | VideoHanmiMap bean = videoHanmiMapDao.selectByShowId(id); |
| | | if (bean != null) { |
| | | videoHanmiMapDao.delete(bean.getVideoId()); |
| | | //删除资源 |
| | | resourceVideoService.delete(bean.getVideoId() + "", HanmiUtil.RESOURCE_ID + ""); |
| | | resourceVideoService.delete(bean.getVideoId() + "", HanmiUtil.RESOURCE_ID + ""); |
| | | internetSearchVideoService.removeResourceId(bean.getVideoId(), HanmiUtil.RESOURCE_ID); |
| | | } |
| | | } |
| | | |
| | |
| | | if (show != null) { |
| | | show.setEpisodeList(hanmiShowEpisodeDao.listByShowId(id, 0, 1000)); |
| | | } |
| | | |
| | | return show; |
| | | } |
| | | |
| | | @Override |
| | | public List<HanmiShow> listAll(int page, int pageSize) { |
| | | return hanmiShowDao.listAll((page-1)*pageSize, pageSize); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public long countAll() { |
| | | return hanmiShowDao.countAll(); |
| | | } |
| | | } |
| | |
| | | |
| | | public int getShowType(String videId); |
| | | |
| | | public PlayUrl getPlayUrl(String detailSystemId, String id, String type, int resourceid, String videoId); |
| | | public PlayUrl getPlayUrl(String detailSystemId, String id, String type, int resourceid, String videoId, String channel, int versionCode); |
| | | } |
| | |
| | | return null; |
| | | |
| | | InternetSearchVideo oldVideo = internetSearchVideoDao.get(video.getId()); |
| | | Set<Integer> resourceIds = listResourceId(video); |
| | | Set<Integer> resourceIds = new HashSet<>(); |
| | | if(oldVideo!=null) { |
| | | resourceIds.addAll(listResourceId(oldVideo)); |
| | | } |
| | | int resourceId = Integer.parseInt(video.getResourceIds()); |
| | | resourceIds.add(resourceId); |
| | | Integer[] rids = new Integer[resourceIds.size()]; |
| | |
| | | return internetSearchVideoDao.findList(query); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void removeResourceId(String id, Integer resourceId) { |
| | | InternetSearchVideo video = internetSearchVideoDao.get(id); |
| | | if(video==null){ |
| | | return ; |
| | | } |
| | | Set<Integer> resourceIds = listResourceId(video); |
| | | if(resourceIds.contains(resourceId)){ |
| | | //移除 |
| | | resourceIds.remove(resourceId); |
| | | } |
| | | if(resourceIds.size()<=0){ |
| | | // 移除数据 |
| | | internetSearchVideoDao.deleteByPrimaryKey(id); |
| | | }else{ |
| | | InternetSearchVideo update=new InternetSearchVideo(); |
| | | update.setId(id); |
| | | Integer[] rids = new Integer[resourceIds.size()]; |
| | | resourceIds.toArray(rids); |
| | | video.setResourceIds(StringUtil.concat(rids, ",")); |
| | | internetSearchVideoDao.updateSelective(update); |
| | | } |
| | | InternetSearchVideoMQMsg msg = new InternetSearchVideoMQMsg(); |
| | | msg.setId(video.getId()); |
| | | msg.setResourceId(resourceId); |
| | | CMQManager.getInstance().addInternetSearchVideoUpdateMsg(msg); |
| | | } |
| | | } |
| | |
| | | import com.yeshi.buwan.domain.video.InternetSearchVideo; |
| | | import com.yeshi.buwan.service.inter.juhe.InternetSearchVideoService; |
| | | import com.yeshi.buwan.service.inter.juhe.TencentVideoService; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | import com.yeshi.buwan.util.video.web.TencentWebUtil; |
| | | import com.yeshi.buwan.videos.tencent.TencentVideoApiUtil; |
| | | import com.yeshi.buwan.videos.tencent.TencentVideoUtil; |
| | | import com.yeshi.buwan.videos.tencent.entity.TencentCoverInfo; |
| | | import com.yeshi.buwan.videos.tencent.entity.TencentCoverVideo; |
| | | import com.yeshi.buwan.videos.tencent.entity.TencentSearchVideoMap; |
| | | import com.yeshi.buwan.util.factory.InternetSearchVideoFactory; |
| | | import com.yeshi.buwan.videos.tencent.vo.TencentCoverInfoVO; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | public class TencentVideoServiceImpl implements TencentVideoService { |
| | |
| | | |
| | | @Override |
| | | public void save(TencentCoverInfo detail) throws Exception { |
| | | List<TencentCoverVideo> videoList = new ArrayList<>(); |
| | | for (TencentCoverInfo.VipIdsBean idsBean : detail.getVip_ids()) { |
| | | TencentCoverVideo video = new TencentCoverVideo(); |
| | | video.setCoverId(detail.getCover_id()); |
| | | video.setPosition(idsBean.getP()); |
| | | video.setStage(idsBean.getP() + 1); |
| | | video.setVideoId(idsBean.getV()); |
| | | video.setLink(String.format("https://v.qq.com/x/cover/%s/%s.html", detail.getCover_id(), idsBean.getV())); |
| | | if (idsBean.getF() == 2 || idsBean.getF() == 7) |
| | | videoList.add(video); |
| | | } |
| | | detail.setVideoList(videoList); |
| | | |
| | | |
| | | if (detail.getUpdateTime() == null) |
| | | detail.setUpdateTime(new Date()); |
| | | tencentCoverInfoDao.save(detail); |
| | |
| | | if (video.getUpdateTime() == null) { |
| | | video.setUpdateTime(new Date()); |
| | | } |
| | | |
| | | tencentCoverVideoDao.save(video); |
| | | } |
| | | } |
| | |
| | | if (detail != null) { |
| | | query.addCriteria(Criteria.where("coverId").is(coverId)); |
| | | } |
| | | query.with(new Sort(new Sort.Order(Sort.Direction.ASC, "show_videoseq"))); |
| | | query.with(new Sort(new Sort.Order(Sort.Direction.ASC, "position"))); |
| | | List<TencentCoverVideo> videoList = tencentCoverVideoDao.findList(query); |
| | | detail.setVideoList(videoList); |
| | | return detail; |
| | |
| | | |
| | | @Override |
| | | public TencentCoverInfo getSimpleCoverDetail(String coverId) { |
| | | TencentCoverInfo detail = tencentCoverInfoDao.get(coverId); |
| | | Query query=new Query(); |
| | | query.addCriteria(Criteria.where("_id").is(coverId)); |
| | | |
| | | TencentCoverInfo detail = tencentCoverInfoDao.findOne(query); |
| | | return detail; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void addToInternetSearch(TencentCoverInfo showDetail) throws Exception { |
| | | save(showDetail); |
| | | public void addToInternetSearch(TencentCoverInfo showDetail, boolean saveCoverInfo) throws Exception { |
| | | if(saveCoverInfo) { |
| | | save(showDetail); |
| | | } |
| | | InternetSearchVideo video = InternetSearchVideoFactory.create(showDetail); |
| | | if (internetSearchVideoService.save(video) == null) { |
| | | return; |
| | | } |
| | | TencentSearchVideoMap map = new TencentSearchVideoMap(); |
| | | map.setCoverId(showDetail.getId()); |
| | | map.setCoverId(showDetail.getCover_id()); |
| | | map.setVideoId(video.getId()); |
| | | map.setCreateTime(new Date()); |
| | | tencentSearchVideoMapDao.save(map); |
| | | } |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @description 从全网搜移除 |
| | | * @date 18:27 2024/8/16 |
| | | * @param: coverId |
| | | * @return void |
| | | **/ |
| | | private void removeFromInternetSearch(String coverId){ |
| | | Query query=new Query(); |
| | | query.addCriteria(Criteria.where("coverId").is(coverId)); |
| | | List<TencentSearchVideoMap> mapList = tencentSearchVideoMapDao.findList(query); |
| | | // 删除map |
| | | for(TencentSearchVideoMap map:mapList){ |
| | | tencentSearchVideoMapDao.deleteByPrimaryKey(map.getVideoId()); |
| | | internetSearchVideoService.removeResourceId( map.getVideoId(), TencentVideoUtil.RESOURCE_ID); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void clearOfflineCovers() { |
| | | // 拉取长期没有更新的专辑 |
| | | Query query=new Query(); |
| | | query.addCriteria(Criteria.where("updateTime").lte(new Date(System.currentTimeMillis()-1000*60*60*24L*5))); |
| | | query.with(new Sort(new Sort.Order(Sort.Direction.ASC, "updateTime"))); |
| | | query.skip(0); |
| | | query.limit(100); |
| | | List<TencentCoverInfo> list = tencentCoverInfoDao.findList(query); |
| | | for(TencentCoverInfo coverInfo:list){ |
| | | try { |
| | | boolean onLine = TencentVideoApiUtil.isOnLine(coverInfo.getVideoList().get(0).getLink()); |
| | | if(onLine){ |
| | | Query updateQuery=new Query(); |
| | | updateQuery.addCriteria(Criteria.where("_id").is(coverInfo.getCover_id())); |
| | | Update update=new Update(); |
| | | update.set("updateTime",new Date()); |
| | | tencentCoverInfoDao.update(updateQuery, update); |
| | | }else{ |
| | | // 删除数据 |
| | | Query updateQuery=new Query(); |
| | | updateQuery.addCriteria(Criteria.where("_id").is(coverInfo.getCover_id())); |
| | | tencentCoverInfoDao.delete(updateQuery); |
| | | } |
| | | Thread.sleep(1000); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | // 删除全网搜里面此来源的视频已经被删除 |
| | | query = new Query(); |
| | | long count = tencentSearchVideoMapDao.count(query); |
| | | int pageSize = 100; |
| | | int page =(int) (count%pageSize==0?count/pageSize:count/pageSize+1); |
| | | Set<String> deletedCoverIds = new HashSet<>(); |
| | | for(int i=0;i<page;i++){ |
| | | query.skip(i*pageSize); |
| | | query.limit(pageSize); |
| | | List<TencentSearchVideoMap> mapList = tencentSearchVideoMapDao.findList(query); |
| | | for(TencentSearchVideoMap map:mapList){ |
| | | Query cquery=new Query(); |
| | | cquery.addCriteria(Criteria.where("_id").is(map.getCoverId())); |
| | | if(tencentCoverInfoDao.findOne(cquery)==null){ |
| | | deletedCoverIds.add(map.getCoverId()); |
| | | removeFromInternetSearch(map.getCoverId()); |
| | | tencentSearchVideoMapDao.deleteByPrimaryKey(map.getVideoId()); |
| | | } |
| | | } |
| | | } |
| | | System.out.println(deletedCoverIds); |
| | | } |
| | | |
| | | } |
| | |
| | | for (String rid : rids) { |
| | | ridList.add(Long.parseLong(rid)); |
| | | } |
| | | ridList.retainAll(resourceIds); |
| | | if(resourceIds!=null) { |
| | | ridList.retainAll(resourceIds); |
| | | } |
| | | if (ridList.size() > 0) |
| | | hv.setVideo(VideoInfoFactory.create(internetSearchVideo)); |
| | | else { |
| | |
| | | if (!StringUtil.isNullOrEmpty(extra.gethPosterPicture())) { |
| | | vi.setHpicture(extra.gethPosterPicture()); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | * |
| | | * @param show |
| | | */ |
| | | public void addToVideoInfo(HanmiShow show); |
| | | public void addToInternetSearch(HanmiShow show) throws Exception; |
| | | |
| | | |
| | | public PlayUrl getPlayUrl(String detailSystemId, int resourceId, String id, String videoId); |
| | | |
| | | |
| | | public int getShowType(String videoid); |
| | | |
| | | public VideoInfo convertShowToVideoInfo(HanmiShow show); |
| | | |
| | | |
| | | public HanmiShow selectShowById(String id); |
| | |
| | | */ |
| | | public HanmiShow getShowDetail(String id); |
| | | |
| | | |
| | | public List<HanmiShow> listAll(int page,int pageSize); |
| | | |
| | | public long countAll(); |
| | | |
| | | } |
| | |
| | | |
| | | public List<InternetSearchVideo> listByIds(List<String> ids); |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @description 移除资源ID,如果没有资源了就需要删除整条数据 |
| | | * @date 11:11 2024/7/18 |
| | | * @param: id |
| | | * @param: resourceId |
| | | * @return void |
| | | **/ |
| | | public void removeResourceId(String id, Integer resourceId); |
| | | |
| | | } |
| | |
| | | * |
| | | * @param showDetail |
| | | */ |
| | | public void addToInternetSearch(TencentCoverInfo showDetail) throws Exception; |
| | | public void addToInternetSearch(TencentCoverInfo showDetail, boolean saveCoverInfo) throws Exception; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @description 清空已下线的专辑 |
| | | * @date 16:52 2024/8/16 |
| | | * @return void |
| | | **/ |
| | | public void clearOfflineCovers(); |
| | | |
| | | } |
| | |
| | | |
| | | public static boolean isUpdate = false;// 是否在上传应用市场; |
| | | |
| | | // TODO 测试为false |
| | | public static boolean IsOutNet = true;// 是否为外网 |
| | | |
| | | public static boolean JobTasker = true; |
| | |
| | | .getProperties(Constant.class.getClassLoader().getResourceAsStream("sms_tencent_config.properties")); |
| | | tencentSMSConfig = (TencentSMSConfig) MapUtil.parseMap(TencentSMSConfig.class, ps); |
| | | } |
| | | |
| | | |
| | | //IOS正在上线的版本 |
| | | public final static int IOS_ONLINING_VERSION = 78; |
| | | |
| | | |
| | | } |
| | |
| | | return ""; |
| | | } |
| | | |
| | | public static String post(String url,String entity,Map<String,String> headers) { |
| | | HttpClient client = new HttpClient(); |
| | | |
| | | PostMethod method = new PostMethod(url); |
| | | if(headers!=null) |
| | | for(String key:headers.keySet()){ |
| | | method.addRequestHeader(key, headers.get(key)); |
| | | } |
| | | method.setRequestBody(entity); |
| | | try { |
| | | client.executeMethod(method); |
| | | return convertInputStreamToString(method.getResponseBodyAsStream()); |
| | | } catch (HttpException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | public static String post(String url, Map<String, String> map) { |
| | | Iterator<String> its = map.keySet().iterator(); |
| | | NameValuePair[] params = new NameValuePair[map.keySet().size()]; |
| | |
| | | package com.yeshi.buwan.util.JuHe; |
| | | |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.service.imp.DetailSystemConfigService; |
| | | import com.yeshi.buwan.service.inter.video.VideoResourcePlayVersionMapService; |
| | | import com.yeshi.buwan.service.inter.video.VideoResourceVersionMapService; |
| | | import com.yeshi.buwan.util.config.SystemConfigUtil; |
| | | import com.yeshi.buwan.videos.funtv.FunTVUtil; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | @Resource |
| | | private VideoResourcePlayVersionMapService videoResourcePlayVersionMapService; |
| | | |
| | | @Resource |
| | | private DetailSystemConfigService detailSystemConfigService; |
| | | |
| | | @Cacheable(value = "homeCache", key = "'getAvailableResourceIds-'+'-'+#detailSystem.id+'-'+#versionCode+'-'+#channel") |
| | | public List<Long> getAvailableResourceIds(DetailSystem detailSystem, int versionCode,String channel) { |
| | | List<String> ridList = videoResourceVersionMapService.listResourceId(detailSystem.getId(), versionCode,channel.toLowerCase()); |
| | |
| | | // } |
| | | ridList.remove(25+""); |
| | | ridList.remove(28+""); |
| | | //TODO 没有上线需要清除 |
| | | ridList.add(FunTVUtil.RESOURCE_ID+""); |
| | | //是否是首次上线 |
| | | String firstOnLineValue = detailSystemConfigService.getConfigValueByKey("first_online_versions",detailSystem.getId(), versionCode); |
| | | if( SystemConfigUtil.isFirstOnLine(firstOnLineValue, channel, versionCode)){ |
| | | // 首次上线要打开风行 |
| | | ridList.add(FunTVUtil.RESOURCE_ID+""); |
| | | } |
| | | //韩剧上线的时候需要打开 |
| | | // if(detailSystem.getId().equalsIgnoreCase("51")){ |
| | | // ridList.add("28"); |
| | | // } |
| | | |
| | | // ridList.clear(); |
| | | // ridList.add("13"); |
| | | // ridList.add("22"); |
| | | |
| | | List<Long> ids = new ArrayList<>(); |
| | | if (ridList != null) { |
| | | for (String id : ridList) { |
| | |
| | | @Cacheable(value = "homeCache", key = "'getAvailablePlayResourceIds-'+'-'+#detailSystem.id+'-'+#versionCode+'-'+#channel") |
| | | public List<Long> getAvailablePlayResourceIds(DetailSystem detailSystem, int versionCode,String channel) { |
| | | List<String> ridList = videoResourcePlayVersionMapService.listResourceId(detailSystem.getId(), versionCode,channel.toLowerCase()); |
| | | // 韩剧上线需要打开注释 |
| | | // if(detailSystem.getId().equalsIgnoreCase("51")){ |
| | | // ridList.add("28"); |
| | | // } |
| | | // 首次上线要打开风行 |
| | | //TODO 没有上线需要清除 |
| | | ridList.add(FunTVUtil.RESOURCE_ID+""); |
| | | String firstOnLineValue = detailSystemConfigService.getConfigValueByKey("first_online_versions",detailSystem.getId(), versionCode); |
| | | if( SystemConfigUtil.isFirstOnLine(firstOnLineValue, channel, versionCode)){ |
| | | ridList.add(FunTVUtil.RESOURCE_ID+""); |
| | | } |
| | | |
| | | List<Long> ids = new ArrayList<>(); |
| | | if (ridList != null) { |
| | | for (String id : ridList) { |
| | |
| | | } |
| | | |
| | | public static List<VideoInfo> search(String key, int pageIndex) { |
| | | List<VideoInfo> list = new ArrayList<VideoInfo>(); |
| | | List<VideoInfo> list = new ArrayList<>(); |
| | | try { |
| | | String url = String.format("http://%s:8983/solr/buwan/select?q=%s&fq=show:1&start=" |
| | | + (pageIndex - 1) * Constant.pageCount + "&rows=" + Constant.pageCount + "&wt=json&indent=true&_="// 10.165.56.110 |
New file |
| | |
| | | package com.yeshi.buwan.util; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: TencentCloudEmailUtil |
| | | * @description: 腾讯云短信发送 |
| | | * @date 2024/7/17 13:21 |
| | | */ |
| | | import com.tencentcloudapi.common.Credential; |
| | | import com.tencentcloudapi.common.exception.TencentCloudSDKException; |
| | | import com.tencentcloudapi.ses.v20201002.SesClient; |
| | | import com.tencentcloudapi.ses.v20201002.models.SendEmailRequest; |
| | | import com.tencentcloudapi.ses.v20201002.models.SendEmailResponse; |
| | | import com.tencentcloudapi.ses.v20201002.models.Template; |
| | | import net.sf.json.JSONObject; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | public class TencentCloudEmailUtil { |
| | | |
| | | private static String secretId = "AKIDTlpgJhLjOozvd6QI2XnpfGbgV4NQJk25"; |
| | | private static String secretKey = "xhCSUHo55oHUQ6XicFcmfIgspX0EEzWo"; |
| | | |
| | | public static void sendEmail() throws TencentCloudSDKException { |
| | | EmailEntity emailEntity=new EmailEntity(); |
| | | emailEntity.setSecretId(secretId); |
| | | emailEntity.setSecretKey(secretKey); |
| | | emailEntity.setFromEmailAddress("ysdq@email.yeshitv.com"); |
| | | Map<String,String> data=new HashMap<>(); |
| | | data.put("code","123123"); |
| | | emailEntity.setTemplateData(data); |
| | | emailEntity.setTemplateId(28962L); |
| | | emailEntity.setTitle("影视大全验证码"); |
| | | emailEntity.setToEmailAddress("hexiaohui@banliapp.com"); |
| | | sendEmail(emailEntity); |
| | | } |
| | | |
| | | public static void sendEmail(EmailEntity entity) throws TencentCloudSDKException { |
| | | SesClient client = new SesClient(new Credential(entity.getSecretId(),entity.getSecretKey()),"ap-guangzhou"); |
| | | SendEmailRequest request = new SendEmailRequest(); |
| | | request.setFromEmailAddress(entity.getFromEmailAddress()); |
| | | request.setSubject(entity.getTitle()); |
| | | request.setDestination(new String[]{entity.getToEmailAddress()}); |
| | | Template template= new Template(); |
| | | template.setTemplateID(entity.getTemplateId()); |
| | | template.setTemplateData(JSONObject.fromObject(entity.getTemplateData()).toString()); |
| | | request.setTemplate(template); |
| | | SendEmailResponse response = client.SendEmail(request); |
| | | } |
| | | |
| | | public static void main(String[] args) throws TencentCloudSDKException { |
| | | sendEmail(); |
| | | |
| | | } |
| | | |
| | | public static class EmailEntity{ |
| | | private String secretId; |
| | | private String secretKey; |
| | | private String fromEmailAddress; |
| | | private String title; |
| | | private Long templateId; |
| | | private Map<String,String> templateData; |
| | | private String toEmailAddress; |
| | | |
| | | public String getSecretId() { |
| | | return secretId; |
| | | } |
| | | |
| | | public void setSecretId(String secretId) { |
| | | this.secretId = secretId; |
| | | } |
| | | |
| | | public String getSecretKey() { |
| | | return secretKey; |
| | | } |
| | | |
| | | public void setSecretKey(String secretKey) { |
| | | this.secretKey = secretKey; |
| | | } |
| | | |
| | | public String getFromEmailAddress() { |
| | | return fromEmailAddress; |
| | | } |
| | | |
| | | public void setFromEmailAddress(String fromEmailAddress) { |
| | | this.fromEmailAddress = fromEmailAddress; |
| | | } |
| | | |
| | | public String getTitle() { |
| | | return title; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | | this.title = title; |
| | | } |
| | | |
| | | public Long getTemplateId() { |
| | | return templateId; |
| | | } |
| | | |
| | | public void setTemplateId(Long templateId) { |
| | | this.templateId = templateId; |
| | | } |
| | | |
| | | public Map<String, String> getTemplateData() { |
| | | return templateData; |
| | | } |
| | | |
| | | public void setTemplateData(Map<String, String> templateData) { |
| | | this.templateData = templateData; |
| | | } |
| | | |
| | | public String getToEmailAddress() { |
| | | return toEmailAddress; |
| | | } |
| | | |
| | | public void setToEmailAddress(String toEmailAddress) { |
| | | this.toEmailAddress = toEmailAddress; |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.util.api; |
| | | |
| | | import com.qcloud.cos.COSClient; |
| | | import com.qcloud.cos.ClientConfig; |
| | | import com.qcloud.cos.auth.BasicCOSCredentials; |
| | | import com.qcloud.cos.auth.COSCredentials; |
| | | import com.qcloud.cos.region.Region; |
| | | import com.yeshi.buwan.util.HttpUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: 文本审核 |
| | | * @description: TODO |
| | | * @date 2023/7/13 14:58 |
| | | */ |
| | | public class StringVerifyUtil { |
| | | |
| | | static long appId = 1255749512L; |
| | | static String secretId = "AKIDTlpgJhLjOozvd6QI2XnpfGbgV4NQJk25"; |
| | | static String secretKey = "xhCSUHo55oHUQ6XicFcmfIgspX0EEzWo"; |
| | | // 设置要操作的bucket |
| | | static String bucketName = "buwan"; |
| | | static COSClient cosClient; |
| | | static String totalBucketName = ""; |
| | | |
| | | static { |
| | | COSCredentials cred = new BasicCOSCredentials(secretId, secretKey); |
| | | ClientConfig clientConfig = new ClientConfig(new Region("ap-guangzhou")); |
| | | cosClient = new COSClient(cred, clientConfig); |
| | | // bucket的命名规则为{name}-{appid} ,此处填写的存储桶名称必须为此格式 |
| | | totalBucketName = bucketName + "-" + appId; |
| | | } |
| | | |
| | | public static void verifyText(String text) { |
| | | if (StringUtil.isNullOrEmpty(text)) { |
| | | return; |
| | | } |
| | | String base64 = StringUtil.getBase64(text); |
| | | String url = String.format("http://%s.ci.%s.myqcloud.com",totalBucketName,"ap-guangzhou"); |
| | | String result = HttpUtil.post(url); |
| | | } |
| | | |
| | | public static void main(String[] args){ |
| | | verifyText("习近平"); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.util.config; |
| | | |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import net.sf.json.JSONObject; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: SystemConfigUtil |
| | | * @description: 系统配置工具 |
| | | * @date 2024/9/3 14:23 |
| | | */ |
| | | public class SystemConfigUtil { |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @description 是否是首次上线 |
| | | * @date 14:25 2024/9/3 |
| | | * @param: configValue |
| | | * @param: channel |
| | | * @param: versionCode |
| | | * @return boolean |
| | | **/ |
| | | public static boolean isFirstOnLine(String configValue, String channel, int versionCode) { |
| | | if(!StringUtil.isNullOrEmpty(configValue)) { |
| | | JSONObject firstOnLineValueObj = JSONObject.fromObject(configValue); |
| | | if (firstOnLineValueObj != null) { |
| | | firstOnLineValueObj = firstOnLineValueObj.optJSONObject(channel.toLowerCase()); |
| | | if (firstOnLineValueObj != null && firstOnLineValueObj.optInt("version") == versionCode) { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.yeshi.buwan.util.factory; |
| | | |
| | | import com.yeshi.buwan.domain.video.InternetSearchVideo; |
| | | import com.yeshi.buwan.videos.hanmi.HanmiUtil; |
| | | import com.yeshi.buwan.videos.hanmi.entity.HanmiShow; |
| | | import com.yeshi.buwan.videos.hanmi.entity.HanmiShowEpisode; |
| | | import com.yeshi.buwan.videos.mogotv.entity.MogoTVClipInfo; |
| | | import com.yeshi.buwan.videos.tencent.entity.TencentCoverInfo; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | |
| | | import com.yeshi.buwan.videos.bilibili.entity.BilibiliMediaInfo; |
| | | import com.yeshi.buwan.videos.bilibili.BilibiliUtil; |
| | | import com.yeshi.buwan.videos.bilibili.entity.BilibiliVideo; |
| | | import com.yeshi.buwan.videos.tencent.entity.TencentCoverVideo; |
| | | import com.yeshi.buwan.videos.tencent.vo.TencentCoverInfoVO; |
| | | import com.yeshi.buwan.videos.youku.entity.YouKuShowDetail; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | |
| | | public static InternetSearchVideo create(TencentCoverInfo info) { |
| | | |
| | | int videoCount = 0; |
| | | for (TencentCoverInfo.VipIdsBean idsBean : info.getVip_ids()) { |
| | | if (idsBean.getF() == 2 || idsBean.getF() == 7) |
| | | videoCount++; |
| | | for (TencentCoverVideo idsBean : info.getVideoList()) { |
| | | videoCount++; |
| | | } |
| | | |
| | | InternetSearchVideo video = new InternetSearchVideo(); |
| | |
| | | video.setArea(info.getArea_name()); |
| | | |
| | | |
| | | video.setDirector(StringUtil.concat(info.getDirector(), ",")); |
| | | video.setHpicture(info.getHorizontal_pic_url()); |
| | | video.setVpicture(info.getVertical_pic_url()); |
| | | // video.setDirector(StringUtil.concat(info.getDirector(), ",")); |
| | | video.setDirector(""); |
| | | video.setHpicture(info.getNew_pic_hz()); |
| | | video.setVpicture(info.getNew_pic_vt()); |
| | | video.setName(info.getTitle()); |
| | | video.setNameStr(info.getTitle()); |
| | | video.setResourceIds(17 + ""); |
| | |
| | | video.setRootType(VideoConstant.VIDEO_CATEGORY_ZONGYI); |
| | | } |
| | | if (info.getType_name().equalsIgnoreCase("电影")) { |
| | | video.setTag("评分:" + info.getScore().getScore()); |
| | | video.setTag("评分:" + info.getScore()); |
| | | } else |
| | | video.setTag(info.getEpisode_updated()); |
| | | video.setUpdateTime(new Date()); |
| | | video.setVideoCount(videoCount); |
| | | video.setYear(info.getYear()); |
| | | video.setYear(info.getPublish_date().split("-")[0]); |
| | | video.setId(InternetSearchVideo.createId(video.getName(), video.getRootType(), video.getYear())); |
| | | return video; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | public static InternetSearchVideo create(HanmiShow info) { |
| | | |
| | | int videoCount = 0; |
| | | for (HanmiShowEpisode idsBean : info.getEpisodeList()) { |
| | | videoCount++; |
| | | } |
| | | InternetSearchVideo video = new InternetSearchVideo(); |
| | | video.setActors(info.getActors()); |
| | | video.setArea(info.getArea()); |
| | | |
| | | |
| | | // video.setDirector(StringUtil.concat(info.getDirector(), ",")); |
| | | video.setDirector(""); |
| | | video.setHpicture(info.getPicture()); |
| | | video.setVpicture(info.getPicture()); |
| | | video.setName(info.getTitle()); |
| | | video.setNameStr(info.getTitle()); |
| | | video.setResourceIds(HanmiUtil.RESOURCE_ID + ""); |
| | | video.setRootType((int)HanmiUtil.getVideoType(info).getId()); |
| | | |
| | | if (info.getType().equalsIgnoreCase("电影")) { |
| | | video.setTag("评分:" + info.getScore()); |
| | | } else |
| | | video.setTag(info.getTag().replace("第","")); |
| | | video.setUpdateTime(new Date()); |
| | | video.setVideoCount(videoCount); |
| | | video.setYear(info.getYear()); |
| | | video.setId(InternetSearchVideo.createId(video.getName(), video.getRootType(), video.getYear())); |
| | | return video; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.util.login; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.yeshi.buwan.dto.user.QQUserInfo; |
| | | import com.yeshi.buwan.util.HttpUtil; |
| | | import net.sf.json.JSONObject; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: QQLoginUtil |
| | | * @description: QQ登录 |
| | | * @date 2024/4/8 14:25 |
| | | */ |
| | | public class QQLoginUtil { |
| | | |
| | | //QQ登录用户信息 |
| | | public class QQUserInfoEntity{ |
| | | /** |
| | | * nickname : 小灰 |
| | | * gender : 男 |
| | | * gender_type : 2 |
| | | * province : 广东 |
| | | * city : 深圳 |
| | | * year : 1990 |
| | | * figureurl : http://thirdqq.qlogo.cn/ek_qqapp/AQIq7wJAUpO1jpj3GhlP9EnGOK1phVobvS8euqc9QXCkmKnurYoS5R5qDa8ZLA/40 |
| | | * figureurl_1 : http://thirdqq.qlogo.cn/ek_qqapp/AQIq7wJAUpO1jpj3GhlP9EnGOK1phVobvS8euqc9QXCkmKnurYoS5R5qDa8ZLA/40 |
| | | * figureurl_2 : http://thirdqq.qlogo.cn/ek_qqapp/AQIq7wJAUpO1jpj3GhlP9EnGOK1phVobvS8euqc9QXCkmKnurYoS5R5qDa8ZLA/100 |
| | | * figureurl_qq_1 : http://thirdqq.qlogo.cn/ek_qqapp/AQIq7wJAUpO1jpj3GhlP9EnGOK1phVobvS8euqc9QXCkmKnurYoS5R5qDa8ZLA/40 |
| | | * figureurl_qq_2 : http://thirdqq.qlogo.cn/ek_qqapp/AQIq7wJAUpO1jpj3GhlP9EnGOK1phVobvS8euqc9QXCkmKnurYoS5R5qDa8ZLA/100 |
| | | * figureurl_qq : http://thirdqq.qlogo.cn/ek_qqapp/AQIq7wJAUpO1jpj3GhlP9EnGOK1phVobvS8euqc9QXCkmKnurYoS5R5qDa8ZLA/0 |
| | | * is_yellow_vip : 0 |
| | | * vip : 0 |
| | | * yellow_vip_level : 0 |
| | | * level : 0 |
| | | * is_yellow_year_vip : 0 |
| | | */ |
| | | |
| | | private String nickname; |
| | | private String gender; |
| | | private int gender_type; |
| | | private String province; |
| | | private String city; |
| | | private String year; |
| | | private String figureurl; |
| | | private String figureurl_1; |
| | | private String figureurl_2; |
| | | private String figureurl_qq_1; |
| | | private String figureurl_qq_2; |
| | | private String figureurl_qq; |
| | | private String is_yellow_vip; |
| | | private String vip; |
| | | private String yellow_vip_level; |
| | | private String level; |
| | | private String is_yellow_year_vip; |
| | | |
| | | public String getNickname() { |
| | | return nickname; |
| | | } |
| | | |
| | | public void setNickname(String nickname) { |
| | | this.nickname = nickname; |
| | | } |
| | | |
| | | public String getGender() { |
| | | return gender; |
| | | } |
| | | |
| | | public void setGender(String gender) { |
| | | this.gender = gender; |
| | | } |
| | | |
| | | public int getGender_type() { |
| | | return gender_type; |
| | | } |
| | | |
| | | public void setGender_type(int gender_type) { |
| | | this.gender_type = gender_type; |
| | | } |
| | | |
| | | public String getProvince() { |
| | | return province; |
| | | } |
| | | |
| | | public void setProvince(String province) { |
| | | this.province = province; |
| | | } |
| | | |
| | | public String getCity() { |
| | | return city; |
| | | } |
| | | |
| | | public void setCity(String city) { |
| | | this.city = city; |
| | | } |
| | | |
| | | public String getYear() { |
| | | return year; |
| | | } |
| | | |
| | | public void setYear(String year) { |
| | | this.year = year; |
| | | } |
| | | |
| | | public String getFigureurl() { |
| | | return figureurl; |
| | | } |
| | | |
| | | public void setFigureurl(String figureurl) { |
| | | this.figureurl = figureurl; |
| | | } |
| | | |
| | | public String getFigureurl_1() { |
| | | return figureurl_1; |
| | | } |
| | | |
| | | public void setFigureurl_1(String figureurl_1) { |
| | | this.figureurl_1 = figureurl_1; |
| | | } |
| | | |
| | | public String getFigureurl_2() { |
| | | return figureurl_2; |
| | | } |
| | | |
| | | public void setFigureurl_2(String figureurl_2) { |
| | | this.figureurl_2 = figureurl_2; |
| | | } |
| | | |
| | | public String getFigureurl_qq_1() { |
| | | return figureurl_qq_1; |
| | | } |
| | | |
| | | public void setFigureurl_qq_1(String figureurl_qq_1) { |
| | | this.figureurl_qq_1 = figureurl_qq_1; |
| | | } |
| | | |
| | | public String getFigureurl_qq_2() { |
| | | return figureurl_qq_2; |
| | | } |
| | | |
| | | public void setFigureurl_qq_2(String figureurl_qq_2) { |
| | | this.figureurl_qq_2 = figureurl_qq_2; |
| | | } |
| | | |
| | | public String getFigureurl_qq() { |
| | | return figureurl_qq; |
| | | } |
| | | |
| | | public void setFigureurl_qq(String figureurl_qq) { |
| | | this.figureurl_qq = figureurl_qq; |
| | | } |
| | | |
| | | public String getIs_yellow_vip() { |
| | | return is_yellow_vip; |
| | | } |
| | | |
| | | public void setIs_yellow_vip(String is_yellow_vip) { |
| | | this.is_yellow_vip = is_yellow_vip; |
| | | } |
| | | |
| | | public String getVip() { |
| | | return vip; |
| | | } |
| | | |
| | | public void setVip(String vip) { |
| | | this.vip = vip; |
| | | } |
| | | |
| | | public String getYellow_vip_level() { |
| | | return yellow_vip_level; |
| | | } |
| | | |
| | | public void setYellow_vip_level(String yellow_vip_level) { |
| | | this.yellow_vip_level = yellow_vip_level; |
| | | } |
| | | |
| | | public String getLevel() { |
| | | return level; |
| | | } |
| | | |
| | | public void setLevel(String level) { |
| | | this.level = level; |
| | | } |
| | | |
| | | public String getIs_yellow_year_vip() { |
| | | return is_yellow_year_vip; |
| | | } |
| | | |
| | | public void setIs_yellow_year_vip(String is_yellow_year_vip) { |
| | | this.is_yellow_year_vip = is_yellow_year_vip; |
| | | } |
| | | } |
| | | |
| | | public static QQUserInfoEntity getUserInfo(String appId, String accessToken, String openId) { |
| | | String url = String.format("https://graph.qq.com/user/get_user_info?oauth_consumer_key=%s&access_token=%s&openid=%s", appId, accessToken, openId); |
| | | String result = HttpUtil.get(url,"ISO-8859-1"); |
| | | System.out.println(result); |
| | | JSONObject root = JSONObject.fromObject(result); |
| | | if(root.optInt("ret")==0){ |
| | | QQUserInfoEntity qqUserInfo = new Gson().fromJson(result, QQUserInfoEntity.class); |
| | | return qqUserInfo; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | QQUserInfoEntity userInfo = getUserInfo("1105007756","7248A3CE0F9F66FD7AD1A3A26B5D2517","56F8DD0CA14613C44A1AEDFA55905066"); |
| | | |
| | | System.out.printf(userInfo.toString()); |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | package com.yeshi.buwan.util.rank; |
| | | |
| | | import com.yeshi.buwan.util.HttpUtil; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
| | | import org.jsoup.nodes.Element; |
| | | import org.jsoup.select.Elements; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | public class IqiyiRankUtil { |
| | | |
| | | public static Map<String, List<String>> getRank(int count) throws IOException { |
| | | Document doc = Jsoup.connect("https://www.iqiyi.com/ranks/hotsearch").timeout(20000).get(); |
| | | Element root = doc.getElementsByClass("qy-reso-card-list").get(0); |
| | | Elements items = root.getElementsByClass("qy-reso-card-item"); |
| | | Document doc = Jsoup.connect("https://www.iqiyi.com/ranks1PCW/home").timeout(20000).get(); |
| | | Element root = doc.getElementsByClass("gc__page").get(0); |
| | | Elements items = root.children(); |
| | | Map<String, List<String>> map = new HashMap<>(); |
| | | for (int i = 0; i < items.size(); i++) { |
| | | Element item = items.get(i); |
| | | String title = item.getElementsByClass("head-txt").get(0).text(); |
| | | List<String> list = new ArrayList<>(); |
| | | Elements names = item.getElementsByClass("sum-li"); |
| | | for (int j = 0; j < names.size(); j++) { |
| | | Element name = names.get(j); |
| | | String itemTitle = name.getElementsByTag("a").attr("title"); |
| | | list.add(itemTitle); |
| | | if (list.size() >= count) |
| | | break; |
| | | Element item = root.child(i); |
| | | if (item.hasClass("gc__tl1")) { |
| | | List<String> totalRanks = new ArrayList<>(); |
| | | Elements cols = item.getElementsByClass("gc__grid").get(0).getElementsByClass("gc__col"); |
| | | for (Iterator<Element> its = cols.iterator(); its.hasNext(); ) { |
| | | Element col = its.next(); |
| | | Elements names = col.getElementsByTag("a"); |
| | | for (Iterator<Element> its1 = names.iterator(); its1.hasNext(); ) { |
| | | Element videoItem = its1.next(); |
| | | String name = videoItem.getElementsByClass("rvi__tit1").attr("title"); |
| | | totalRanks.add(name); |
| | | } |
| | | } |
| | | if(totalRanks.size()>count){ |
| | | totalRanks = totalRanks.subList(0,10); |
| | | } |
| | | map.put("总榜", totalRanks); |
| | | } |
| | | map.put(title, list); |
| | | } |
| | | |
| | | String url = "https://mesh.if.iqiyi.com/portal/pcw/rankList/comRankList?v=1&device=00d26e3cdde103b885d820f1545bd66a&auth=&uid=&ip=202.108.14.240&refresh=0&server=false"; |
| | | String result = HttpUtil.get(url); |
| | | JSONObject resultJSON = JSONObject.fromObject(result); |
| | | if (resultJSON.optInt("code") == 0) { |
| | | JSONArray typesItem = resultJSON.optJSONObject("data").optJSONArray("items"); |
| | | for (int i = 0; i < typesItem.size(); i++) { |
| | | String type = typesItem.optJSONObject(i).optString("name"); |
| | | if(type.contains("更多")){ |
| | | continue; |
| | | } |
| | | List<String> tempList = new ArrayList<>(); |
| | | JSONArray cards = typesItem.optJSONObject(i).optJSONArray("cards"); |
| | | if (cards != null && cards.size() > 0) { |
| | | cards = cards.optJSONObject(0).optJSONArray("contents"); |
| | | for (int c = 0; c < cards.size(); c++) { |
| | | String title = cards.optJSONObject(c).optString("title"); |
| | | tempList.add(title); |
| | | } |
| | | if(tempList.size()>count){ |
| | | tempList = tempList.subList(0,10); |
| | | } |
| | | map.put(type.replace("榜",""),tempList); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | return map; |
| | |
| | | private VideoResourceUtil videoResourceUtil; |
| | | |
| | | |
| | | @Cacheable(value = "homeCache", key = "'getPlayUrl'+'-'+#detailSystemId+'-'+#id+'-'+#type+'-'+#resourceid") |
| | | @Cacheable(value = "homeCache", key = "'getPlayUrl'+'-'+#acceptData.version+'-'+#detailSystemId+'-'+#id+'-'+#type+'-'+#resourceid") |
| | | public PlayUrl getPlayUrl(AcceptData acceptData, String detailSystemId, String id, String type, int resourceid, String videoid) throws VideoPlayException { |
| | | playLogger.info(VideoLogFactory.createPlayUrlLog(detailSystemId, id, type, resourceid, videoid)); |
| | | //判断resourceId是否在允许播放的来源列表中 |
| | | |
| | | List<Long> resourceIds = videoResourceUtil.getAvailablePlayResourceIds(new DetailSystem(detailSystemId), acceptData.getVersion(), acceptData.getChannel()); |
| | | |
| | | if (resourceIds == null || !resourceIds.contains(Long.parseLong(resourceid + ""))) { |
| | | throw new VideoPlayException(1, "指定播放源无法播放"); |
| | | } |
| | |
| | | playUrl = funTV2Service.getPlayUrl(acceptData, detailSystemId, resourceid, id, videoid); |
| | | break; |
| | | case FunTVUtil.RESOURCE_ID: |
| | | playUrl = funTVService.getPlayUrl(detailSystemId, id, type, resourceid, videoid); |
| | | playUrl = funTVService.getPlayUrl(detailSystemId, id, type, resourceid, videoid, acceptData.getChannel(), acceptData.getVersion()); |
| | | break; |
| | | case SoHuUtil.RESOURCE_ID: |
| | | playUrl = soHuUtil.getPlayUrl(detailSystemId, resourceid + "", type, id); |
| | |
| | | package com.yeshi.buwan.util.video.web; |
| | | |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
| | | import org.jsoup.nodes.Element; |
| | | import org.jsoup.select.Elements; |
| | | import org.yeshi.utils.HttpUtil; |
| | | import net.sf.json.JSONObject; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | |
| | | |
| | | public class TencentWebUtil { |
| | | |
| | | final public static Map<String,Integer> CHANNEL_ID_MAP=new HashMap<>(); |
| | | static{ |
| | | CHANNEL_ID_MAP.put("电影",100173); |
| | | CHANNEL_ID_MAP.put("电视剧",100113); |
| | | CHANNEL_ID_MAP.put("动漫",100119); |
| | | } |
| | | |
| | | public static class TencentWebVideoInfo { |
| | | private String playUrl; |
| | | private String id; |
| | | private String title; |
| | | private String picture; |
| | | private String duration; |
| | | private String tag; |
| | | private String epsodePubtime; |
| | | |
| | | public String getEpsodePubtime() { |
| | | return epsodePubtime; |
| | | } |
| | | |
| | | public void setEpsodePubtime(String epsodePubtime) { |
| | | this.epsodePubtime = epsodePubtime; |
| | | } |
| | | |
| | | public String getPlayUrl() { |
| | | return playUrl; |
| | |
| | | public void setDuration(String duration) { |
| | | this.duration = duration; |
| | | } |
| | | |
| | | public String getTag() { |
| | | return tag; |
| | | } |
| | | |
| | | public void setTag(String tag) { |
| | | this.tag = tag; |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | /** |
| | | * 获取短视频列表 |
| | | * |
| | | * @param params |
| | | * @param page |
| | | * @param channelId 100173:电影 100113:电视剧 100119:动漫 |
| | | * @param pageIndex |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static List<TencentWebVideoInfo> getVideoList(Map<String, String> params, int page) throws Exception { |
| | | if (params == null) |
| | | throw new Exception("参数为空"); |
| | | int pageSize = 30; |
| | | params.put("append", "1"); |
| | | params.put("listpage", page + ""); |
| | | params.put("offset", (page - 1) * pageSize + ""); |
| | | params.put("pagesize", pageSize + ""); |
| | | |
| | | String url = "https://v.qq.com/x/bu/pagesheet/list"; |
| | | public static List<TencentWebVideoInfo> getVideoList(int channelId, int pageIndex, Integer areaId) throws Exception { |
| | | List<TencentWebVideoInfo> videoList=new ArrayList<>(); |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("referer", "https://v.qq.com/channel/ent"); |
| | | headers.put("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36"); |
| | | String result = HttpUtil.get(url, params, headers); |
| | | Document document = Jsoup.parse(result); |
| | | Elements els = document.getElementsByClass("list_item"); |
| | | return parseVideoList(els); |
| | | } |
| | | |
| | | |
| | | public static List<TencentWebVideoInfo> getVideoList(String url) throws Exception { |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("referer", "https://v.qq.com/channel/ent"); |
| | | headers.put("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36"); |
| | | String result = HttpUtil.get(url, new HashMap<>(), headers); |
| | | Document document = Jsoup.parse(result); |
| | | Elements els = document.getElementsByClass("list_item"); |
| | | return parseVideoList(els); |
| | | } |
| | | |
| | | private static List<TencentWebVideoInfo> parseVideoList(Elements els) throws UnsupportedEncodingException { |
| | | List<TencentWebVideoInfo> list = new ArrayList<>(); |
| | | for (int i = 0; i < els.size(); i++) { |
| | | Element ele = els.get(i); |
| | | String href = ele.getElementsByTag("a").get(0).attr("href"); |
| | | String id = ele.getElementsByTag("a").get(0).attr("data-float"); |
| | | String title = ele.getElementsByTag("a").get(0).attr("title"); |
| | | title = new String(title.getBytes("ISO-8859-1"), "UTF-8"); |
| | | String picture = ele.getElementsByTag("img").get(0).attr("src"); |
| | | picture = picture.startsWith("http") ? picture : "https:" + picture; |
| | | String duration = null; |
| | | try { |
| | | duration = ele.getElementsByClass("figure_caption").get(0).ownText(); |
| | | duration = duration.trim(); |
| | | for (int j = 0; j < duration.length(); j++) { |
| | | char ca = duration.charAt(j); |
| | | if (!(ca >= 48 && ca < 59)) { |
| | | duration = null; |
| | | break; |
| | | } |
| | | } |
| | | System.out.println(duration); |
| | | } catch (Exception e) { |
| | | } |
| | | TencentWebVideoInfo videoInfo = new TencentWebVideoInfo(); |
| | | videoInfo.setDuration(duration); |
| | | videoInfo.setId(id); |
| | | videoInfo.setPicture(picture); |
| | | videoInfo.setPlayUrl(href); |
| | | videoInfo.setTitle(title); |
| | | list.add(videoInfo); |
| | | headers.put("Content-Type", "application/json; charset=utf-8"); |
| | | headers.put("Referer", "https://v.qq.com/"); |
| | | String text = |
| | | "{\"page_context\":{\"page_index\":\"1\"},\"page_params\":{\"page_id\":\"channel_list_second_page\",\"page_type\":\"operation\",\"channel_id\":\"100173\",\"filter_params\":\"sort=75\",\"page\":\"1\",\"new_mark_label_enabled\":\"1\"},\"page_bypass_params\":{\"params\":{\"page_id\":\"channel_list_second_page\",\"page_type\":\"operation\",\"channel_id\":\"100173\",\"filter_params\":\"sort=75\",\"page\":\"1\",\"caller_id\":\"3000010\",\"platform_id\":\"2\",\"data_mode\":\"default\",\"user_mode\":\"default\"},\"scene\":\"operation\",\"abtest_bypass_id\":\"77fef11ab0ccd4ee\"}}"; |
| | | JSONObject params=JSONObject.fromObject(text); |
| | | params.optJSONObject("page_context").put("page_index",pageIndex+""); |
| | | params.optJSONObject("page_params").put("channel_id",channelId+""); |
| | | params.optJSONObject("page_params").put("page",pageIndex+""); |
| | | if(areaId!=null) { |
| | | params.optJSONObject("page_params").put("filter_params", params.optJSONObject("page_params").get("filter_params") + "&iarea=" + areaId); |
| | | } |
| | | return list; |
| | | params.optJSONObject("page_bypass_params").optJSONObject("params").put("page",pageIndex+""); |
| | | params.optJSONObject("page_bypass_params").optJSONObject("params").put("channel_id",channelId+""); |
| | | |
| | | String result = com.yeshi.buwan.util.HttpUtil.post("https://pbaccess.video.qq.com/trpc.vector_layout.page_view.PageService/getPage?video_appid=3000010", params.toString(), headers); |
| | | |
| | | |
| | | com.alibaba.fastjson.JSONObject resultJson = com.alibaba.fastjson.JSONObject.parseObject(result); |
| | | if (resultJson.getInteger("ret") == 0) { |
| | | |
| | | com.alibaba.fastjson.JSONObject data = resultJson.getJSONObject("data"); |
| | | com.alibaba.fastjson.JSONArray array = data.getJSONArray("CardList"); |
| | | for (int i = 0; i < array.size(); i++) { |
| | | if (array.getJSONObject(i).getString("type").equalsIgnoreCase("channel_list_poster")) { |
| | | array = array.getJSONObject(i).getJSONObject("children_list").getJSONObject("list").getJSONArray("cards"); |
| | | for (int j = 0; j < array.size(); j++) { |
| | | if (array.getJSONObject(j).getString("type").equalsIgnoreCase("channel_list_poster")) { |
| | | com.alibaba.fastjson.JSONObject item = array.getJSONObject(j).getJSONObject("params"); |
| | | TencentWebVideoInfo video = parseListItem(item); |
| | | videoList.add(video); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | return videoList; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public static String getApiUrl(String webUrl, int page) { |
| | | Map<String, String> params = parseParams(webUrl); |
| | |
| | | return url + "?" + StringUtil.concat(paramsList, "&"); |
| | | } |
| | | |
| | | private static TencentWebVideoInfo parseListItem(com.alibaba.fastjson.JSONObject item) { |
| | | TencentWebVideoInfo videoInfo = new TencentWebVideoInfo(); |
| | | videoInfo.setId(item.getString("cid")); |
| | | videoInfo.setPicture(item.getString("new_pic_vt")); |
| | | videoInfo.setPlayUrl(String.format("https://v.qq.com/x/cover/%s.html", videoInfo.getId())); |
| | | videoInfo.setTitle(item.getString("title")); |
| | | videoInfo.setDuration(""); |
| | | if (item.getInteger("type") != 1) { |
| | | videoInfo.setTag(item.getString("timelong")); |
| | | } else { |
| | | JSONObject imgTag = JSONObject.fromObject(item.getString("uni_imgtag")); |
| | | for (Object key : imgTag.keySet()) { |
| | | JSONObject imgTagItem = imgTag.optJSONObject(key.toString()); |
| | | if (imgTagItem.optInt("id") == 28) { |
| | | videoInfo.setTag(imgTagItem.optString("text")); |
| | | } |
| | | } |
| | | if(videoInfo.getTag()==null){ |
| | | videoInfo.setTag("9.0分"); |
| | | } |
| | | } |
| | | videoInfo.setEpsodePubtime(item.getString("epsode_pubtime")); |
| | | return videoInfo; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | List<TencentWebVideoInfo> videoInfos = getVideoList(parseParams("https://v.qq.com/channel/ent?_all=1&channel=ent&iarea=2&itype=-1&listpage=1&sort=40"), 1); |
| | | System.out.println(videoInfos); |
| | | |
| | | List<TencentWebVideoInfo> list = getVideoList(100173,0, 100028); |
| | | System.out.println(list.size()); |
| | | |
| | | } |
| | | } |
| | |
| | | import javax.script.ScriptException; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public class BilibiliApiUtil { |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 网页链接:https://www.bilibili.com/guochuang/index/ |
| | | * @param type |
| | | * @param order 2-追番人数 |
| | | * @param order 3-追番人数 |
| | | * @param page 0-最近更新 |
| | | * @return |
| | | */ |
| | |
| | | } |
| | | |
| | | private static String parsePageData(String url) throws ScriptException, NoSuchMethodException, IOException { |
| | | Document doc = Jsoup.connect(url).userAgent("Dalvik/2.1.0 (Linux; U; Android 9; MI 8 Lite MIUI/V10.2.3.0.PDTCNXM)").timeout(30000).get(); |
| | | Elements els = doc.getElementsByTag("script"); |
| | | for (int i = 0; i < els.size(); i++) { |
| | | if (els.get(i).html().indexOf("window.__INITIAL_STATE__") > -1) { |
| | | String script = els.get(i).html(); |
| | | System.out.println(script); |
| | | String result = getPageData(script); |
| | | return result; |
| | | } |
| | | } |
| | | return null; |
| | | Map<String,String> headers=new HashMap<>(); |
| | | headers.put("User-Agent","Dalvik/2.1.0 (Linux; U; Android 9; MI 8 Lite MIUI/V10.2.3.0.PDTCNXM)"); |
| | | String result_str = org.yeshi.utils.HttpUtil.get(url,new HashMap<>(),headers); |
| | | int start_index = result_str.indexOf("window.__INITIAL_STATE__="); |
| | | result_str= result_str.substring(start_index); |
| | | int endIndex = result_str.indexOf( "</script>"); |
| | | |
| | | String script = result_str.substring(0,endIndex); |
| | | String result = getPageData(script); |
| | | return result; |
| | | |
| | | // |
| | | // Document doc = Jsoup.connect(url).userAgent("").timeout(30000).get(); |
| | | // Elements els = doc.getElementsByTag("script"); |
| | | // for (int i = 0; i < els.size(); i++) { |
| | | // if (els.get(i).html().indexOf("window.__INITIAL_STATE__=") > -1) { |
| | | // String script = els.get(i).html(); |
| | | // System.out.println(script); |
| | | // String result = getPageData(script); |
| | | // return result; |
| | | // } |
| | | // } |
| | | // return null; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) throws IOException, ScriptException, NoSuchMethodException { |
| | | MediaUrlResult result = getMediaList(BilibiliUtil.TYPE_DIANSHIJU, 2, 1); |
| | | System.out.println(result); |
| | | public static void main(String[] args) throws Exception { |
| | | MediaUrlResult result = getMediaList(BilibiliUtil.TYPE_GUOMAN, 3, 1); |
| | | // parseMediaInfo("https://www.bilibili.com/bangumi/play/ss28747"); |
| | | // System.out.println(result); |
| | | } |
| | | |
| | | public static class MediaUrlResult { |
| | |
| | | import javax.xml.parsers.DocumentBuilder; |
| | | import javax.xml.parsers.DocumentBuilderFactory; |
| | | |
| | | import com.yeshi.buwan.util.NumberUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import org.w3c.dom.Document; |
| | | import org.w3c.dom.Element; |
| | |
| | | } else if ("area".equalsIgnoreCase(contents.item(j).getNodeName())) { |
| | | video.setArea(value); |
| | | } else if ("all".equalsIgnoreCase(contents.item(j).getNodeName())) { |
| | | video.setAll(Integer.parseInt(value)); |
| | | if(NumberUtil.isNumeric(value)) { |
| | | video.setAll(Integer.parseInt(value)); |
| | | } |
| | | } else if ("att".equalsIgnoreCase(contents.item(j).getNodeName())) { |
| | | video.setAtt(value); |
| | | } else if ("comment".equalsIgnoreCase(contents.item(j).getNodeName())) { |
File was renamed from src/main/java/com/yeshi/buwan/videos/funtv/FunTVAlbumFactory.java |
| | |
| | | import com.yeshi.buwan.videos.funtv.vo.*; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | import scala.Int; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | public class FunTVAlbumFactory { |
| | | public class FunTVFactory { |
| | | |
| | | public static FunTVAlbum create(FunTVCartoonAlbum album) { |
| | | FunTVAlbum ab = new FunTVAlbum(); |
| | |
| | | ab.setVideoList(list); |
| | | return ab; |
| | | } |
| | | |
| | | public static FunTVAlbum create(FunTVWebApiUtil.FunTVWebAlbum webAlbum){ |
| | | FunTVAlbum album = new FunTVAlbum(); |
| | | album.setHpicture(webAlbum.getStill()); |
| | | album.setVpicture(webAlbum.getPoster()); |
| | | album.setAid(webAlbum.getId()); |
| | | album.setTitle(webAlbum.getName()); |
| | | String releaseTime = webAlbum.getRelease().replace("年","-").replace("月","-").replace("日",""); |
| | | String[] rs = releaseTime.split("-"); |
| | | String ftime=""; |
| | | ftime +=rs[0]; |
| | | ftime+="-"; |
| | | if(rs[1].length()<2){ |
| | | ftime+="0"; |
| | | } |
| | | ftime+=rs[1]; |
| | | |
| | | ftime+="-"; |
| | | if(rs[2].length()<2){ |
| | | ftime+="0"; |
| | | } |
| | | ftime+=rs[2]; |
| | | album.setPublishTime(ftime); |
| | | album.setActor(webAlbum.getActor()); |
| | | album.setDir(webAlbum.getDirector()); |
| | | album.setArea(webAlbum.getArea()); |
| | | album.setAll(webAlbum.getTotalEpisodesCount()); |
| | | album.setLatest(webAlbum.getNowEpisodesCount()); |
| | | album.setDesc(webAlbum.getDescription()); |
| | | album.setVideoType(webAlbum.getChannel()); |
| | | return album; |
| | | } |
| | | |
| | | |
| | | public static FunTVVideo create(FunTVWebApiUtil.FunTVWebEpisode episode,FunTVAlbum album ){ |
| | | FunTVVideo video = new FunTVVideo(); |
| | | video.setVid(episode.getId()); |
| | | video.setAid(album.getAid()); |
| | | video.setCate(album.getVideoType()); |
| | | String[] ds = episode.getDuration().split(":"); |
| | | video.setTime(Integer.parseInt(ds[0])*60 + Integer.parseInt(ds[1])); |
| | | video.setPlayUrl(String.format("https://www.fun.tv/vplay/g-%s.v-%s/",album.getAid(), episode.getId() )); |
| | | video.setPlayMUrl(video.getPlayUrl()); |
| | | video.setTitle(album.getTitle()); |
| | | video.setTag(episode.getNum()); |
| | | video.setImg(episode.getStill()); |
| | | video.setNum(Integer.parseInt(episode.getNum())); |
| | | video.setPublishTime(album.getPublishTime()); |
| | | video.setDesc(album.getDesc()); |
| | | video.setOrder(Integer.parseInt(episode.getNum())); |
| | | video.setType(0); |
| | | video.setUpdatetime(TimeUtil.getGernalTime(System.currentTimeMillis(),"yyyy-MM-dd HH:mm:ss")); |
| | | return video; |
| | | } |
| | | } |
| | |
| | | // 加入videoInfo |
| | | try { |
| | | funTVService.saveVideo(funTVVideo);// 存入数据库 |
| | | //todo 拉取数据的时候不处理 |
| | | //拉取数据的时候不处理 |
| | | // funTVVideo.setId(funTVService.getFunTVVideoByVid(funTVVideo.getVid()).getId()); |
| | | // funTVService.addVideoToVideoInfo(funTVVideo); |
| | | } catch (Exception e) { |
| | | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | |
| | | } else if (m.getOp().equalsIgnoreCase("add")) { |
| | | FunTVAlbum album = null; |
| | | if (m instanceof FunTVTVAlbum) { |
| | | album = FunTVAlbumFactory.create((FunTVTVAlbum) m); |
| | | album = FunTVFactory.create((FunTVTVAlbum) m); |
| | | } else if (m instanceof FunTVCartoonAlbum) { |
| | | album = FunTVAlbumFactory.create((FunTVCartoonAlbum) m); |
| | | album = FunTVFactory.create((FunTVCartoonAlbum) m); |
| | | } else if (m instanceof FunTVShowAlbum) { |
| | | album = FunTVAlbumFactory.create((FunTVShowAlbum) m); |
| | | album = FunTVFactory.create((FunTVShowAlbum) m); |
| | | } |
| | | saveFunTVAlbum(album); |
| | | } |
| | |
| | | * |
| | | * @param m |
| | | */ |
| | | private void processVideo(FunTVBaseVideo m) { |
| | | public FunTVVideo processVideo(FunTVBaseVideo m) { |
| | | if (m.getOp().equalsIgnoreCase("add")) { |
| | | FunTVVideo video = null; |
| | | if (m instanceof FunTVMovieVideo) { |
| | |
| | | video = FunTVVideoFactory.create((FunTVShortVideo) m); |
| | | } |
| | | addFunTVVideo(video); |
| | | return video; |
| | | } else if (m.getOp().equalsIgnoreCase("del")) { |
| | | funTVService.deleteVideoByVid(m.getVid()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | |
| | | // 加入videoInfo |
| | | try { |
| | | funTVService.saveVideo(funTVVideo);// 存入数据库 |
| | | //todo 拉取数据的时候不处理 |
| | | //拉取数据的时候不处理 |
| | | // funTVVideo.setId(funTVService.getFunTVVideoByVid(funTVVideo.getVid()).getId()); |
| | | // funTVService.addVideoToVideoInfo(funTVVideo); |
| | | } catch (Exception e) { |
New file |
| | |
| | | package com.yeshi.buwan.videos.funtv; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.yeshi.buwan.util.HttpUtil; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: FunTVWebApiUtil |
| | | * @description: 风行网页爬虫接口 |
| | | * @date 2024/9/2 17:32 |
| | | */ |
| | | public class FunTVWebApiUtil { |
| | | public final static String MOVIE_FREE = "http://www.fun.tv/retrieve/c-e794b5e5bdb1.n-e5bdb1e78987.p-e5858de8b4b9.pg-{page}.uc-469.v-e5858de8b4b9?isajax=1"; |
| | | |
| | | |
| | | public static List<String> requestList(String url) throws Exception { |
| | | String result = HttpUtil.get(url); |
| | | JSONObject root = JSONObject.fromObject(result); |
| | | if (root.optInt("status") != 200) { |
| | | throw new Exception("接口请求出错"); |
| | | } |
| | | List<String> mediaIds=new ArrayList<>(); |
| | | JSONArray array = root.optJSONObject("data").optJSONObject("data").optJSONArray("ritems"); |
| | | for(int i=0;i<array.size();i++){ |
| | | mediaIds.add(array.optJSONObject(i).optString("mediaid")); |
| | | } |
| | | return mediaIds; |
| | | } |
| | | |
| | | private static List<FunTVWebEpisode> requestEpisodes(String aid, FunTVWebAlbum album) throws Exception { |
| | | String url = String.format("https://pm.funshion.com/v5/media/episode?id=%s&ves=1&fudid=%sa0f&cl=mweb&uc=471", aid, System.currentTimeMillis()/1000); |
| | | String result = HttpUtil.get(url); |
| | | JSONObject root = JSONObject.fromObject(result); |
| | | if(root.optInt("retcode")!=200){ |
| | | throw new Exception(root.optString("retmsg")); |
| | | } |
| | | if(album!=null){ |
| | | album.setTotalEpisodesCount(root.optInt("totalnum")); |
| | | album.setNowEpisodesCount(root.optInt("total")); |
| | | } |
| | | List<FunTVWebEpisode> episodes = new Gson().fromJson(root.optJSONArray("episodes").toString(),new TypeToken<List<FunTVWebEpisode>>(){}.getType()); |
| | | if(album!=null) { |
| | | album.setEpisodes(episodes); |
| | | } |
| | | return episodes; |
| | | } |
| | | |
| | | private static FunTVWebAlbum requestDetail(String aid) throws Exception { |
| | | String url = String.format(" https://pm.funshion.com/v5/media/profile?id=%s&ves=1&fudid=%sa0f&cl=mweb&uc=471", aid, System.currentTimeMillis()/1000); |
| | | String result = HttpUtil.get(url); |
| | | JSONObject root = JSONObject.fromObject(result); |
| | | if(root.optInt("retcode")!=200){ |
| | | throw new Exception(root.optString("retmsg")); |
| | | } |
| | | return new Gson().fromJson(result, FunTVWebAlbum.class); |
| | | } |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @description 获取风行专辑详情 |
| | | * @date 10:13 2024/9/3 |
| | | * @param: aid |
| | | * @return com.yeshi.buwan.videos.funtv.FunTVWebApiUtil.FunTVWebAlbum |
| | | **/ |
| | | public static FunTVWebAlbum getAlbumDetail(String aid) throws Exception { |
| | | FunTVWebAlbum album = requestDetail(aid); |
| | | requestEpisodes(aid, album); |
| | | return album; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | List<String> list = requestList(MOVIE_FREE.replace("{page}", "1")); |
| | | FunTVWebAlbum album = requestDetail(list.get(0)); |
| | | FunTVFactory.create(album); |
| | | System.out.println(album); |
| | | } |
| | | |
| | | public static class FunTVWebAlbum { |
| | | // 专辑详情 |
| | | /** |
| | | * id : 312157 |
| | | * name : 小熊的夏天 |
| | | * score : 7.1 |
| | | * still : https://img1.funshion.com/sdw?oid=bb6c4f9fc446b85b9773b4c7546153db&w=0&h=0 |
| | | * poster : https://img1.funshion.com/sdw?oid=4f69ccc33c595a4ff6351e031c8ce1e0&w=0&h=0 |
| | | * director : 杨铭 |
| | | * actor : 姜超,陈婷,孙桂田,李大川,王怡婷,于泽凯,申屠韩茜,赵敏萱,徐振皓,向睿达,高昕玥 |
| | | * aword : 马大哈老师和熊孩子 |
| | | * description : 《小熊的夏天》:影片主要讲述了园长晨璐为了改变以往的幼儿教育方式,从而有了野外实地教育活动。大巴车载着孩子们伴随着歌声上了路,就在大家还沉浸在对体验式出游的无限憧憬和兴奋中时,班里的淘气大王丁哥却神秘失踪…… |
| | | * release : 2016年10月14日 |
| | | * update : |
| | | * area : 中国内地 |
| | | * category : 喜剧 |
| | | * channel : 电影 |
| | | * channel_id : 1 |
| | | * share : https://pm.funshion.com/v5/media/share?id=312157 |
| | | * wx_share_icon : |
| | | * teacher_id : |
| | | * teacher : |
| | | * teachers : [] |
| | | * detail : |
| | | * detail_pics : [] |
| | | * pay : 0 |
| | | * isvip : 0 |
| | | * isfee : 0 |
| | | * is_limitfree : 0 |
| | | * inspiread_unlock_cnt : 0 |
| | | * monetize : |
| | | * promotion_drain_info : null |
| | | * promotion_drain_app_qr : |
| | | * is_sole : 0 |
| | | * isdisabled : 0 |
| | | * isend : 1 |
| | | * is_vip_copyright : 0 |
| | | */ |
| | | |
| | | private String id; |
| | | private String name; |
| | | private String score; |
| | | private String still; |
| | | private String poster; |
| | | private String director; |
| | | private String actor; |
| | | private String aword; |
| | | private String description; |
| | | private String release; |
| | | private String update; |
| | | private String area; |
| | | private String category; |
| | | private String channel; |
| | | private String channel_id; |
| | | private String share; |
| | | private String wx_share_icon; |
| | | private String teacher_id; |
| | | private String teacher; |
| | | private String detail; |
| | | private String pay; |
| | | private String isvip; |
| | | private String isfee; |
| | | private String is_limitfree; |
| | | private String inspiread_unlock_cnt; |
| | | private String monetize; |
| | | private Object promotion_drain_info; |
| | | private String promotion_drain_app_qr; |
| | | private String is_sole; |
| | | private String isdisabled; |
| | | private String isend; |
| | | private String is_vip_copyright; |
| | | private List<?> teachers; |
| | | private List<?> detail_pics; |
| | | |
| | | // 新增加的数据 |
| | | private List<FunTVWebEpisode> episodes; |
| | | private int totalEpisodesCount; |
| | | private int nowEpisodesCount; |
| | | |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getScore() { |
| | | return score; |
| | | } |
| | | |
| | | public void setScore(String score) { |
| | | this.score = score; |
| | | } |
| | | |
| | | public String getStill() { |
| | | return still; |
| | | } |
| | | |
| | | public void setStill(String still) { |
| | | this.still = still; |
| | | } |
| | | |
| | | public String getPoster() { |
| | | return poster; |
| | | } |
| | | |
| | | public void setPoster(String poster) { |
| | | this.poster = poster; |
| | | } |
| | | |
| | | public String getDirector() { |
| | | return director; |
| | | } |
| | | |
| | | public void setDirector(String director) { |
| | | this.director = director; |
| | | } |
| | | |
| | | public String getActor() { |
| | | return actor; |
| | | } |
| | | |
| | | public void setActor(String actor) { |
| | | this.actor = actor; |
| | | } |
| | | |
| | | public String getAword() { |
| | | return aword; |
| | | } |
| | | |
| | | public void setAword(String aword) { |
| | | this.aword = aword; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | |
| | | public void setDescription(String description) { |
| | | this.description = description; |
| | | } |
| | | |
| | | public String getRelease() { |
| | | return release; |
| | | } |
| | | |
| | | public void setRelease(String release) { |
| | | this.release = release; |
| | | } |
| | | |
| | | public String getUpdate() { |
| | | return update; |
| | | } |
| | | |
| | | public void setUpdate(String update) { |
| | | this.update = update; |
| | | } |
| | | |
| | | public String getArea() { |
| | | return area; |
| | | } |
| | | |
| | | public void setArea(String area) { |
| | | this.area = area; |
| | | } |
| | | |
| | | public String getCategory() { |
| | | return category; |
| | | } |
| | | |
| | | public void setCategory(String category) { |
| | | this.category = category; |
| | | } |
| | | |
| | | public String getChannel() { |
| | | return channel; |
| | | } |
| | | |
| | | public void setChannel(String channel) { |
| | | this.channel = channel; |
| | | } |
| | | |
| | | public String getChannel_id() { |
| | | return channel_id; |
| | | } |
| | | |
| | | public void setChannel_id(String channel_id) { |
| | | this.channel_id = channel_id; |
| | | } |
| | | |
| | | public String getShare() { |
| | | return share; |
| | | } |
| | | |
| | | public void setShare(String share) { |
| | | this.share = share; |
| | | } |
| | | |
| | | public String getWx_share_icon() { |
| | | return wx_share_icon; |
| | | } |
| | | |
| | | public void setWx_share_icon(String wx_share_icon) { |
| | | this.wx_share_icon = wx_share_icon; |
| | | } |
| | | |
| | | public String getTeacher_id() { |
| | | return teacher_id; |
| | | } |
| | | |
| | | public void setTeacher_id(String teacher_id) { |
| | | this.teacher_id = teacher_id; |
| | | } |
| | | |
| | | public String getTeacher() { |
| | | return teacher; |
| | | } |
| | | |
| | | public void setTeacher(String teacher) { |
| | | this.teacher = teacher; |
| | | } |
| | | |
| | | public String getDetail() { |
| | | return detail; |
| | | } |
| | | |
| | | public void setDetail(String detail) { |
| | | this.detail = detail; |
| | | } |
| | | |
| | | public String getPay() { |
| | | return pay; |
| | | } |
| | | |
| | | public void setPay(String pay) { |
| | | this.pay = pay; |
| | | } |
| | | |
| | | public String getIsvip() { |
| | | return isvip; |
| | | } |
| | | |
| | | public void setIsvip(String isvip) { |
| | | this.isvip = isvip; |
| | | } |
| | | |
| | | public String getIsfee() { |
| | | return isfee; |
| | | } |
| | | |
| | | public void setIsfee(String isfee) { |
| | | this.isfee = isfee; |
| | | } |
| | | |
| | | public String getIs_limitfree() { |
| | | return is_limitfree; |
| | | } |
| | | |
| | | public void setIs_limitfree(String is_limitfree) { |
| | | this.is_limitfree = is_limitfree; |
| | | } |
| | | |
| | | public String getInspiread_unlock_cnt() { |
| | | return inspiread_unlock_cnt; |
| | | } |
| | | |
| | | public void setInspiread_unlock_cnt(String inspiread_unlock_cnt) { |
| | | this.inspiread_unlock_cnt = inspiread_unlock_cnt; |
| | | } |
| | | |
| | | public String getMonetize() { |
| | | return monetize; |
| | | } |
| | | |
| | | public void setMonetize(String monetize) { |
| | | this.monetize = monetize; |
| | | } |
| | | |
| | | public Object getPromotion_drain_info() { |
| | | return promotion_drain_info; |
| | | } |
| | | |
| | | public void setPromotion_drain_info(Object promotion_drain_info) { |
| | | this.promotion_drain_info = promotion_drain_info; |
| | | } |
| | | |
| | | public String getPromotion_drain_app_qr() { |
| | | return promotion_drain_app_qr; |
| | | } |
| | | |
| | | public void setPromotion_drain_app_qr(String promotion_drain_app_qr) { |
| | | this.promotion_drain_app_qr = promotion_drain_app_qr; |
| | | } |
| | | |
| | | public String getIs_sole() { |
| | | return is_sole; |
| | | } |
| | | |
| | | public void setIs_sole(String is_sole) { |
| | | this.is_sole = is_sole; |
| | | } |
| | | |
| | | public String getIsdisabled() { |
| | | return isdisabled; |
| | | } |
| | | |
| | | public void setIsdisabled(String isdisabled) { |
| | | this.isdisabled = isdisabled; |
| | | } |
| | | |
| | | public String getIsend() { |
| | | return isend; |
| | | } |
| | | |
| | | public void setIsend(String isend) { |
| | | this.isend = isend; |
| | | } |
| | | |
| | | public String getIs_vip_copyright() { |
| | | return is_vip_copyright; |
| | | } |
| | | |
| | | public void setIs_vip_copyright(String is_vip_copyright) { |
| | | this.is_vip_copyright = is_vip_copyright; |
| | | } |
| | | |
| | | public List<?> getTeachers() { |
| | | return teachers; |
| | | } |
| | | |
| | | public void setTeachers(List<?> teachers) { |
| | | this.teachers = teachers; |
| | | } |
| | | |
| | | public List<?> getDetail_pics() { |
| | | return detail_pics; |
| | | } |
| | | |
| | | public void setDetail_pics(List<?> detail_pics) { |
| | | this.detail_pics = detail_pics; |
| | | } |
| | | |
| | | public List<FunTVWebEpisode> getEpisodes() { |
| | | return episodes; |
| | | } |
| | | |
| | | public void setEpisodes(List<FunTVWebEpisode> episodes) { |
| | | this.episodes = episodes; |
| | | } |
| | | |
| | | public int getTotalEpisodesCount() { |
| | | return totalEpisodesCount; |
| | | } |
| | | |
| | | public void setTotalEpisodesCount(int totalEpisodesCount) { |
| | | this.totalEpisodesCount = totalEpisodesCount; |
| | | } |
| | | |
| | | public int getNowEpisodesCount() { |
| | | return nowEpisodesCount; |
| | | } |
| | | |
| | | public void setNowEpisodesCount(int nowEpisodesCount) { |
| | | this.nowEpisodesCount = nowEpisodesCount; |
| | | } |
| | | } |
| | | |
| | | |
| | | public static class FunTVWebEpisode { |
| | | /** |
| | | * id : 1540857 |
| | | * name : 惊涛迷局 |
| | | * num : 1 |
| | | * still : https://img.funshion.com/sdw?oid=f3b9cd457c64ec97934ad7ff3104e179&w=0&h=0 |
| | | * duration : 102:39 |
| | | * clip_duration : 6:00 |
| | | * total_vv : 0 |
| | | * isvip : 1 |
| | | * isfee : 0 |
| | | * license : 登记号:08290040004022803 |
| | | * display_ratio : 2.437 |
| | | * license_corner : http://img2.funshion.com/sdw?oid=d5af6f98846742719c26bf30349784f2&w=0&h=0 |
| | | * isnew : 0 |
| | | * is_watch_inspiread : 0 |
| | | * is_limitfree : 0 |
| | | * is_vip_copyright : 1 |
| | | * highlight : null |
| | | * inspiread_arealimit : 0 |
| | | * aword : |
| | | * third_media_id : 0 |
| | | * third_episode_id : 0 |
| | | * user_paid : 0 |
| | | * need_pay : 1 |
| | | */ |
| | | |
| | | private String id; |
| | | private String name; |
| | | private String num; |
| | | private String still; |
| | | private String duration; |
| | | private String clip_duration; |
| | | private String total_vv; |
| | | private String isvip; |
| | | private String isfee; |
| | | private String license; |
| | | private String display_ratio; |
| | | private String license_corner; |
| | | private String isnew; |
| | | private String is_watch_inspiread; |
| | | private String is_limitfree; |
| | | private String is_vip_copyright; |
| | | private String inspiread_arealimit; |
| | | private String aword; |
| | | private int third_media_id; |
| | | private int third_episode_id; |
| | | private String user_paid; |
| | | private String need_pay; |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getNum() { |
| | | return num; |
| | | } |
| | | |
| | | public void setNum(String num) { |
| | | this.num = num; |
| | | } |
| | | |
| | | public String getStill() { |
| | | return still; |
| | | } |
| | | |
| | | public void setStill(String still) { |
| | | this.still = still; |
| | | } |
| | | |
| | | public String getDuration() { |
| | | return duration; |
| | | } |
| | | |
| | | public void setDuration(String duration) { |
| | | this.duration = duration; |
| | | } |
| | | |
| | | public String getClip_duration() { |
| | | return clip_duration; |
| | | } |
| | | |
| | | public void setClip_duration(String clip_duration) { |
| | | this.clip_duration = clip_duration; |
| | | } |
| | | |
| | | public String getTotal_vv() { |
| | | return total_vv; |
| | | } |
| | | |
| | | public void setTotal_vv(String total_vv) { |
| | | this.total_vv = total_vv; |
| | | } |
| | | |
| | | public String getIsvip() { |
| | | return isvip; |
| | | } |
| | | |
| | | public void setIsvip(String isvip) { |
| | | this.isvip = isvip; |
| | | } |
| | | |
| | | public String getIsfee() { |
| | | return isfee; |
| | | } |
| | | |
| | | public void setIsfee(String isfee) { |
| | | this.isfee = isfee; |
| | | } |
| | | |
| | | public String getLicense() { |
| | | return license; |
| | | } |
| | | |
| | | public void setLicense(String license) { |
| | | this.license = license; |
| | | } |
| | | |
| | | public String getDisplay_ratio() { |
| | | return display_ratio; |
| | | } |
| | | |
| | | public void setDisplay_ratio(String display_ratio) { |
| | | this.display_ratio = display_ratio; |
| | | } |
| | | |
| | | public String getLicense_corner() { |
| | | return license_corner; |
| | | } |
| | | |
| | | public void setLicense_corner(String license_corner) { |
| | | this.license_corner = license_corner; |
| | | } |
| | | |
| | | public String getIsnew() { |
| | | return isnew; |
| | | } |
| | | |
| | | public void setIsnew(String isnew) { |
| | | this.isnew = isnew; |
| | | } |
| | | |
| | | public String getIs_watch_inspiread() { |
| | | return is_watch_inspiread; |
| | | } |
| | | |
| | | public void setIs_watch_inspiread(String is_watch_inspiread) { |
| | | this.is_watch_inspiread = is_watch_inspiread; |
| | | } |
| | | |
| | | public String getIs_limitfree() { |
| | | return is_limitfree; |
| | | } |
| | | |
| | | public void setIs_limitfree(String is_limitfree) { |
| | | this.is_limitfree = is_limitfree; |
| | | } |
| | | |
| | | public String getIs_vip_copyright() { |
| | | return is_vip_copyright; |
| | | } |
| | | |
| | | public void setIs_vip_copyright(String is_vip_copyright) { |
| | | this.is_vip_copyright = is_vip_copyright; |
| | | } |
| | | |
| | | public String getInspiread_arealimit() { |
| | | return inspiread_arealimit; |
| | | } |
| | | |
| | | public void setInspiread_arealimit(String inspiread_arealimit) { |
| | | this.inspiread_arealimit = inspiread_arealimit; |
| | | } |
| | | |
| | | public String getAword() { |
| | | return aword; |
| | | } |
| | | |
| | | public void setAword(String aword) { |
| | | this.aword = aword; |
| | | } |
| | | |
| | | public int getThird_media_id() { |
| | | return third_media_id; |
| | | } |
| | | |
| | | public void setThird_media_id(int third_media_id) { |
| | | this.third_media_id = third_media_id; |
| | | } |
| | | |
| | | public int getThird_episode_id() { |
| | | return third_episode_id; |
| | | } |
| | | |
| | | public void setThird_episode_id(int third_episode_id) { |
| | | this.third_episode_id = third_episode_id; |
| | | } |
| | | |
| | | public String getUser_paid() { |
| | | return user_paid; |
| | | } |
| | | |
| | | public void setUser_paid(String user_paid) { |
| | | this.user_paid = user_paid; |
| | | } |
| | | |
| | | public String getNeed_pay() { |
| | | return need_pay; |
| | | } |
| | | |
| | | public void setNeed_pay(String need_pay) { |
| | | this.need_pay = need_pay; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.buwan.videos.hanmi; |
| | | |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.videos.hanmi.entity.HanmiShow; |
| | | import com.yeshi.buwan.videos.hanmi.entity.HanmiShowEpisode; |
| | | import org.jsoup.Connection; |
| | |
| | | import org.jsoup.select.Elements; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URI; |
| | | import java.net.URLEncoder; |
| | | import java.util.*; |
| | | |
| | | public class HanmiApiUtil { |
| | |
| | | } |
| | | |
| | | public static HanmiShow parseShowDetail(HanmiShow show) throws Exception { |
| | | if (show.getUrl() == null || !show.getUrl().startsWith("https://www.hmtv.me/show/")) { |
| | | if (show.getUrl() == null || !show.getUrl().startsWith("https://www.wztaichuan.com/vod/detail")) { |
| | | throw new Exception("链接不合法"); |
| | | } |
| | | |
| | | URI uri = URI.create(show.getUrl()); |
| | | |
| | | Document doc = getDoc(show.getUrl(), getHeaders()); |
| | | |
| | | Element root = doc.getElementsByClass("video-content").get(0); |
| | | Element titleItem = root.getElementsByClass("article-title").get(0); |
| | | Element root = doc.getElementsByClass("stui-content__thumb").get(0).parent(); |
| | | |
| | | String picture = doc.getElementsByClass("stui-content__thumb").get(0).getElementsByTag("img").get(0).attr("data-original"); |
| | | |
| | | //节目信息 |
| | | Element videoInfo = root.getElementsByClass("stui-content__detail").get(0); |
| | | |
| | | Element titleItem = videoInfo.getElementsByClass("title").get(0); |
| | | |
| | | //标题 |
| | | String title = null; |
| | | try { |
| | | title = titleItem.getElementsByClass("item-title").get(0).ownText(); |
| | | title = titleItem.ownText(); |
| | | } catch (IndexOutOfBoundsException e) { |
| | | } |
| | | |
| | | String year = null; |
| | | String score = null; |
| | | try { |
| | | year = titleItem.getElementsByClass("item-year").get(0).ownText(); |
| | | score = titleItem.getElementsByClass("score").get(0).ownText(); |
| | | } catch (IndexOutOfBoundsException e) { |
| | | } |
| | | show.setScore(score); |
| | | |
| | | //节目信息 |
| | | Element videoBox = root.getElementsByClass("video_box").get(0); |
| | | |
| | | String picture = videoBox.getElementsByClass("video_img").get(0).getElementsByTag("img").attr("src"); |
| | | |
| | | Element videoInfo = videoBox.getElementsByClass("video_info").get(0); |
| | | String videoInfoStr = videoInfo.html(); |
| | | String[] sts = videoInfoStr.split("<br>"); |
| | | Map<String, String> infos = new HashMap<>(); |
| | | for (String st : sts) { |
| | | Document d = Jsoup.parse(st); |
| | | String value = d.text(); |
| | | if (value.indexOf(":") > -1) |
| | | infos.put(value.substring(0, value.indexOf(":")).trim(), value.substring(value.indexOf(":") + 1).trim()); |
| | | Elements datas = videoInfo.getElementsByClass("data"); |
| | | for(int i=0;i<datas.size();i++){ |
| | | Elements data_items = datas.get(i).getElementsByClass("text-muted"); |
| | | for(int j=0; j<data_items.size(); j++){ |
| | | String key = data_items.get(j).ownText().trim(); |
| | | String value = null; |
| | | switch (key){ |
| | | case "主演:": |
| | | List<String> actors=new ArrayList<>(); |
| | | Elements temps = data_items.get(j).parent().getElementsByTag("a"); |
| | | for(Iterator<Element> its = temps.iterator(); its.hasNext();) |
| | | { |
| | | actors.add( its.next().ownText()); |
| | | } |
| | | value = StringUtil.join(actors, ","); |
| | | break; |
| | | default: |
| | | if(data_items.get(j).nextElementSibling()!=null) { |
| | | value = data_items.get(j).nextElementSibling().ownText(); |
| | | } else{ |
| | | value = data_items.get(j).parent().ownText(); |
| | | } |
| | | } |
| | | infos.put(key,value); |
| | | } |
| | | } |
| | | |
| | | String desc = videoInfo.getElementsByClass("desc").get(0).ownText(); |
| | | //剧集列表 |
| | | Element eposide = root.getElementsByClass("video_list_li").get(0); |
| | | Element eposide = doc.getElementsByClass("playlist").get(0).getElementsByClass("stui-content__playlist").get(0); |
| | | Elements eposides = eposide.getElementsByTag("a"); |
| | | List<HanmiShowEpisode> episodeList = new ArrayList<>(); |
| | | |
| | |
| | | //电影 |
| | | if (show.getType() != null && show.getType().contains("影")) { |
| | | int index = 0; |
| | | // for (int i = 0; i < eposides.size(); i++) { |
| | | // String tag = eposides.get(i).ownText(); |
| | | // if (tag.contains("HD")) { |
| | | // index = i; |
| | | // break; |
| | | // } |
| | | // } |
| | | String href = eposides.get(index).attr("href"); |
| | | HanmiShowEpisode ep = new HanmiShowEpisode(); |
| | | ep.setOrderBy(0); |
| | | ep.setPlayUrl("https://www.hmtv.me" + href); |
| | | ep.setPlayUrl(String.format("%s://%s%s",uri.getScheme(),uri.getHost(),href)); |
| | | ep.setTag(show.getTitle() != null ? show.getTitle() : title); |
| | | episodeList.add(ep); |
| | | } else { |
| | |
| | | String tag = eposides.get(i).ownText(); |
| | | HanmiShowEpisode ep = new HanmiShowEpisode(); |
| | | ep.setOrderBy(i + 1); |
| | | ep.setPlayUrl("https://www.hmtv.me" + href); |
| | | ep.setPlayUrl(String.format("%s://%s%s",uri.getScheme(),uri.getHost(),href)); |
| | | ep.setTag(tag); |
| | | episodeList.add(ep); |
| | | } |
| | | } |
| | | |
| | | //简介 |
| | | String desc = root.getElementsByClass("jianjie").get(0).text(); |
| | | |
| | | |
| | | if (show.getTitle() == null) |
| | | show.setTitle(title.split(" ")[0]); |
| | | |
| | | show.setPicture(picture); |
| | | if (infos.get("主演") != null) |
| | | show.setActors(infos.get("主演"). |
| | | |
| | | if (infos.get("主演:") != null) |
| | | show.setActors(infos.get("主演:"). |
| | | replace("/", ",")); |
| | | if (infos.get("导演") != null) |
| | | show.setDirector(infos.get("导演")); |
| | | if (infos.get("类型") != null) |
| | | show.setCategorys(infos.get("类型")); |
| | | if (infos.get("国家/地区") != null) |
| | | show.setArea(infos.get("国家/地区")); |
| | | if (infos.get("首播") != null) |
| | | show.setRelaseDate(infos.get("首播"). |
| | | |
| | | substring(0, infos.get("首播"). |
| | | |
| | | indexOf("(") > -1 ? infos.get("首播"). |
| | | |
| | | indexOf("(") : infos.get("首播"). |
| | | |
| | | length())); |
| | | if (infos.get("上映日期") != null) { |
| | | show.setRelaseDate(infos.get("上映日期"). |
| | | |
| | | substring(0, infos.get("上映日期"). |
| | | |
| | | indexOf("(") > -1 ? infos.get("上映日期"). |
| | | |
| | | indexOf("(") : infos.get("上映日期"). |
| | | |
| | | length())); |
| | | } |
| | | |
| | | |
| | | if (year == null && show.getRelaseDate() != null) { |
| | | year = show.getRelaseDate().split("-")[0]; |
| | | } |
| | | |
| | | show.setYear(year.replace("(", ""). |
| | | replace(")", "")); |
| | | |
| | | if (infos.get("导演:") != null) |
| | | show.setDirector(infos.get("导演:")); |
| | | if (infos.get("类型:") != null) |
| | | show.setCategorys(infos.get("类型:")); |
| | | if (infos.get("地区:") != null) |
| | | show.setArea(infos.get("地区:")); |
| | | show.setDesc(desc); |
| | | show.setYear(infos.get("年份:")); |
| | | if (show.getYear() != null && show.getRelaseDate() == null) { |
| | | show.setRelaseDate(show.getYear() + "-01-01"); |
| | | } |
| | | |
| | | show.setId(show.getUrl(). |
| | | |
| | | replace("https://www.hmtv.me/show/", ""). |
| | | |
| | | trim()); |
| | | show.setId(show.getUrl().split("/id/")[1].split("/")[0].split("\\.")[0].trim()); |
| | | show.setEpisodeList(episodeList); |
| | | show.setUrl(show.getUrl()); |
| | | show.setDesc(desc.trim()); |
| | | return show; |
| | | } |
| | | |
| | | |
| | | public static List<HanmiShow> parseList(String listUrl) throws IOException { |
| | | Map<String, String> headers = new HashMap<>(); |
| | |
| | | |
| | | List<HanmiShow> list = new ArrayList<>(); |
| | | Document doc = getDoc(listUrl, headers); |
| | | String type = doc.getElementsByClass("list-content").get(0).getElementsByClass("title").get(0).getElementsByTag("strong").text(); |
| | | |
| | | Element root = doc.getElementsByClass("m-movies").get(0); |
| | | Elements items = root.getElementsByClass("u-movie"); |
| | | Elements es = doc.getElementsByClass("stui-pannel_bd"); |
| | | Element root = null; |
| | | for(int i=0;i<es.size();i++){ |
| | | if( es.get(i).select("ul.stui-vodlist").size()>0){ |
| | | root = es.get(i).select("ul.stui-vodlist").get(0); |
| | | break; |
| | | } |
| | | } |
| | | Elements items = root.getElementsByTag("li"); |
| | | for (int i = 0; i < items.size(); i++) { |
| | | Element item = items.get(i); |
| | | HanmiShow show = new HanmiShow(); |
| | | show.setUrl(item.getElementsByTag("a").get(0).attr("href")); |
| | | show.setTag(item.getElementsByClass("zhuangtai").get(0).text()); |
| | | String score = item.getElementsByClass("pingfen").get(0).text(); |
| | | if (score != null) { |
| | | score = score.replace("分", ""); |
| | | show.setScore(score); |
| | | String url = item.getElementsByTag("a").get(0).attr("href"); |
| | | if(!url.startsWith("http")){ |
| | | URI uri = URI.create(listUrl); |
| | | url=String.format("%s://%s%s",uri.getScheme(),uri.getHost(),url); |
| | | } |
| | | show.setTitle(item.getElementsByTag("h2").get(0).getElementsByTag("a").get(0).ownText()); |
| | | show.setType(type); |
| | | show.setId(show.getUrl(). |
| | | replace("https://www.hmtv.me/show/", ""). |
| | | trim()); |
| | | show.setUrl(url); |
| | | show.setTag(item.getElementsByClass("pic-text").get(0).text()); |
| | | show.setTitle(item.getElementsByClass("stui-vodlist__detail").get(0).getElementsByTag("a").get(0).ownText()); |
| | | show.setId(show.getUrl().split("/")[show.getUrl().split("/").length-1].split("\\.")[0].trim()); |
| | | list.add(show); |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | public static List<HanmiShowEpisode> getShowEpisodesFromPlayUrl(String playUrl) throws IOException { |
| | | List<HanmiShowEpisode> episodeList = new ArrayList<>(); |
| | | Document doc = getDoc(playUrl, null); |
| | | Element els = doc.getElementById("playnav"); |
| | | Elements items = els.getElementsByTag("li"); |
| | | int playIndex = -1; |
| | | for (int i = 0; i < items.size(); i++) { |
| | | String name = items.get(i).text(); |
| | | if (name.contains("HM")) { |
| | | playIndex = i; |
| | | break; |
| | | } |
| | | } |
| | | if (playIndex < 0) |
| | | return null; |
| | | Element tab = doc.getElementById("playcontainer").getElementsByClass("tab").get(playIndex); |
| | | Elements es = tab.getElementsByTag("a"); |
| | | URI uri = URI.create(playUrl); |
| | | |
| | | for (int i = 0; i < es.size(); i++) { |
| | | HanmiShowEpisode episode = new HanmiShowEpisode(); |
| | | String href = "https://www.hmtv.me" + es.get(i).attr("href"); |
| | | String name = es.get(i).text(); |
| | | episode.setTag(name); |
| | | episode.setPlayUrl(href); |
| | | episode.setOrderBy(i + 1); |
| | | episodeList.add(episode); |
| | | Document doc = getDoc(playUrl, getHeaders()); |
| | | |
| | | Element root = doc.getElementsByClass("stui-content__thumb").get(0).parent(); |
| | | |
| | | String picture = doc.getElementsByClass("stui-content__thumb").get(0).getElementsByTag("img").get(0).attr("data-original"); |
| | | |
| | | //剧集列表 |
| | | Element eposide = doc.getElementsByClass("playlist").get(0).getElementsByClass("stui-content__playlist").get(0); |
| | | Elements eposides = eposide.getElementsByTag("a"); |
| | | List<HanmiShowEpisode> episodeList = new ArrayList<>(); |
| | | for (int i = 0; i < eposides.size(); i++) { |
| | | String href = eposides.get(i).attr("href"); |
| | | String tag = eposides.get(i).ownText(); |
| | | HanmiShowEpisode ep = new HanmiShowEpisode(); |
| | | ep.setOrderBy(i + 1); |
| | | ep.setPlayUrl(String.format("%s://%s%s",uri.getScheme(),uri.getHost(),href)); |
| | | ep.setTag(tag); |
| | | episodeList.add(ep); |
| | | } |
| | | return episodeList; |
| | | } |
| | |
| | | List<HanmiShow> list = new ArrayList<>(); |
| | | for (HanmiShow show : showList) { |
| | | try { |
| | | if (!show.getUrl().startsWith("http")) { |
| | | show.setUrl("https://www.hmtv.me" + show.getUrl()); |
| | | } |
| | | list.add(parseShowDetail(show)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | return list; |
| | | } |
| | | |
| | | |
| | | public static void parseDY() throws UnsupportedEncodingException { |
| | | for(int p=1;p<20;p++) { |
| | | String url = String.format("https://www.wztaichuan.com/vod/show/area/%s/id/1/page/%d.html", URLEncoder.encode("韩国","UTF-8"), p); |
| | | try { |
| | | List<HanmiShow> showList = parseList(url); |
| | | showList = parseDetailList(showList); |
| | | for(HanmiShow show:showList){ |
| | | show.setTag("评分:"+show.getScore()); |
| | | show.setCategorys("电影"); |
| | | } |
| | | System.out.println("电影:"+p +"-"+showList.size()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | List<HanmiShowEpisode> list = getShowEpisodesFromPlayUrl("https://www.hmtv.me/vplay/MTExNS0xLTA=.html"); |
| | | System.out.println(list); |
| | | // List<HanmiShowEpisode> list = getShowEpisodesFromPlayUrl("https://www.hmtv.me/vplay/MTExNS0xLTA=.html"); |
| | | // System.out.println(list); |
| | | // List<HanmiShow> showList = HanmiApiUtil.parseDetailList(HanmiApiUtil.parseList("https://www.hanjutv.me/hanju/page/" + 50)); |
| | | // System.out.printf(showList.toString()); |
| | | |
| | | // URI uri = URI.create("https://www.hanjutv.me/s/1579"); |
| | | // System.out.println(uri.getScheme()); |
| | | // parseList("https://www.wztaichuan.com/vod/type/id/5/page/1.html"); |
| | | parseDY(); |
| | | |
| | | // |
| | | // System.out.println(uri.getHost()); |
| | | // HanmiShow show=new HanmiShow(); |
| | | // show.setUrl("https://www.wztaichuan.com/vod/detail/id/10195.html"); |
| | | // show = parseShowDetail(show); |
| | | // System.out.println(show); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.yeshi.buwan.videos.hanmi; |
| | | |
| | | import com.yeshi.buwan.domain.AdminInfo; |
| | | import com.yeshi.buwan.domain.VideoDetailInfo; |
| | | import com.yeshi.buwan.domain.VideoType; |
| | | import com.yeshi.buwan.dao.juhe.hanmi.VideoHanmiMapDao; |
| | | import com.yeshi.buwan.domain.*; |
| | | import com.yeshi.buwan.domain.video.InternetSearchVideo; |
| | | import com.yeshi.buwan.service.imp.VideoResourceService; |
| | | import com.yeshi.buwan.service.imp.VideoTypeService; |
| | | import com.yeshi.buwan.service.inter.juhe.HanmiService; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.factory.VideoInfoFactory; |
| | | import com.yeshi.buwan.util.video.VideoConstant; |
| | | import com.yeshi.buwan.videos.bilibili.entity.BilibiliMediaInfo; |
| | | import com.yeshi.buwan.videos.bilibili.entity.BilibiliSearchVideoMap; |
| | | import com.yeshi.buwan.videos.bilibili.entity.BilibiliVideo; |
| | | import com.yeshi.buwan.videos.hanmi.entity.HanmiShow; |
| | | import com.yeshi.buwan.videos.hanmi.entity.HanmiShowEpisode; |
| | | import com.yeshi.buwan.videos.hanmi.entity.VideoHanmiMap; |
| | | import com.yeshi.buwan.videos.youku.YouKuUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | @Component |
| | |
| | | public final static int PLAY_SDK = 2;// 嵌套网页播放 |
| | | |
| | | public final static int RESOURCE_ID = 28; |
| | | public final static String RESOURCE_NAME = "韩迷TV"; |
| | | public final static String RESOURCE_NAME = "韩剧TV"; |
| | | @Resource |
| | | private HanmiService hanmiService; |
| | | |
| | | @Resource |
| | | private VideoResourceService videoResourceService; |
| | | |
| | | @Resource |
| | | private VideoTypeService videoTypeService; |
| | | |
| | | @Resource |
| | | private VideoHanmiMapDao videoHanmiMapDao; |
| | | |
| | | private void saveShow(List<HanmiShow> list) { |
| | | if (list == null) |
| | |
| | | |
| | | switch (show.getType()) { |
| | | case "韩剧": |
| | | case "电视剧": |
| | | return new VideoType(VideoConstant.VIDEO_CATEGORY_DIANSHIJU); |
| | | case "韩综": |
| | | case "综艺": |
| | |
| | | return type; |
| | | } |
| | | |
| | | public VideoInfo getVideoInfo(InternetSearchVideo internetSearchVideo, Integer pageSize) throws Exception { |
| | | VideoHanmiMap map = videoHanmiMapDao.selectByVideoId(internetSearchVideo.getId()); |
| | | if (map == null) { |
| | | throw new Exception("视频源不存在"); |
| | | } |
| | | |
| | | //获取资源列表 |
| | | List<String> rids = Arrays.asList(internetSearchVideo.getResourceIds().split(",")); |
| | | List<VideoResource> resourceList = videoResourceService.getResource(rids); |
| | | for (VideoResource vr : resourceList) { |
| | | if (vr.getId().equalsIgnoreCase(RESOURCE_ID + "")) |
| | | vr.setChecked(true); |
| | | } |
| | | VideoInfo info = VideoInfoFactory.create(internetSearchVideo); |
| | | info.setResourceList(resourceList); |
| | | info.setShowType(YouKuUtil.getShowType(internetSearchVideo)); |
| | | info.setPlayPicture(StringUtil.isNullOrEmpty(info.getHpicture())?info.getVpicture():info.getHpicture()); |
| | | //获取分类详情 |
| | | info.setVideoType(videoTypeService.getVideoType(info.getVideoType().getId())); |
| | | info.setCommentCount(0); |
| | | info.setVideocount((int) (Math.random() * 1000)); |
| | | HanmiShow show = hanmiService.selectShowById(map.getShowId()); |
| | | info.setScore(show.getScore()); |
| | | info.setIntroduction(show.getDesc()); |
| | | List<VideoDetailInfo> detailInfoList = hanmiService.getVideoDetailList(internetSearchVideo.getId(),1,pageSize); |
| | | info.setVideoDetailList(detailInfoList); |
| | | return info; |
| | | } |
| | | } |
| | |
| | | try { |
| | | keyStr = java.net.URLEncoder.encode(key, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.yeshi.buwan.videos.tencent.entity.TencentCoverInfo; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.video.web.TencentWebUtil; |
| | | import com.yeshi.buwan.videos.tencent.vo.TencentCoverInfoVO; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
| | | import org.jsoup.select.Elements; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import javax.script.Invocable; |
| | | import javax.script.ScriptEngine; |
| | | import javax.script.ScriptEngineManager; |
| | | import javax.script.ScriptException; |
| | | import java.lang.reflect.Type; |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | public class TencentVideoApiUtil { |
| | | |
| | | static ScriptEngine jsEngine = null; |
| | | static Logger loggerDebug = LoggerFactory.getLogger("debug"); |
| | | |
| | | // static { |
| | | // if (jdGoodsJs == null) |
| | |
| | | return directors; |
| | | } |
| | | |
| | | public static TencentCoverInfo getCoverInfo(String url) throws Exception { |
| | | private static List<TencentCoverInfoVO.EpisodeVO> getPageData(String cid, String page_context) { |
| | | List<TencentCoverInfoVO.EpisodeVO> voList = new ArrayList<>(); |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Content-Type", "application/json; charset=utf-8"); |
| | | headers.put("Referer", "https://v.qq.com/"); |
| | | String text = |
| | | "{\"page_params\":{\"req_from\":\"web_vsite\",\"page_id\":\"vsite_episode_list\",\"page_type\":\"detail_operation\",\"id_type\":\"1\",\"page_size\":\"\",\"cid\":\"mzc002007j7p5hn\",\"vid\":\"\",\"lid\":\"\",\"page_num\":\"\",\"page_context\":\"chapter_name=&cid=mzc002007j7p5hn&detail_page_type=1&episode_begin=31&episode_end=60&episode_step=30&filter_rule_id=&id_type=1&is_nocopyright=false&is_skp_style=false&lid=&list_page_context=&need_tab=1&order=&page_num=1&page_size=30&req_from=web_vsite&req_from_second_type=&req_type=0&siteName=&tab_type=1&title_style=&ui_type=null&un_strategy_id=13dc6f30819942eb805250fb671fb082&watch_together_pay_status=0&year=\",\"detail_page_type\":\"1\"},\"has_cache\":1}"; |
| | | JSONObject params = JSONObject.fromObject(text); |
| | | params.optJSONObject("page_params").put("cid", cid + ""); |
| | | params.optJSONObject("page_params").put("page_context", page_context + ""); |
| | | String result = com.yeshi.buwan.util.HttpUtil.post("https://pbaccess.video.qq.com/trpc.universal_backend_service.page_server_rpc.PageServer/GetPageData?video_appid=3000010&vplatform=2&vversion_name=8.2.96", params.toString(), headers); |
| | | System.out.println(result); |
| | | JSONObject root = JSONObject.fromObject(result); |
| | | JSONArray items = root.optJSONObject("data").optJSONArray("module_list_datas").optJSONObject(0).optJSONArray("module_datas").optJSONObject(0).optJSONObject("item_data_lists").optJSONArray("item_datas"); |
| | | for (int i = 0; i < items.size(); i++) { |
| | | JSONObject item = items.optJSONObject(i); |
| | | if(item.optInt("item_type")!=1){ |
| | | continue; |
| | | } |
| | | |
| | | JSONObject item_params = item.optJSONObject("item_params"); |
| | | TencentCoverInfoVO.EpisodeVO vo = new TencentCoverInfoVO.EpisodeVO(); |
| | | vo.setCid(item_params.optString("cid")); |
| | | vo.setDuration(item_params.optInt("duration")); |
| | | vo.setEpIndex(item_params.optInt("title") - 1); |
| | | vo.setFullTitle(item_params.optString("union_title")); |
| | | vo.setIndex(item_params.optInt("title") - 1); |
| | | vo.setIsNoStoreWatchHistory(item_params.optInt("is_no_store_watch_history") > 0); |
| | | vo.setItemType(item.optString("item_type")); |
| | | vo.setPic(item_params.optString("image_url")); |
| | | vo.setPlayTitle(item_params.optString("play_title")); |
| | | vo.setTitle(item_params.optString("title")); |
| | | vo.setVid(item_params.optString("vid")); |
| | | if(!vo.isIsNoStoreWatchHistory()){ |
| | | voList.add(vo); |
| | | } |
| | | |
| | | } |
| | | return voList; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @description 是否在线 |
| | | * @date 17:39 2024/8/16 |
| | | * @param: url |
| | | * @return boolean |
| | | **/ |
| | | public static boolean isOnLine(String url) throws Exception{ |
| | | Document doc = Jsoup.connect(url).timeout(10000).userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36").get(); |
| | | return doc.getElementsByClass("page_404").size()==0; |
| | | |
| | | } |
| | | |
| | | public static TencentCoverInfoVO getCoverInfo(String url) throws Exception { |
| | | String script = null; |
| | | Document doc = Jsoup.connect(url).timeout(10000).userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36").get(); |
| | | Elements els = doc.getElementsByTag("script"); |
| | | for (int i = 0; i < els.size(); i++) { |
| | | if (els.get(i).html().indexOf("var COVER_INFO") > -1) { |
| | | if (els.get(i).html().indexOf("window.__PINIA__") > -1) { |
| | | script = els.get(i).html(); |
| | | break; |
| | | } |
| | |
| | | |
| | | script = script.replace("window.", "_window."); |
| | | script = " var _window={};" + "var document={getElementsByTagName:function(tag){return [''];}};" + script; |
| | | script += "\n function getCoverInfo(){return COVER_INFO }; function getVideoInfo(){return VIDEO_INFO}"; |
| | | script += "\n function getCoverInfo(){return _window.__PINIA__.global.coverInfo;}; function getVideoInfo(){return _window.__PINIA__.episodeMain.listData;}";//episodeMain.listData[0].list[0]; |
| | | |
| | | ScriptEngineManager manager = new ScriptEngineManager(); |
| | | jsEngine = manager.getEngineByName("javascript"); |
| | |
| | | Object coverInfo = in.invokeFunction("getCoverInfo"); |
| | | JSONObject root = JSONObject.fromObject(gson.toJson(coverInfo)); |
| | | System.out.println(root.toString()); |
| | | List<TencentCoverInfo.VipIdsBean> vipIdsBeans = new ArrayList<>(); |
| | | List<TencentCoverInfoVO.EpisodeVO> vipIdsBeans = new ArrayList<>(); |
| | | |
| | | if (root.optJSONObject("vip_ids").isArray()) { |
| | | Type type = new TypeToken<List<TencentCoverInfo.VipIdsBean>>() { |
| | | }.getType(); |
| | | vipIdsBeans = gson.fromJson(root.optJSONArray("vip_ids").toString(), type); |
| | | Object videoInfo = in.invokeFunction("getVideoInfo"); |
| | | Object tabs = null; |
| | | if (videoInfo instanceof Map) { |
| | | Map videoInfoMap = (Map) videoInfo; |
| | | String key = videoInfoMap.keySet().iterator().next().toString(); |
| | | videoInfoMap = (Map) videoInfoMap.get(key); |
| | | tabs = videoInfoMap.get("tabs"); |
| | | videoInfoMap = (Map) videoInfoMap.get("list"); |
| | | |
| | | |
| | | key = videoInfoMap.keySet().iterator().next().toString(); |
| | | videoInfo = videoInfoMap.get(key); |
| | | } else if (videoInfo instanceof List) { |
| | | List tempList = (List) videoInfo; |
| | | tabs = ((Map) tempList.get(0)).get("tabs"); |
| | | tempList = (List) (((Map) tempList.get(0)).get("list")); |
| | | videoInfo = tempList.get(0); |
| | | } |
| | | tabs = toList(tabs); |
| | | TencentCoverInfoVO coverInfoBean = gson.fromJson(root.toString(), TencentCoverInfoVO.class); |
| | | if (tabs != null&&((List) tabs).size()>0) { |
| | | // 需要获取集 |
| | | JSONArray tabArrays = JSONArray.fromObject(gson.toJson(tabs)); |
| | | for (int i = 0; i < tabArrays.size(); i++) { |
| | | String pageContext = tabArrays.optJSONObject(i).optString("pageContext"); |
| | | List<TencentCoverInfoVO.EpisodeVO> epList = getPageData(coverInfoBean.getCover_id(), pageContext); |
| | | if (epList != null) { |
| | | vipIdsBeans.addAll(epList); |
| | | } |
| | | } |
| | | } else { |
| | | JSONObject vipIds = root.optJSONObject("vip_ids"); |
| | | for (Iterator<String> its = vipIds.keys(); its.hasNext(); ) { |
| | | String p = its.next(); |
| | | TencentCoverInfo.VipIdsBean idsBean = gson.fromJson(vipIds.optJSONObject(p).toString(), TencentCoverInfo.VipIdsBean.class); |
| | | idsBean.setP(Integer.parseInt(p)); |
| | | vipIdsBeans.add(idsBean); |
| | | System.out.printf(gson.toJson(videoInfo)); |
| | | JSONObject episodeObj = JSONObject.fromObject(gson.toJson(videoInfo)); |
| | | for (Object k : episodeObj.keySet()) { |
| | | JSONObject item = episodeObj.optJSONObject(k.toString()); |
| | | if (item.optBoolean("isNoStoreWatchHistory")) { |
| | | continue; |
| | | } |
| | | vipIdsBeans.add(gson.fromJson(item.toString(), TencentCoverInfoVO.EpisodeVO.class)); |
| | | } |
| | | } |
| | | root.remove("vip_ids"); |
| | | |
| | | try { |
| | | List<String> subTypes = objToArray(root, "subtype"); |
| | | List<String> directors = objToArray(root, "director"); |
| | | List<String> leadingActor = objToArray(root, "leading_actor"); |
| | | List<String> subGenre = objToArray(root, "sub_genre"); |
| | | |
| | | |
| | | TencentCoverInfo coverInfoBean = gson.fromJson(root.toString(), TencentCoverInfo.class); |
| | | coverInfoBean.setVip_ids(vipIdsBeans); |
| | | coverInfoBean.setSubtype(subTypes); |
| | | coverInfoBean.setDirector(directors); |
| | | coverInfoBean.setLeading_actor(leadingActor); |
| | | coverInfoBean.setSub_genre(subGenre); |
| | | coverInfoBean.setEpisodes(vipIdsBeans); |
| | | return coverInfoBean; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // System.out.println(coverInfoBean); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | public static List<TencentCoverInfo> getVideoList(String url) throws Exception { |
| | | List<TencentCoverInfo> coverInfoList = new ArrayList<>(); |
| | | List<TencentWebUtil.TencentWebVideoInfo> list = TencentWebUtil.getVideoList(url); |
| | | public static List<TencentCoverInfoVO> getVideoList(int channelId, int pageIndex, Integer areaId) throws Exception { |
| | | List<TencentCoverInfoVO> coverInfoList = new ArrayList<>(); |
| | | List<TencentWebUtil.TencentWebVideoInfo> list = TencentWebUtil.getVideoList(channelId, pageIndex,areaId); |
| | | loggerDebug.info("腾讯视频:获取视频列表-{}:{}",channelId,list.size()); |
| | | for (TencentWebUtil.TencentWebVideoInfo info : list) { |
| | | try { |
| | | TencentCoverInfo coverInfo = getCoverInfo(info.getPlayUrl()); |
| | | coverInfo.setVertical_pic_url(info.getPicture()); |
| | | TencentCoverInfoVO coverInfo = getCoverInfo(info.getPlayUrl()); |
| | | if(StringUtil.isNullOrEmpty(coverInfo.getPublish_date())){ |
| | | coverInfo.setPublish_date(info.getEpsodePubtime().substring(0,10)); |
| | | } |
| | | coverInfo.setEpisode_update(info.getTag()); |
| | | coverInfo.setNew_pic_vt(info.getPicture()); |
| | | coverInfoList.add(coverInfo); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | loggerDebug.error("腾讯视频:获取详情出错-"+info.getTitle(),e); |
| | | }finally { |
| | | Thread.sleep(2000); |
| | | } |
| | | } |
| | | return coverInfoList; |
| | | } |
| | | |
| | | public static List<TencentCoverInfo> getVideoListByCategory(String channel, int page) { |
| | | String url = String.format("https://v.qq.com/x/bu/pagesheet/list?_all=1&append=1&channel=%s&ipay=2&listpage=%s&offset=%s&pagesize=30&sort=18", channel, page, (page - 1) * 30); |
| | | private static List toList(Object data){ |
| | | if(data instanceof Map){ |
| | | List list=new ArrayList(); |
| | | Map map=(Map) data; |
| | | for(Object key:map.keySet()){ |
| | | list.add(map.get(key)); |
| | | } |
| | | return list; |
| | | }else if(data instanceof List){ |
| | | return (List) data; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static List<TencentCoverInfoVO> getVideoListByCategory(String channel, int page,Integer areaId) { |
| | | try { |
| | | return getVideoList(url); |
| | | return getVideoList(TencentWebUtil.CHANNEL_ID_MAP.get(channel), page - 1, areaId); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | List<TencentCoverInfo> list1 = getVideoList(TencentWebUtil.getApiUrl("https://v.qq.com/channel/tv?_all=1&channel=tv&iarea=818&listpage=1&sort=18", 1)); |
| | | System.out.println(list1); |
| | | |
| | | if (1 > 0) |
| | | return; |
| | | |
| | | // try { |
| | | TencentCoverInfo info = getCoverInfo("https://v.qq.com/x/cover/7q544xyrava3vxf.html"); |
| | | System.out.println(info); |
| | | // |
| | | // info = getCoverInfo("https://v.qq.com/x/cover/mzc00200s0ii272/r0036xibgw2.html"); |
| | | // info = getCoverInfo("https://v.qq.com/x/cover/ylgl3m6wo0sypou/w0036x9c5c7.html"); |
| | | // info = getCoverInfo("https://v.qq.com/x/cover/ylgl3m6wo0sypou/w0036x9c5c7.html"); |
| | | // // |
| | | // info = getCoverInfo("https://v.qq.com/x/cover/mzc00200tlv15ub.html"); |
| | | // System.out.println(info); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | |
| | | // getPageData("mzc002007j7p5hn", "chapter_name=&cid=mzc002007j7p5hn&detail_page_type=1&episode_begin=1&episode_end=30&episode_step=30&filter_rule_id=&id_type=1&is_nocopyright=false&is_skp_style=false&lid=&list_page_context=&need_tab=1&order=&page_num=0&page_size=30&req_from=web_vsite&req_from_second_type=&req_type=0&siteName=&tab_type=1&title_style=&ui_type=null&un_strategy_id=13dc6f30819942eb805250fb671fb082&watch_together_pay_status=0&year="); |
| | | List<TencentCoverInfoVO> voList = getVideoListByCategory("电视剧",1, null); |
| | | // for(TencentCoverInfoVO vo:voList){ |
| | | // System.out.println(vo.getTitle()); |
| | | // } |
| | | int page = 1; |
| | | List<TencentCoverInfo> list = getVideoListByCategory("cartoon", 1); |
| | | System.out.println(list); |
| | | // System.out.printf(voList.toString()); |
| | | // getCoverInfo("https://v.qq.com/x/cover/mzc002007j7p5hn/z0047b7g57k.html"); |
| | | getCoverInfo("https://v.qq.com/x/cover/mcv8hkc8zk8lnov/r0048jp1a5e.html"); |
| | | } |
| | | |
| | | |
| | |
| | | break; |
| | | case "电视剧": |
| | | case "动漫": |
| | | detail.setTag(tencentCoverVideo.getStage() + ""); |
| | | detail.setTag(tencentCoverVideo.getTitle() + ""); |
| | | break; |
| | | case "综艺": |
| | | detail.setTag(tencentCoverVideo.getDate()); |
| | |
| | | throw new Exception("视频源不存在"); |
| | | } |
| | | TencentCoverInfo showDetail = tencentVideoService.getSimpleCoverDetail(map.getCoverId()); |
| | | showDetail.setVideoList(tencentVideoService.getVideoList(showDetail.getId(), 1, pageSize)); |
| | | showDetail.setVideoList(tencentVideoService.getVideoList(showDetail.getCover_id(), 1, pageSize)); |
| | | VideoInfo info = VideoInfoFactory.create(internetSearchVideo); |
| | | info.setIntroduction(showDetail.getDescription()); |
| | | info.setVideoDetailList(convertToDetail(showDetail.getVideoList(), showDetail)); |
| | |
| | | } |
| | | info.setResourceList(resourceList); |
| | | info.setShowType(YouKuUtil.getShowType(internetSearchVideo)); |
| | | info.setScore(new BigDecimal(showDetail.getScore().getScore()).setScale(1).toString()); |
| | | |
| | | if(showDetail.getScore()!=null) { |
| | | info.setScore(new BigDecimal(showDetail.getScore()).setScale(1).toString()); |
| | | }else{ |
| | | info.setScore(new BigDecimal("9.0").toString()); |
| | | } |
| | | //获取分类详情 |
| | | info.setVideoType(videoTypeService.getVideoType(info.getVideoType().getId())); |
| | | info.setCommentCount(0); |
| | |
| | | package com.yeshi.buwan.videos.tencent.entity; |
| | | |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.annotation.Transient; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Document(collection = "tencentCoverInfo") |
| | | @Document(collection = "tencentCoverInfoV2") |
| | | public class TencentCoverInfo { |
| | | |
| | | |
| | | /** |
| | | * id : mzc00200fw94jce |
| | | * director : ["宋小宝"] |
| | | * douban_score : 6.0 |
| | | * leading_actor : ["宋小宝","马丽","沙溢","张一山"] |
| | | * vip_ids : [{"F":7,"V":"h0035b23dyt"}] |
| | | * pay_status : 6 |
| | | * year : 2021 |
| | | * episode_updated : null |
| | | * episode_all : null |
| | | * payfree_num : null |
| | | * current_num : null |
| | | * publish_date : 2021-02-12 |
| | | * title : 发财日记 |
| | | * description : 故事讲述上世纪90年代初,穷小子小宝追随同村“发小儿”二哥,一路从贫穷朴实的东北农村来到了经济飞速发展的深圳。期间,两人无意中收留了一个嗷嗷待哺的婴儿,生活困窘的小宝和二哥该如何将孩子抚养长大?当小宝和二哥与同在深圳打拼的创业女青年马露“狭路相逢,三人之间又将发生哪些令人捧腹的爆笑故事?一段笑泪参半、起伏跌宕的小人物奋斗史就此展开 |
| | | * cover_id : mzc00200fw94jce |
| | | * type_name : 电影 |
| | | * keyword : [] |
| | | * publish_date : 2024-02-28 |
| | | * title : 永安梦 |
| | | * type : 2 |
| | | * type_name : 电视剧 |
| | | * category_map : ["10470","正片","1089","连续剧","2","电视剧"] |
| | | * leading_actor : ["欧阳娜娜","徐正溪","孙坚","夏楠","刘海宽"] |
| | | * tag : [] |
| | | * area_name : 内地 |
| | | * horizontal_pic_url : null |
| | | * vertical_pic_url : null |
| | | * second_title : 宋小宝马丽拯救不开心 |
| | | * langue : 普通话 |
| | | * subtype : ["喜剧","剧情"] |
| | | * main_genre : 喜剧 |
| | | * score : {"c_mix_score":"8.4","hot":"9.99151","score":"8.4"} |
| | | * sub_genre : ["剧情"] |
| | | * second_title : 欧阳娜娜徐正溪揭梦定情 |
| | | * episode_all : 24 |
| | | * guests : [] |
| | | * cartoon_age : |
| | | * episode_updated |
| | | * new_pic_hz : https://vcover-hz-pic.puui.qpic.cn/vcover_hz_pic/0/mzc002001ow3dlb1709086532756/0 |
| | | * new_pic_vt : https://vcover-vt-pic.puui.qpic.cn/vcover_vt_pic/0/mzc002001ow3dlb1708588840297/0 |
| | | * description : 国都永安,因城西渠的垮塌,负责工事的都官尚书沈文祁一夕获罪,身陷牢狱。覆巢之下无完卵,沈家的两个女儿沈姌、沈甄也先后落入泥沼。尤其是小女沈甄一向养在深闺,不谙世事,此时流落街头,难以自保。此时正负责调查此案的廷尉陆时砚,也因为频频梦见自己与神秘女子的种种牵绊而陷入了困惑。经过求证,梦中出现的神秘女子正是罪臣之女沈甄。陆时砚一步步走近她,也一步步走向自己未知的命运。围绕城西渠一案,两人经历生死、交托信任,彼此情根深种。而陆时砚亦不负所托,在沈甄的帮助下,查明案情真相。然而真正的幕后黑手却向两人默默逼近。 |
| | | * alias : ["长安第一美人"] |
| | | * cover_id : mzc002001ow3dlb |
| | | * pay_status : 0 |
| | | */ |
| | | |
| | | @Id |
| | | private String id; |
| | | private String douban_score; |
| | | private Integer pay_status; |
| | | private String year; |
| | | private String episode_updated; |
| | | private String episode_all; |
| | | private String current_num; |
| | | private String cover_id; |
| | | private String publish_date; |
| | | private String title; |
| | | private String description; |
| | | private String cover_id; |
| | | private Integer type; |
| | | private String type_name; |
| | | private String area_name; |
| | | private String horizontal_pic_url; |
| | | private String vertical_pic_url; |
| | | private String second_title; |
| | | private String langue; |
| | | private String main_genre; |
| | | private ScoreBean score; |
| | | private List<String> director; |
| | | private String episode_all; |
| | | private String cartoon_age; |
| | | private String new_pic_hz; |
| | | private String new_pic_vt; |
| | | private String description; |
| | | private String pay_status; |
| | | private List<String> keyword; |
| | | private List<String> category_map; |
| | | private List<String> leading_actor; |
| | | private List<VipIdsBean> vip_ids; |
| | | private List<String> subtype; |
| | | private List<String> sub_genre; |
| | | private Date createTime; |
| | | private Date updateTime; |
| | | |
| | | @Transient |
| | | private List<String> tag; |
| | | private List<String> guests; |
| | | private List<String> alias; |
| | | private String score; |
| | | private String episode_updated; |
| | | private List<TencentCoverVideo> videoList; |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getDouban_score() { |
| | | return douban_score; |
| | | } |
| | | |
| | | public void setDouban_score(String douban_score) { |
| | | this.douban_score = douban_score; |
| | | } |
| | | |
| | | public Integer getPay_status() { |
| | | return pay_status; |
| | | } |
| | | |
| | | public void setPay_status(Integer pay_status) { |
| | | this.pay_status = pay_status; |
| | | } |
| | | |
| | | public String getYear() { |
| | | return year; |
| | | } |
| | | |
| | | public void setYear(String year) { |
| | | this.year = year; |
| | | } |
| | | private Date updateTime; |
| | | |
| | | public String getEpisode_updated() { |
| | | return episode_updated; |
| | |
| | | |
| | | public void setEpisode_updated(String episode_updated) { |
| | | this.episode_updated = episode_updated; |
| | | } |
| | | |
| | | public String getEpisode_all() { |
| | | return episode_all; |
| | | } |
| | | |
| | | public void setEpisode_all(String episode_all) { |
| | | this.episode_all = episode_all; |
| | | } |
| | | |
| | | |
| | | public String getCurrent_num() { |
| | | return current_num; |
| | | } |
| | | |
| | | public void setCurrent_num(String current_num) { |
| | | this.current_num = current_num; |
| | | } |
| | | |
| | | public String getPublish_date() { |
| | |
| | | this.title = title; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setDescription(String description) { |
| | | this.description = description; |
| | | } |
| | | |
| | | public String getCover_id() { |
| | | return cover_id; |
| | | } |
| | | |
| | | public void setCover_id(String cover_id) { |
| | | this.cover_id = cover_id; |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getType_name() { |
| | |
| | | this.area_name = area_name; |
| | | } |
| | | |
| | | public String getHorizontal_pic_url() { |
| | | return horizontal_pic_url; |
| | | } |
| | | |
| | | public void setHorizontal_pic_url(String horizontal_pic_url) { |
| | | this.horizontal_pic_url = horizontal_pic_url; |
| | | } |
| | | |
| | | public String getVertical_pic_url() { |
| | | return vertical_pic_url; |
| | | } |
| | | |
| | | public void setVertical_pic_url(String vertical_pic_url) { |
| | | this.vertical_pic_url = vertical_pic_url; |
| | | } |
| | | |
| | | public String getSecond_title() { |
| | | return second_title; |
| | | } |
| | |
| | | this.second_title = second_title; |
| | | } |
| | | |
| | | public String getLangue() { |
| | | return langue; |
| | | public String getEpisode_all() { |
| | | return episode_all; |
| | | } |
| | | |
| | | public void setLangue(String langue) { |
| | | this.langue = langue; |
| | | public void setEpisode_all(String episode_all) { |
| | | this.episode_all = episode_all; |
| | | } |
| | | |
| | | public String getMain_genre() { |
| | | return main_genre; |
| | | public String getCartoon_age() { |
| | | return cartoon_age; |
| | | } |
| | | |
| | | public void setMain_genre(String main_genre) { |
| | | this.main_genre = main_genre; |
| | | public void setCartoon_age(String cartoon_age) { |
| | | this.cartoon_age = cartoon_age; |
| | | } |
| | | |
| | | public ScoreBean getScore() { |
| | | return score; |
| | | public String getNew_pic_hz() { |
| | | return new_pic_hz; |
| | | } |
| | | |
| | | public void setScore(ScoreBean score) { |
| | | this.score = score; |
| | | public void setNew_pic_hz(String new_pic_hz) { |
| | | this.new_pic_hz = new_pic_hz; |
| | | } |
| | | |
| | | public List<String> getDirector() { |
| | | return director; |
| | | public String getNew_pic_vt() { |
| | | return new_pic_vt; |
| | | } |
| | | |
| | | public void setDirector(List<String> director) { |
| | | this.director = director; |
| | | public void setNew_pic_vt(String new_pic_vt) { |
| | | this.new_pic_vt = new_pic_vt; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | |
| | | public void setDescription(String description) { |
| | | this.description = description; |
| | | } |
| | | |
| | | public String getCover_id() { |
| | | return cover_id; |
| | | } |
| | | |
| | | public void setCover_id(String cover_id) { |
| | | this.cover_id = cover_id; |
| | | } |
| | | |
| | | public String getPay_status() { |
| | | return pay_status; |
| | | } |
| | | |
| | | public void setPay_status(String pay_status) { |
| | | this.pay_status = pay_status; |
| | | } |
| | | |
| | | public List<String> getKeyword() { |
| | | return keyword; |
| | | } |
| | | |
| | | public void setKeyword(List<String> keyword) { |
| | | this.keyword = keyword; |
| | | } |
| | | |
| | | public List<String> getCategory_map() { |
| | | return category_map; |
| | | } |
| | | |
| | | public void setCategory_map(List<String> category_map) { |
| | | this.category_map = category_map; |
| | | } |
| | | |
| | | public List<String> getLeading_actor() { |
| | |
| | | this.leading_actor = leading_actor; |
| | | } |
| | | |
| | | public List<VipIdsBean> getVip_ids() { |
| | | return vip_ids; |
| | | public List<String> getTag() { |
| | | return tag; |
| | | } |
| | | |
| | | public void setVip_ids(List<VipIdsBean> vip_ids) { |
| | | this.vip_ids = vip_ids; |
| | | public void setTag(List<String> tag) { |
| | | this.tag = tag; |
| | | } |
| | | |
| | | public List<String> getSubtype() { |
| | | return subtype; |
| | | public List<String> getGuests() { |
| | | return guests; |
| | | } |
| | | |
| | | public void setSubtype(List<String> subtype) { |
| | | this.subtype = subtype; |
| | | public void setGuests(List<String> guests) { |
| | | this.guests = guests; |
| | | } |
| | | |
| | | public List<String> getSub_genre() { |
| | | return sub_genre; |
| | | public List<String> getAlias() { |
| | | return alias; |
| | | } |
| | | |
| | | public void setSub_genre(List<String> sub_genre) { |
| | | this.sub_genre = sub_genre; |
| | | public void setAlias(List<String> alias) { |
| | | this.alias = alias; |
| | | } |
| | | |
| | | |
| | | public List<TencentCoverVideo> getVideoList() { |
| | | return videoList; |
| | |
| | | this.videoList = videoList; |
| | | } |
| | | |
| | | public static class ScoreBean { |
| | | /** |
| | | * c_mix_score : 8.4 |
| | | * hot : 9.99151 |
| | | * score : 8.4 |
| | | */ |
| | | |
| | | private String c_mix_score; |
| | | private String hot; |
| | | private String score; |
| | | |
| | | public String getC_mix_score() { |
| | | return c_mix_score; |
| | | } |
| | | |
| | | public void setC_mix_score(String c_mix_score) { |
| | | this.c_mix_score = c_mix_score; |
| | | } |
| | | |
| | | public String getHot() { |
| | | return hot; |
| | | } |
| | | |
| | | public void setHot(String hot) { |
| | | this.hot = hot; |
| | | } |
| | | |
| | | public String getScore() { |
| | | return score; |
| | | } |
| | | |
| | | public void setScore(String score) { |
| | | this.score = score; |
| | | } |
| | | public String getScore() { |
| | | return score; |
| | | } |
| | | |
| | | public static class VipIdsBean { |
| | | /** |
| | | * F : 7 |
| | | * V : h0035b23dyt |
| | | */ |
| | | public void setScore(String score) { |
| | | this.score = score; |
| | | } |
| | | |
| | | private int F; |
| | | private String V; |
| | | private int P;//position |
| | | private String D;//date 时间 |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public String getD() { |
| | | return D; |
| | | } |
| | | |
| | | public void setD(String d) { |
| | | D = d; |
| | | } |
| | | |
| | | public int getP() { |
| | | return P; |
| | | } |
| | | |
| | | public void setP(int p) { |
| | | P = p; |
| | | } |
| | | |
| | | public int getF() { |
| | | return F; |
| | | } |
| | | |
| | | public void setF(int F) { |
| | | this.F = F; |
| | | } |
| | | |
| | | public String getV() { |
| | | return V; |
| | | } |
| | | |
| | | public void setV(String V) { |
| | | this.V = V; |
| | | } |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | } |
| | |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Document(collection = "tencentCoverVideo") |
| | | @Document(collection = "tencentCoverVideoV2") |
| | | public class TencentCoverVideo { |
| | | @Id |
| | | private String videoId; |
| | | @Indexed |
| | | private String coverId; |
| | | private String title; |
| | | private String subTitle; |
| | | private Integer stage;//集数 |
| | | private Integer position;//position |
| | | private String date;//date 时间 |
| | |
| | | public void setLink(String link) { |
| | | this.link = link; |
| | | } |
| | | |
| | | public String getTitle() { |
| | | return title; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | | this.title = title; |
| | | } |
| | | |
| | | public String getSubTitle() { |
| | | return subTitle; |
| | | } |
| | | |
| | | public void setSubTitle(String subTitle) { |
| | | this.subTitle = subTitle; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.videos.tencent.factory; |
| | | |
| | | import com.yeshi.buwan.util.NumberUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.videos.tencent.entity.TencentCoverInfo; |
| | | import com.yeshi.buwan.videos.tencent.entity.TencentCoverVideo; |
| | | import com.yeshi.buwan.videos.tencent.vo.TencentCoverInfoVO; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: TencentCoverInfoFactory |
| | | * @description: 工厂 |
| | | * @date 2024/3/14 16:25 |
| | | */ |
| | | public class TencentCoverInfoFactory { |
| | | |
| | | private static List<String> toList(Object data){ |
| | | if(data instanceof Map){ |
| | | List<String> list=new ArrayList<>(); |
| | | for(Object k : ((Map)data).keySet()){ |
| | | list.add(((Map)data).get(k).toString()); |
| | | } |
| | | return list; |
| | | }if(data instanceof List){ |
| | | return (List<String>)data; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static TencentCoverInfo create(TencentCoverInfoVO vo){ |
| | | TencentCoverInfo info=new TencentCoverInfo(); |
| | | |
| | | info.setAlias(toList(vo.getAlias())); |
| | | info.setArea_name(vo.getArea_name()); |
| | | info.setCartoon_age(vo.getCartoon_age()); |
| | | info.setCategory_map(toList(vo.getCategory_map())); |
| | | info.setCover_id(vo.getCover_id()); |
| | | info.setDescription(vo.getDescription()); |
| | | info.setEpisode_all(vo.getEpisode_all()); |
| | | info.setEpisode_updated(null); |
| | | info.setGuests(toList(vo.getGuests())); |
| | | info.setKeyword(toList(vo.getKeyword())); |
| | | info.setLeading_actor(toList(vo.getLeading_actor())); |
| | | info.setNew_pic_hz(vo.getNew_pic_hz()); |
| | | info.setNew_pic_vt(vo.getNew_pic_vt()); |
| | | info.setPay_status(vo.getPay_status()); |
| | | info.setPublish_date(vo.getPublish_date()); |
| | | info.setScore(null); |
| | | info.setSecond_title(vo.getSecond_title()); |
| | | info.setTag(toList(vo.getTag())); |
| | | info.setTitle(vo.getTitle()); |
| | | info.setType(vo.getType()); |
| | | info.setType_name(vo.getType_name()); |
| | | List<TencentCoverVideo> videoList=new ArrayList<>(); |
| | | for(TencentCoverInfoVO.EpisodeVO ep:vo.getEpisodes()){ |
| | | videoList.add(create(ep)); |
| | | } |
| | | info.setVideoList(videoList); |
| | | // 电视剧与动漫 |
| | | if(vo.getEpisode_update()!=null){ |
| | | info.setEpisode_updated(vo.getEpisode_update()); |
| | | }else { |
| | | if (vo.getType() == 2 || vo.getType() == 3) { |
| | | String latestTag = null; |
| | | for (int i = vo.getEpisodes().size() - 1; i >= 0; i--) { |
| | | if (NumberUtil.isNumeric(vo.getEpisodes().get(i).getTitle())) { |
| | | latestTag = vo.getEpisodes().get(i).getTitle(); |
| | | break; |
| | | } |
| | | } |
| | | if (latestTag != null) { |
| | | if (Integer.parseInt(vo.getEpisode_all()) == Integer.parseInt(latestTag)) { |
| | | info.setEpisode_updated("全" + vo.getEpisode_all() + "集"); |
| | | } else { |
| | | info.setEpisode_updated("更新至" + latestTag + "集"); |
| | | } |
| | | } else { |
| | | info.setEpisode_updated("更新至0集"); |
| | | } |
| | | } |
| | | } |
| | | return info; |
| | | } |
| | | |
| | | private static TencentCoverVideo create(TencentCoverInfoVO.EpisodeVO vo){ |
| | | TencentCoverVideo video=new TencentCoverVideo(); |
| | | video.setCoverId(vo.getCid()); |
| | | video.setDate(vo.getPublishDate()); |
| | | video.setLink(String.format("https://v.qq.com/x/cover/%s/%s.html",vo.getCid(),vo.getVid())); |
| | | video.setPosition(vo.getIndex()); |
| | | video.setStage(vo.getIndex()+1); |
| | | video.setVideoId(vo.getVid()); |
| | | video.setTitle(vo.getTitle()); |
| | | video.setSubTitle(vo.getVideoSubtitle()); |
| | | return video; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.videos.tencent.vo; |
| | | |
| | | import org.springframework.data.annotation.Id; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: TencentCoverInfoVO |
| | | * @description: 腾讯视频接口解析结果 |
| | | * @date 2024/3/14 11:16 |
| | | */ |
| | | public class TencentCoverInfoVO { |
| | | |
| | | /** |
| | | * keyword : [] |
| | | * publish_date : 2024-02-28 |
| | | * title : 永安梦 |
| | | * type : 2 |
| | | * type_name : 电视剧 |
| | | * category_map : ["10470","正片","1089","连续剧","2","电视剧"] |
| | | * leading_actor : ["欧阳娜娜","徐正溪","孙坚","夏楠","刘海宽"] |
| | | * tag : [] |
| | | * area_name : 内地 |
| | | * second_title : 欧阳娜娜徐正溪揭梦定情 |
| | | * episode_all : 24 |
| | | * guests : [] |
| | | * cartoon_age : |
| | | * new_pic_hz : https://vcover-hz-pic.puui.qpic.cn/vcover_hz_pic/0/mzc002001ow3dlb1709086532756/0 |
| | | * new_pic_vt : https://vcover-vt-pic.puui.qpic.cn/vcover_vt_pic/0/mzc002001ow3dlb1708588840297/0 |
| | | * description : 国都永安,因城西渠的垮塌,负责工事的都官尚书沈文祁一夕获罪,身陷牢狱。覆巢之下无完卵,沈家的两个女儿沈姌、沈甄也先后落入泥沼。尤其是小女沈甄一向养在深闺,不谙世事,此时流落街头,难以自保。此时正负责调查此案的廷尉陆时砚,也因为频频梦见自己与神秘女子的种种牵绊而陷入了困惑。经过求证,梦中出现的神秘女子正是罪臣之女沈甄。陆时砚一步步走近她,也一步步走向自己未知的命运。围绕城西渠一案,两人经历生死、交托信任,彼此情根深种。而陆时砚亦不负所托,在沈甄的帮助下,查明案情真相。然而真正的幕后黑手却向两人默默逼近。 |
| | | * alias : ["长安第一美人"] |
| | | * cover_id : mzc002001ow3dlb |
| | | * pay_status : 0 |
| | | */ |
| | | @Id |
| | | private String cover_id; |
| | | private String publish_date; |
| | | private String title; |
| | | private int type; |
| | | private String type_name; |
| | | private String area_name; |
| | | private String second_title; |
| | | private String episode_all; |
| | | private String episode_update; |
| | | private String cartoon_age; |
| | | private String new_pic_hz; |
| | | private String new_pic_vt; |
| | | private String description; |
| | | private String pay_status; |
| | | private Object category_map; |
| | | private Object leading_actor; |
| | | private Object tag; |
| | | private Object keyword; |
| | | private Object guests; |
| | | private Object alias; |
| | | private List<TencentCoverInfoVO.EpisodeVO> episodes; |
| | | |
| | | public String getEpisode_update() { |
| | | return episode_update; |
| | | } |
| | | |
| | | public void setEpisode_update(String episode_update) { |
| | | this.episode_update = episode_update; |
| | | } |
| | | |
| | | |
| | | public String getCover_id() { |
| | | return cover_id; |
| | | } |
| | | |
| | | public void setCover_id(String cover_id) { |
| | | this.cover_id = cover_id; |
| | | } |
| | | |
| | | public String getPublish_date() { |
| | | return publish_date; |
| | | } |
| | | |
| | | public void setPublish_date(String publish_date) { |
| | | this.publish_date = publish_date; |
| | | } |
| | | |
| | | public String getTitle() { |
| | | return title; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | | this.title = title; |
| | | } |
| | | |
| | | public int getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(int type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getType_name() { |
| | | return type_name; |
| | | } |
| | | |
| | | public void setType_name(String type_name) { |
| | | this.type_name = type_name; |
| | | } |
| | | |
| | | public String getArea_name() { |
| | | return area_name; |
| | | } |
| | | |
| | | public void setArea_name(String area_name) { |
| | | this.area_name = area_name; |
| | | } |
| | | |
| | | public String getSecond_title() { |
| | | return second_title; |
| | | } |
| | | |
| | | public void setSecond_title(String second_title) { |
| | | this.second_title = second_title; |
| | | } |
| | | |
| | | public String getEpisode_all() { |
| | | return episode_all; |
| | | } |
| | | |
| | | public void setEpisode_all(String episode_all) { |
| | | this.episode_all = episode_all; |
| | | } |
| | | |
| | | public String getCartoon_age() { |
| | | return cartoon_age; |
| | | } |
| | | |
| | | public void setCartoon_age(String cartoon_age) { |
| | | this.cartoon_age = cartoon_age; |
| | | } |
| | | |
| | | public String getNew_pic_hz() { |
| | | return new_pic_hz; |
| | | } |
| | | |
| | | public void setNew_pic_hz(String new_pic_hz) { |
| | | this.new_pic_hz = new_pic_hz; |
| | | } |
| | | |
| | | public String getNew_pic_vt() { |
| | | return new_pic_vt; |
| | | } |
| | | |
| | | public void setNew_pic_vt(String new_pic_vt) { |
| | | this.new_pic_vt = new_pic_vt; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | |
| | | public void setDescription(String description) { |
| | | this.description = description; |
| | | } |
| | | |
| | | public String getPay_status() { |
| | | return pay_status; |
| | | } |
| | | |
| | | public void setPay_status(String pay_status) { |
| | | this.pay_status = pay_status; |
| | | } |
| | | |
| | | public Object getCategory_map() { |
| | | return category_map; |
| | | } |
| | | |
| | | public void setCategory_map(Object category_map) { |
| | | this.category_map = category_map; |
| | | } |
| | | |
| | | public Object getLeading_actor() { |
| | | return leading_actor; |
| | | } |
| | | |
| | | public void setLeading_actor(Object leading_actor) { |
| | | this.leading_actor = leading_actor; |
| | | } |
| | | |
| | | public Object getTag() { |
| | | return tag; |
| | | } |
| | | |
| | | public void setTag(Object tag) { |
| | | this.tag = tag; |
| | | } |
| | | |
| | | public Object getKeyword() { |
| | | return keyword; |
| | | } |
| | | |
| | | public void setKeyword(Object keyword) { |
| | | this.keyword = keyword; |
| | | } |
| | | |
| | | public Object getGuests() { |
| | | return guests; |
| | | } |
| | | |
| | | public void setGuests(Object guests) { |
| | | this.guests = guests; |
| | | } |
| | | |
| | | public Object getAlias() { |
| | | return alias; |
| | | } |
| | | |
| | | public void setAlias(Object alias) { |
| | | this.alias = alias; |
| | | } |
| | | |
| | | public List<EpisodeVO> getEpisodes() { |
| | | return episodes; |
| | | } |
| | | |
| | | public void setEpisodes(List<EpisodeVO> episodes) { |
| | | this.episodes = episodes; |
| | | } |
| | | |
| | | public static class EpisodeVO { |
| | | |
| | | /** |
| | | * cid : mzc002001ow3dlb |
| | | * index : 1 |
| | | * pic : https://vpic-cover.puui.qpic.cn/x00487c7lga/x00487c7lga_1708957547_hz.jpg/496 |
| | | * picVertial : https://vpic-cover.puui.qpic.cn/x00487c7lga/x00487c7lga_1708957547_hz.jpg/496 |
| | | * title : 2 |
| | | * vid : x00487c7lga |
| | | * duration : 2635 |
| | | * playTitle : 永安梦 第02集 |
| | | * fullTitle : 永安梦 第02集 |
| | | * itemType : 1 |
| | | * listKey : mainList |
| | | * page : 0 |
| | | * epIndex : 0 |
| | | * refreshPage : 0 |
| | | * isNoStoreWatchHistory : false |
| | | * videoSubtitle : 命定之人?欧阳娜娜流泪徐正溪疼到休克 |
| | | */ |
| | | |
| | | private String cid; |
| | | private int index; |
| | | private String pic; |
| | | private String picVertial; |
| | | private String title; |
| | | private String vid; |
| | | private int duration; |
| | | private String playTitle; |
| | | private String fullTitle; |
| | | private String itemType; |
| | | private String listKey; |
| | | private int page; |
| | | private int epIndex; |
| | | private String refreshPage; |
| | | private boolean isNoStoreWatchHistory; |
| | | private String videoSubtitle; |
| | | private String publishDate; |
| | | |
| | | |
| | | |
| | | public String getCid() { |
| | | return cid; |
| | | } |
| | | |
| | | public void setCid(String cid) { |
| | | this.cid = cid; |
| | | } |
| | | |
| | | public int getIndex() { |
| | | return index; |
| | | } |
| | | |
| | | public void setIndex(int index) { |
| | | this.index = index; |
| | | } |
| | | |
| | | public String getPic() { |
| | | return pic; |
| | | } |
| | | |
| | | public void setPic(String pic) { |
| | | this.pic = pic; |
| | | } |
| | | |
| | | public String getPicVertial() { |
| | | return picVertial; |
| | | } |
| | | |
| | | public void setPicVertial(String picVertial) { |
| | | this.picVertial = picVertial; |
| | | } |
| | | |
| | | public String getTitle() { |
| | | return title; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | | this.title = title; |
| | | } |
| | | |
| | | public String getVid() { |
| | | return vid; |
| | | } |
| | | |
| | | public void setVid(String vid) { |
| | | this.vid = vid; |
| | | } |
| | | |
| | | public int getDuration() { |
| | | return duration; |
| | | } |
| | | |
| | | public void setDuration(int duration) { |
| | | this.duration = duration; |
| | | } |
| | | |
| | | public String getPlayTitle() { |
| | | return playTitle; |
| | | } |
| | | |
| | | public void setPlayTitle(String playTitle) { |
| | | this.playTitle = playTitle; |
| | | } |
| | | |
| | | public String getFullTitle() { |
| | | return fullTitle; |
| | | } |
| | | |
| | | public void setFullTitle(String fullTitle) { |
| | | this.fullTitle = fullTitle; |
| | | } |
| | | |
| | | public String getItemType() { |
| | | return itemType; |
| | | } |
| | | |
| | | public void setItemType(String itemType) { |
| | | this.itemType = itemType; |
| | | } |
| | | |
| | | public String getListKey() { |
| | | return listKey; |
| | | } |
| | | |
| | | public void setListKey(String listKey) { |
| | | this.listKey = listKey; |
| | | } |
| | | |
| | | public int getPage() { |
| | | return page; |
| | | } |
| | | |
| | | public void setPage(int page) { |
| | | this.page = page; |
| | | } |
| | | |
| | | public int getEpIndex() { |
| | | return epIndex; |
| | | } |
| | | |
| | | public void setEpIndex(int epIndex) { |
| | | this.epIndex = epIndex; |
| | | } |
| | | |
| | | public String getRefreshPage() { |
| | | return refreshPage; |
| | | } |
| | | |
| | | public void setRefreshPage(String refreshPage) { |
| | | this.refreshPage = refreshPage; |
| | | } |
| | | |
| | | public boolean isIsNoStoreWatchHistory() { |
| | | return isNoStoreWatchHistory; |
| | | } |
| | | |
| | | public void setIsNoStoreWatchHistory(boolean isNoStoreWatchHistory) { |
| | | this.isNoStoreWatchHistory = isNoStoreWatchHistory; |
| | | } |
| | | |
| | | public String getVideoSubtitle() { |
| | | return videoSubtitle; |
| | | } |
| | | |
| | | public void setVideoSubtitle(String videoSubtitle) { |
| | | this.videoSubtitle = videoSubtitle; |
| | | } |
| | | |
| | | public boolean isNoStoreWatchHistory() { |
| | | return isNoStoreWatchHistory; |
| | | } |
| | | |
| | | public void setNoStoreWatchHistory(boolean noStoreWatchHistory) { |
| | | isNoStoreWatchHistory = noStoreWatchHistory; |
| | | } |
| | | |
| | | public String getPublishDate() { |
| | | return publishDate; |
| | | } |
| | | |
| | | public void setPublishDate(String publishDate) { |
| | | this.publishDate = publishDate; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import com.yeshi.buwan.videos.youku.entity.YouKuShowDetail; |
| | | import com.yeshi.buwan.videos.youku.entity.YouKuShowSimple; |
| | | import com.yeshi.buwan.videos.youku.entity.YouKuVideo; |
| | | import org.json.JSONArray; |
| | | import org.json.JSONObject; |
| | | import org.yeshi.utils.HttpUtil; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.lang.reflect.Type; |
| | | import java.net.URI; |
| | | import java.net.URLEncoder; |
| | | import java.util.*; |
| | | |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * @return com.yeshi.buwan.videos.youku.YouKuApiUtil.ListResultDTO |
| | | * @author hxh |
| | | * @description 获取热门的专辑 |
| | | * @date 15:26 2024/3/21 |
| | | * @param: category |
| | | * @param: page |
| | | * @param: pageSize |
| | | **/ |
| | | public static ListResultDTO getHotShowListByCategory(String category, int page, int pageSize) throws UnsupportedEncodingException { |
| | | |
| | | String seesion = "{\"subIndex\":96,\"trackInfo\":{\"parentdrawerid\":\"34441\"},\"spmA\":\"a2h05\",\"level\":2,\"spmC\":\"drawer3\",\"spmB\":\"8165803_SHAIXUAN_ALL\",\"index\":1,\"pageName\":\"page_channelmain_SHAIXUAN_ALL\",\"scene\":\"search_component_paging\",\"scmB\":\"manual\",\"path\":\"EP782932\",\"scmA\":\"20140719\",\"scmC\":\"34441\",\"from\":\"SHAIXUAN\",\"id\":227939,\"category\":\"电视剧\"}"; |
| | | net.sf.json.JSONObject sessionJSON = net.sf.json.JSONObject.fromObject(seesion); |
| | | sessionJSON.put("subIndex", (page - 1) * pageSize); |
| | | sessionJSON.put("category", category); |
| | | String url = String.format("https://www.youku.com/category/data?session=%s¶ms=%s&pageNo=%s", URLEncoder.encode(sessionJSON.toString(), "UTF-8"), URLEncoder.encode("{\"type\":\"" + category + "\"}", "UTF-8"), page); |
| | | Map<String,String> headers=new HashMap<>(); |
| | | headers.put("Accept","text/javascript, text/html, application/xml, text/xml, */*"); |
| | | headers.put("Bx-V","2.5.11"); |
| | | headers.put("Content-Type","application/x-www-form-urlencoded"); |
| | | headers.put("Referer","https://www.youku.com/channel/webtv/list?"); |
| | | |
| | | headers.put("User-Agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"); |
| | | headers.put("Sec-Ch-Ua","\"Chromium\";v=\"122\", \"Not(A:Brand\";v=\"24\", \"Google Chrome\";v=\"122\""); |
| | | headers.put("Sec-Ch-Ua-Mobile","?0"); |
| | | headers.put("Sec-Ch-Ua-Platform","\"Windows\""); |
| | | headers.put("Sec-Fetch-Dest","empty"); |
| | | headers.put("Sec-Fetch-Mode","cors"); |
| | | headers.put("Sec-Fetch-Site","same-origin"); |
| | | |
| | | String result = HttpUtil.get(url,new HashMap<>(),headers); |
| | | net.sf.json.JSONObject resultJSON = net.sf.json.JSONObject.fromObject(result); |
| | | List<YouKuShowSimple> list =new ArrayList<>(); |
| | | if(resultJSON.optBoolean("success")){ |
| | | net.sf.json.JSONArray array = resultJSON.optJSONObject("data").optJSONObject("filterData").optJSONArray("listData"); |
| | | for(int i=0;i<array.size();i++){ |
| | | net.sf.json.JSONObject item = array.optJSONObject(i); |
| | | YouKuShowSimple show=new YouKuShowSimple(); |
| | | show.setPoster(item.optString("img")); |
| | | show.setName(item.optString("title")); |
| | | show.setLink(item.optString("videoLink")); |
| | | URI uri=URI.create(show.getLink()); |
| | | show.setId(uri.getQuery().replace("s=","").trim()); |
| | | list.add(show); |
| | | } |
| | | } |
| | | return new ListResultDTO(list, 100); |
| | | } |
| | | |
| | | public static ListResultDTO getVideoList(String showId, int page, int pageSize) { |
| | | Map<String, String> params = new HashMap<>(); |
| | | params.put("show_id", showId); |
| | |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | public static void main(String[] args) throws Exception{ |
| | | |
| | | getSearchRank(null,10); |
| | | getSearchRank("电视剧",10); |
| | | // ListResultDTO dto = getShowListByCategory("电视剧",1,20); |
| | | // System.out.printf(dto.toString()); |
| | | // getHotShowListByCategory("电视剧",1,24); |
| | | |
| | | // YouKuShowDetail detail = getShowDetail("1e61efbfbdefbfbd04ef"); |
| | | // YouKuShowDetail detail = getShowDetail("ffaac0420f0042b9b1e1"); |
| | | // System.out.println(detail); |
| | | // getVideoList("0a17e614d7e311e68ce4", 1, 20); |
| | | |
| | |
| | | package com.yeshi.buwan.vo.client.user; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | |
| | | public class UserInfoVO { |
| | | private String id; |
| | | private String nickName; |
| | |
| | | <mdcFields>THREAD_ID,MDC_KEY</mdcFields> |
| | | </appender> |
| | | |
| | | |
| | | <appender name="debugAppender" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/debug/debug.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/debug/.%d{yyyy-MM-dd}.log.gz</fileNamePattern> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>INFO</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <appender name="appStoreAppender" class="com.tencentcloudapi.cls.LoghubAppender"> |
| | | <!--必选项--> |
| | | <endpoint>${tencent.log.endpoint}</endpoint> |
| | |
| | | </logger> |
| | | |
| | | |
| | | <logger name="debug" level="INFO" additivity="false"> |
| | | <appender-ref ref="debugAppender"></appender-ref> |
| | | </logger> |
| | | |
| | | |
| | | <logger name="com.yeshi.buwan.controller.AppleController" level="INFO" additivity="false"> |
| | | <appender-ref ref="appStoreAppender"></appender-ref> |
| | | </logger> |
| | |
| | | public class DES { |
| | | @org.junit.Test |
| | | public void test1() { |
| | | String st = "iDp+mknN2urZPWPAdmBTv1ME3YqW7QwsYdyNZlGbD4OM41zjK4t7VF6W3TtXskAAKgHKl39hNukwNhMUNfS8M21fJsLuZLdUX4vMxG/vcfnVK/UzMgpLwgQA5AYOCg6VWB+hF/zZGV1dIP3MCdfoApdCu6L8R25es8r97ZM5ttxS7JLFjMHXNjV27aCWdsSk30wzjueSW7zJGnUPkP3ZxQIyIy/dNVXSGKyI1dFn2089VOBeOPZP9T0ZJPsob95qv7B2t7zUFDe5U94UL6rmVf2Gpo1fiyTNa8COHMXyLHBMz27Q5kvm+4TngTe5hzHaN+D9Svm3o0xJiMKFmvc6t9BoLPl1aSQh3FqVZL4fhzIZAA6K7SYODH1dMGf2m8tkr7vC/zPXrIt7AQeiqSiUyQxqQYKc7+ucEk5qnF1hK/cA4fHj7TznWIQFkzDPrr4PS1KPuiJ0SMZ9UGQSeWXAUMgoxOUvKSu9W4PzTlnqlsZvo72q94wZVhEzd0SIv2Fb7239DLpiNKb/FHyiv0P8uljlWITabTq0vIBR1cggUOshsCfGUeYLQY42eoKoE87RVoQg5cn7Ef8EksIkYzUo/yizLyFsqhmNYmMcd4bquAN9fNFLSAdIIx+s0kHj3YY+QE1GlFaPEFj1N8na4IukTPNmD1LEpsr1bUexIAiQMtBNEgAxHN51iRswCsZhynSjWaN/xEvYcxEISjfGOAP2d0uBwCe0yEuSbGvWACYEhXRl8EJj0KShaA=="; |
| | | String st = "iDp+mknN2urZPWPAdmBTv1ME3YqW7QwsJH0zD9ebFH7kI5NtvSWSUl4+FvBTCeOb+Nk40C4Fn/d0u3Kmr8vDhx9+u8SNrBJtF9KAfFmBfP98oR1Z7YwBK4RijnPgnZcLnPIXcMTy9B/iTloTk3Meg2697fyeTOwzR9aXcTW7kTiwC/6Vu+dTe0ZGlQpzgRM4e0JEfq4bFMFDe9TV+exA6ikwrh10uow/YHVNonEfqt32nQB55NOHgBLFxEHcdgdJB9hfynN/Ixx3yoGoTiQwteerArZHj5FUZW+d2naxn2bxny+TI+WuBjtSkfsY+wMdSk4ewaukUejM5TrLta6hzwW0vzNpzaKFp/GZ+A2MpIcggJcZhgrx753WPb2FudcoHSBeYGL9YfEze5EKt6dB2Bbe4OLmw/HaQDLFlyjR2VIcOFTQ6JWVbQ=="; |
| | | System.out.println(DESUtil.decode(st)); |
| | | } |
| | | |
| | |
| | | package com.hxh.spring.test; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.yeshi.buwan.dao.juhe.funtv.FunTVVideo2Dao; |
| | | import com.yeshi.buwan.dao.juhe.funtv.FunTVVideoDao; |
| | | import com.yeshi.buwan.dao.juhe.funtv.VideoFunTVDao; |
| | | import com.yeshi.buwan.dao.juhe.funtv.VideoFunTVNewDao; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.videos.funtv.FunTVApi; |
| | | import com.yeshi.buwan.videos.funtv.FunTVDataParseUtil; |
| | | import com.yeshi.buwan.videos.funtv.FunTVUtil; |
| | | import com.yeshi.buwan.videos.funtv.*; |
| | | import com.yeshi.buwan.videos.funtv.entity.FunTVAlbum; |
| | | import com.yeshi.buwan.videos.funtv.entity.FunTVVideo; |
| | | import com.yeshi.buwan.videos.funtv.entity.VideoFunTV; |
| | | import com.yeshi.buwan.videos.funtv.vo.FunTVMovieVideo; |
| | | import com.yeshi.buwan.videos.funtv.vo.FunTVTVAlbum; |
| | | import com.yeshi.buwan.service.imp.juhe.FunTVService; |
| | | import com.yeshi.buwan.util.BeanUtil; |
| | |
| | | private VideoFunTVNewDao videoFunTVNewDao; |
| | | @Resource |
| | | private FunTVService funTVService; |
| | | |
| | | @Resource |
| | | private FunTVVideoDao funTVVideoDao; |
| | | |
| | | @org.junit.Test |
| | | public void test1() { |
| | |
| | | |
| | | @org.junit.Test |
| | | public void test8() { |
| | | List<String> list = FunTVApi.getPageUrl(FunTVApi.FUNTV_ALL_TV); |
| | | for (String url : list) { |
| | | List<FunTVTVAlbum> videoList = FunTVApi.parseTV(url); |
| | | System.out.println(videoList); |
| | | } |
| | | funTVUtil.startParseAll(); |
| | | } |
| | | |
| | | @Test |
| | |
| | | funTVUtil.startUpdate(); |
| | | } |
| | | |
| | | @Test |
| | | public void addToVideo() throws Exception { |
| | | // 将电影加入到视频列表 |
| | | List<String> list = FunTVWebApiUtil.requestList(FunTVWebApiUtil.MOVIE_FREE.replace("{page}", "1")); |
| | | for(String id:list) { |
| | | FunTVWebApiUtil.FunTVWebAlbum album = FunTVWebApiUtil.getAlbumDetail(id); |
| | | System.out.println(album); |
| | | // 专辑详情 |
| | | FunTVAlbum funTVAlbum = FunTVFactory.create(album); |
| | | List<FunTVVideo> funTVVideos=new ArrayList<>(); |
| | | for(FunTVWebApiUtil.FunTVWebEpisode episode:album.getEpisodes()){ |
| | | FunTVVideo funTVVideo = FunTVFactory.create(episode, funTVAlbum); |
| | | funTVVideos.add(funTVVideo); |
| | | } |
| | | funTVAlbum.setVideoList(funTVVideos); |
| | | funTVService.saveFunTVAlbum(funTVAlbum, funTVVideos); |
| | | funTVService.addFunTVAlbumToVideoInfo(funTVAlbum, false); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void syncFuntvData() { |
| | | // 将原来的 |
| | | List<VideoFunTV> list = videoFunTVDao.listAll(0, 20000); |
| | | for (VideoFunTV video : list) { |
| | | if (video.getId() == null) |
| | |
| | | package com.hxh.spring.test; |
| | | |
| | | import com.yeshi.buwan.dao.HomeNoticeDao; |
| | | import com.yeshi.buwan.dao.juhe.youku.InternetSearchVideoDao; |
| | | import com.yeshi.buwan.dao.video.AlbumVideoMapDao; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.solr.SolrAlbumVideo; |
| | |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.test.context.ContextConfiguration; |
| | | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
| | | import org.springframework.test.context.web.WebAppConfiguration; |
| | |
| | | |
| | | @Test |
| | | public void search() { |
| | | String key = "大唐狄公案"; |
| | | SolrVideoSearchFilter filter = new SolrVideoSearchFilter(); |
| | | filter.setKey(key); |
| | | filter.setContentType(1); |
| | | |
| | | SolrResultDTO internetSearchResultDTO = solrInternetSearchVideoDataManager.find(filter, 1, 10); |
| | | } |
| | | |
| | | |
| | |
| | | System.out.println(solrAlbumVideo); |
| | | } |
| | | |
| | | @Test |
| | | public void syncInternetSearch(){ |
| | | solrInternetSearchVideoDataManager.syncAllAlbum(); |
| | | } |
| | | |
| | | @Resource |
| | | private InternetSearchVideoDao internetSearchVideoDao; |
| | | |
| | | @Test |
| | | public void updateTag(){ |
| | | Query query=new Query(); |
| | | query.addCriteria(Criteria.where("tag").is("评分:null")); |
| | | List<InternetSearchVideo> list = internetSearchVideoDao.findList(query); |
| | | for(InternetSearchVideo video:list){ |
| | | InternetSearchVideo update=new InternetSearchVideo(); |
| | | update.setTag("评分:9.0"); |
| | | update.setId(video.getId()); |
| | | internetSearchVideoDao.updateSelective(update); |
| | | } |
| | | System.out.println(list); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | @Test |
| | | public void test2() throws Exception { |
| | | BilibiliApiUtil.MediaUrlResult result = BilibiliApiUtil.getMediaList(BilibiliUtil.TYPE_GUOMAN, 2, 1); |
| | | BilibiliApiUtil.MediaUrlResult result = BilibiliApiUtil.getMediaList(BilibiliUtil.TYPE_GUOMAN, 3, 1); |
| | | int page = result.getTotal() % 20 == 0 ? result.getTotal() / 20 : result.getTotal() / 20 + 1; |
| | | for (int i = 0; i < 10; i++) { |
| | | for (int i = 0; i < 3; i++) { |
| | | System.out.println("page:" + i); |
| | | result = BilibiliApiUtil.getMediaList(BilibiliUtil.TYPE_DIANSHIJU, 2, i + 1); |
| | | result = BilibiliApiUtil.getMediaList(BilibiliUtil.TYPE_DIANSHIJU, 3, i + 1); |
| | | if (result.getResult() != null) |
| | | for (String url : result.getResult()) { |
| | | try { |
| | |
| | | } |
| | | |
| | | @Test |
| | | public void test3() throws Exception { |
| | | BilibiliMediaInfo mediaInfo = BilibiliApiUtil.parseMediaInfo("https://www.bilibili.com/bangumi/play/ss28747?spm_id_from=333.337.0.0"); |
| | | bilibiliVideoService.addToInternetSearch(mediaInfo); |
| | | } |
| | | |
| | | @Test |
| | | public void addToSearch() throws Exception { |
| | | BilibiliMediaInfo mediaInfo = BilibiliApiUtil.parseMediaInfo("https://www.bilibili.com/bangumi/play/ss28761/"); |
| | | // BilibiliMediaInfo mediaInfo = bilibiliVideoService.getSimpleMediaDetail(365413358L); |
| | |
| | | package com.hxh.spring.test.video; |
| | | |
| | | |
| | | import com.yeshi.buwan.dao.VideoInfoDao; |
| | | import com.yeshi.buwan.dao.juhe.hanmi.HanmiShowDao; |
| | | import com.yeshi.buwan.dao.juhe.hanmi.HanmiShowEpisodeDao; |
| | | import com.yeshi.buwan.dao.juhe.hanmi.VideoHanmiMapDao; |
| | | import com.yeshi.buwan.dao.juhe.youku.InternetSearchVideoDao; |
| | | import com.yeshi.buwan.domain.ResourceVideo; |
| | | import com.yeshi.buwan.domain.video.InternetSearchVideo; |
| | | import com.yeshi.buwan.service.imp.ResourceVideoService; |
| | | import com.yeshi.buwan.service.imp.VideoInfoService; |
| | | import com.yeshi.buwan.service.imp.VideoService; |
| | | import com.yeshi.buwan.service.inter.juhe.HanmiService; |
| | | import com.yeshi.buwan.service.inter.juhe.InternetSearchVideoService; |
| | | import com.yeshi.buwan.videos.hanmi.HanmiApiUtil; |
| | | import com.yeshi.buwan.videos.hanmi.entity.HanmiShow; |
| | | import com.yeshi.buwan.videos.hanmi.entity.HanmiShowEpisode; |
| | | import com.yeshi.buwan.videos.hanmi.entity.VideoHanmiMap; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.test.context.ContextConfiguration; |
| | | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
| | | import org.springframework.test.context.web.WebAppConfiguration; |
| | |
| | | @Resource |
| | | private HanmiShowDao hanmiShowDao; |
| | | |
| | | final String MOVIE_URL = "https://www.wztaichuan.com/vod/show/area/%E9%9F%A9%E5%9B%BD/id/1/page/{页码}.html"; |
| | | final String SHOW_URL = "https://www.wztaichuan.com/vod/show/area/%E9%9F%A9%E5%9B%BD/id/3/page/{页码}.html"; |
| | | final String TV_URL = "https://www.wztaichuan.com/vod/type/id/5/page/{页码}.html"; |
| | | |
| | | private List<HanmiShow> updateShow(String listUrl,int page) throws Exception { |
| | | List<HanmiShow> showList = HanmiApiUtil.parseDetailList(HanmiApiUtil.parseList(listUrl.replace("{页码}",page+""))); |
| | | for (HanmiShow show : showList) { |
| | | if(listUrl.contains("/id/1/")){ |
| | | show.setType("电影"); |
| | | }else if(listUrl.contains("/id/3/")){ |
| | | show.setType("综艺"); |
| | | }else if(listUrl.contains("/id/5/")){ |
| | | show.setType("电视剧"); |
| | | } |
| | | hanmiService.saveShow(show); |
| | | } |
| | | return showList; |
| | | } |
| | | |
| | | |
| | | |
| | | @Test |
| | | public void updateLatest() throws Exception { |
| | | String[] urls =new String[]{MOVIE_URL,SHOW_URL,TV_URL}; |
| | | for(String url: urls) { |
| | | for (int i = 1; i < 20; i++) { |
| | | System.out.printf(i + "=========================="); |
| | | // 电影 https://www.wztaichuan.com/vod/show/area/%E9%9F%A9%E5%9B%BD/id/1/page/2.html |
| | | // 综艺 https://www.wztaichuan.com/vod/show/area/%E9%9F%A9%E5%9B%BD/id/3/page/2.html |
| | | // 韩剧 https://www.wztaichuan.com/vod/type/id/5/page/2.html |
| | | List<HanmiShow> showList = updateShow(url,i); |
| | | if (showList.size() < 10) { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void addHanJu() throws Exception { |
| | | for (int i = 1; i < 3; i++) { |
| | | List<HanmiShow> showList = HanmiApiUtil.parseDetailList(HanmiApiUtil.parseList("https://www.hmtv.me/hanju/page/" + i)); |
| | | for (HanmiShow show : showList) { |
| | | hanmiService.saveShow(show); |
| | | // hanmiService.deleteByShowId(show.getId()); |
| | | for (int i = 1; i < 30; i++) { |
| | | List<HanmiShow> showList = updateShow(SHOW_URL,i); |
| | | if (showList.size() < 10) { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void addToVideo() throws IOException { |
| | | |
| | | for (int i = 1; i < 3; i++) { |
| | | List<HanmiShow> showList = HanmiApiUtil.parseList("https://www.hmtv.me/hanju/page/" + i); |
| | | Collections.reverse(showList); |
| | | for (HanmiShow show : showList) { |
| | | show.setId(show.getUrl().replace("/show/", "").trim()); |
| | | show = hanmiService.getShowDetail(show.getId()); |
| | | if (show != null) |
| | | hanmiService.addToVideoInfo(show); |
| | | long count = hanmiService.countAll(); |
| | | int pageSize = 100; |
| | | int totalPage=(int) (count%pageSize ==0?count/pageSize:count/pageSize+1); |
| | | for(int i=0;i<totalPage;i++) { |
| | | List<HanmiShow> list = hanmiService.listAll(i + 1, pageSize); |
| | | for(HanmiShow show:list){ |
| | | try { |
| | | show = hanmiService.getShowDetail(show.getId()); |
| | | hanmiService.addToInternetSearch(show); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | show = hanmiService.getShowDetail(show.getId()); |
| | | show.setType("韩剧"); |
| | | if (show != null) |
| | | hanmiService.addToVideoInfo(show); |
| | | hanmiService.addToInternetSearch(show); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Resource |
| | | private VideoHanmiMapDao videoHanmiMapDao; |
| | | |
| | | @Resource |
| | | private InternetSearchVideoDao internetSearchVideoDao; |
| | | |
| | | @Resource |
| | | private ResourceVideoService resourceVideoService; |
| | | |
| | | @Resource |
| | | private VideoInfoDao videoInfoDao; |
| | | |
| | | @Test |
| | | public void update() { |
| | | List<HanmiShow> list = hanmiShowDao.listAll(0, 100); |
| | | for (HanmiShow show : list) { |
| | | List<HanmiShowEpisode> epList = hanmiShowEpisodeDao.listByShowId(show.getId(), 0, 1); |
| | | if (epList != null && epList.size() > 0) { |
| | | for (int i = 0; i < 100; i++) { |
| | | List<HanmiShow> list = hanmiShowDao.listAll(i*100, 100); |
| | | for (HanmiShow show : list) { |
| | | try { |
| | | List<HanmiShowEpisode> episodeList = HanmiApiUtil.getShowEpisodesFromPlayUrl(epList.get(0).getPlayUrl()); |
| | | if (episodeList != null) |
| | | for (HanmiShowEpisode episode : episodeList) { |
| | | show = HanmiApiUtil.parseShowDetail(show); |
| | | if (show != null && show.getEpisodeList() != null) { |
| | | // 更新封面图片 |
| | | VideoHanmiMap map = videoHanmiMapDao.selectByShowId(show.getId()); |
| | | if(map!=null){ |
| | | InternetSearchVideo video = internetSearchVideoDao.get(map.getVideoId()); |
| | | if(video!=null){ |
| | | InternetSearchVideo update = new InternetSearchVideo(); |
| | | update.setId(video.getId()); |
| | | update.setVpicture(show.getPicture()); |
| | | internetSearchVideoDao.updateSelective(update); |
| | | } |
| | | } |
| | | Query query = new Query(); |
| | | query.addCriteria(new Criteria().where("_id").is(show.getId())); |
| | | Update update = new Update(); |
| | | update.set("tag", show.getTag()); |
| | | hanmiShowDao.update(query, update); |
| | | query = new Query(); |
| | | query.addCriteria(new Criteria().where("showId").is(show.getId())); |
| | | hanmiShowEpisodeDao.delete(query); |
| | | // 删除原来的数据 |
| | | for (HanmiShowEpisode episode : show.getEpisodeList()) { |
| | | episode.setShowId(show.getId()); |
| | | episode.setId(HanmiShowEpisode.createId(episode.getShowId(), episode.getTag())); |
| | | episode.setCreateTime(new Date()); |
| | | hanmiShowEpisodeDao.save(episode); |
| | | } |
| | | } catch (IOException e) { |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void deleteFromVideo(){ |
| | | // 清除韩迷数据 |
| | | List<ResourceVideo> resourceVideos = resourceVideoService.listResourceVideo(28L,1,100 ); |
| | | for(ResourceVideo rv:resourceVideos){ |
| | | List<ResourceVideo> resourceList = resourceVideoService.getResourceList(rv.getVideo().getId()); |
| | | resourceVideoService.delete(rv.getVideo().getId(), rv.getResource().getId()); |
| | | if(resourceList.size()<2){ |
| | | // 删除视频 |
| | | videoInfoDao.delete(rv.getVideo()); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | @Test |
| | | public void updateRank() throws Exception { |
| | | rankJob.updateIqiyiRank(""); |
| | | rankJob.updateRank(""); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.yeshi.buwan.job.video.TencentVideoUpdate; |
| | | import com.yeshi.buwan.service.inter.juhe.InternetSearchVideoService; |
| | | import com.yeshi.buwan.service.inter.juhe.TencentVideoService; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import com.yeshi.buwan.videos.tencent.entity.TencentCoverInfo; |
| | | import org.json.JSONObject; |
| | | import org.junit.Test; |
| | |
| | | import org.springframework.test.context.ContextConfiguration; |
| | | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
| | | import org.springframework.test.context.web.WebAppConfiguration; |
| | | import org.springframework.util.StopWatch; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | |
| | | @Resource |
| | | private TencentVideoUpdate tencentVideoUpdate; |
| | | |
| | | |
| | | @Resource |
| | | private InternetSearchVideoService internetSearchVideoService; |
| | | |
| | | |
| | | @Test |
| | | public void test2() { |
| | | Constant.IsOutNet = false; |
| | | try { |
| | | tencentVideoUpdate.updateLatestVideo("动漫"); |
| | | tencentVideoUpdate.updateCategory("电影",1,1,null); |
| | | tencentVideoUpdate.updateCategory("电视剧",1,1,null); |
| | | tencentVideoUpdate.updateCategory("动漫",1,1,null); |
| | | // TencentCoverInfo coverInfo = tencentVideoService.getSimpleCoverDetail("m441e3rjq9kwpsc"); |
| | | // System.out.println(coverInfo.toString()); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void testAddHanJu() { |
| | | Constant.IsOutNet = false; |
| | | try { |
| | | // tencentVideoUpdate.updateCategory("电影",1,9,100028); |
| | | tencentVideoUpdate.updateCategory("电视剧",1,1,5); |
| | | // TencentCoverInfo coverInfo = tencentVideoService.getSimpleCoverDetail("m441e3rjq9kwpsc"); |
| | | // System.out.println(coverInfo.toString()); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | |
| | | @Test |
| | | public void addToSearch() { |
| | | List<TencentCoverInfo> list = tencentVideoService.list("动漫", 1, 10); |
| | | Constant.IsOutNet = false; |
| | | List<TencentCoverInfo> list = tencentVideoService.list(null, 1, 1000); |
| | | for (TencentCoverInfo info : list) { |
| | | try { |
| | | tencentVideoService.addToInternetSearch(info); |
| | | tencentVideoService.addToInternetSearch(info, false); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | @Test |
| | | public void clearOffLine(){ |
| | | Constant.IsOutNet = false; |
| | | tencentVideoService.clearOfflineCovers(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | @Test |
| | | public void test1() { |
| | | try { |
| | | youKuVideoUpdate.updateLatestVideo("ffca07f611cf426c99af"); |
| | | youKuVideoUpdate.updateLatestVideo("fedf102940f74187909b"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |