package top.lvzhiqiang.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import top.lvzhiqiang.dto.R; import top.lvzhiqiang.exception.ParameterException; import top.lvzhiqiang.service.Crawler4FacebookService; import top.lvzhiqiang.service.Crawler4JavbusService; import top.lvzhiqiang.service.Crawler4LoveFootService; import top.lvzhiqiang.service.CrawlerService; import top.lvzhiqiang.util.StringUtils; import javax.annotation.Resource; /** * Crawler Controller * * @author lvzhiqiang * 2022/9/10 21:24 */ @Controller @RequestMapping("/bg/crawler") public class CrawlerController { @Resource private CrawlerService crawlerService; @Resource private Crawler4FacebookService crawler4FacebookService; @Resource private Crawler4JavbusService crawler4JavbusService; @Resource private Crawler4LoveFootService crawler4LoveFootService; /** * findXiaoeknowCourse * * @author lvzhiqiang * 2022/9/11 17:01 */ @RequestMapping("/findXiaoeknowCourse") @ResponseBody public String findXiaoeknowCourse(String title, Integer type, String orderField, String order, String crudT) { if (StringUtils.isEmpty(crudT)) { crudT = "1"; } return crawlerService.findXiaoeknowCourse(title, type, orderField, order, crudT); } /** * Jsoup CrawlerXaoeknowCourse * * @author lvzhiqiang * 2022/9/10 21:24 */ @RequestMapping("/jsoupXiaoeknowCourse") @ResponseBody public R jsoupXiaoeknowCourse(Integer status, Integer isDel, Integer ignoreRetryCount) { if (null == status) { // status = 1; } if (null == isDel) { isDel = 2; } if (null == ignoreRetryCount) { // ignoreRetryCount = 2; } crawlerService.jsoupXiaoeknowCourse(status, isDel, ignoreRetryCount); return R.ok(); } /** * searchIkoaMovie * * @author lvzhiqiang * 2022/9/17 12:55 */ @RequestMapping("/searchIkoaMovie") @ResponseBody public String searchIkoaMovie(String keywords, String movieType, String by, String page) throws Exception { if (StringUtils.isEmpty(keywords)) { throw new ParameterException("搜索关键词不能为空"); } if (StringUtils.isEmpty(page)) { page = "1"; } return crawlerService.searchIkoaMovie(keywords, movieType, by, page); } /** * findIkoaMovieDownloadLog * * @author lvzhiqiang * 2022/9/26 23:22 */ @RequestMapping("/findIkoaMovieDownloadLog") @ResponseBody public String findIkoaMovieDownloadLog(String keyword, Integer pic, String orderField, String order, String crudT) throws Exception { if (StringUtils.isEmpty(crudT)) { crudT = "1"; } return crawlerService.findIkoaMovieDownloadLog(keyword, pic, orderField, order, crudT); } /** * Jsoup IkoaMovieDownloadLog * * @author lvzhiqiang * 2022/10/10 15:37 */ @RequestMapping("/jsoupIkoaMovieDownloadLog") @ResponseBody public R jsoupIkoaMovieDownloadLog(Integer status, Integer isDel, Integer ignoreRetryCount) throws Exception { if (null == status) { // status = 1; } if (null == isDel) { isDel = 2; } if (null == ignoreRetryCount) { // ignoreRetryCount = 2; } return R.ok().data(crawlerService.jsoupIkoaMovieDownloadLog(status, isDel, ignoreRetryCount)); } /** * jsoupIkoaMovie4VideoInfo * * @author lvzhiqiang * 2022/9/25 0:37 */ @RequestMapping("/jsoupIkoaMovie4VideoInfo") @ResponseBody public String jsoupIkoaMovie4VideoInfo(String bitrate) throws Exception { if (StringUtils.isEmpty(bitrate)) { throw new ParameterException("bitrate不能为空"); } crawlerService.jsoupIkoaMovie4VideoInfo(bitrate); return "success"; } /** * findIkoaMovie4VideoInfo * * @author lvzhiqiang * 2022/10/11 14:31 */ @RequestMapping("/findIkoaMovie4VideoInfo") @ResponseBody public String findIkoaMovie4VideoInfo(String bitrate, String order) throws Exception { if (StringUtils.isEmpty(bitrate)) { throw new ParameterException("bitrate不能为空"); } return crawlerService.findIkoaMovie4VideoInfo(bitrate, order); } /** * jsoupFacebookGroupMemberInfo * * @author lvzhiqiang * 2022/10/11 16:11 */ @RequestMapping("/jsoupFacebookGroupMemberInfo") @ResponseBody public String jsoupFacebookGroupMemberInfo(String email, String password, String url, String limit) throws Exception { if (StringUtils.isEmpty(email) || StringUtils.isEmpty(password) || StringUtils.isEmpty(url)) { throw new ParameterException("email|password|url不能为空"); } crawler4FacebookService.jsoupFacebookGroupMemberInfo(email, password, url, limit); return "success"; } /** * jsoupJavbusProfile * * @author lvzhiqiang * 2022/10/18 22:09 */ @RequestMapping("/jsoupJavbusProfile") @ResponseBody public String jsoupJavbusProfile(Long start, Integer limit) throws Exception { if (null == start) { throw new ParameterException("start不能为空"); } crawler4JavbusService.jsoupJavbusProfile(start, limit); return "success"; } /** * handleJavbusLog * * @author lvzhiqiang * 2022/10/20 9:45 */ @RequestMapping("/handleJavbusLog") @ResponseBody public String handleJavbusLog(Integer status) throws Exception { crawler4JavbusService.handleJavbusLog(status); return "success"; } /** * findJavbusProfile * * @author lvzhiqiang * 2022/10/20 11:20 */ @RequestMapping("/findJavbusProfile") @ResponseBody public String findJavbusProfile(String keyword, Integer timeDay, Integer pic, String orderField, String order, Integer pageNo, Integer pageSize) throws Exception { if (null == pageNo) { pageNo = 1; } if (null == pageSize) { pageSize = 10; } return crawler4JavbusService.findJavbusProfile(keyword, timeDay, pic, orderField, order, pageNo, pageSize); } /** * Jsoup LoveFoot * * @author lvzhiqiang * 2022/11/26 15:50 */ @RequestMapping("/jsoupLoveFoot") @ResponseBody public R jsoupLoveFoot(Integer status, Integer isDel, Integer ignoreRetryCount) throws Exception { if (null == isDel) { isDel = 2; } if (null == ignoreRetryCount) { ignoreRetryCount = 2; } crawler4LoveFootService.jsoupLoveFoot4avnoashi(status, isDel, ignoreRetryCount); return R.ok(); } }