CrawlerController.java 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. package top.lvzhiqiang.controller;
  2. import org.springframework.stereotype.Controller;
  3. import org.springframework.web.bind.annotation.RequestMapping;
  4. import org.springframework.web.bind.annotation.ResponseBody;
  5. import top.lvzhiqiang.dto.R;
  6. import top.lvzhiqiang.exception.ParameterException;
  7. import top.lvzhiqiang.service.Crawler4FacebookService;
  8. import top.lvzhiqiang.service.Crawler4JavbusService;
  9. import top.lvzhiqiang.service.Crawler4LoveFootService;
  10. import top.lvzhiqiang.service.CrawlerService;
  11. import top.lvzhiqiang.util.StringUtils;
  12. import javax.annotation.Resource;
  13. /**
  14. * Crawler Controller
  15. *
  16. * @author lvzhiqiang
  17. * 2022/9/10 21:24
  18. */
  19. @Controller
  20. @RequestMapping("/bg/crawler")
  21. public class CrawlerController {
  22. @Resource
  23. private CrawlerService crawlerService;
  24. @Resource
  25. private Crawler4FacebookService crawler4FacebookService;
  26. @Resource
  27. private Crawler4JavbusService crawler4JavbusService;
  28. @Resource
  29. private Crawler4LoveFootService crawler4LoveFootService;
  30. /**
  31. * findXiaoeknowCourse
  32. *
  33. * @author lvzhiqiang
  34. * 2022/9/11 17:01
  35. */
  36. @RequestMapping("/findXiaoeknowCourse")
  37. @ResponseBody
  38. public String findXiaoeknowCourse(String title, Integer type, String orderField, String order, String crudT) {
  39. if (StringUtils.isEmpty(crudT)) {
  40. crudT = "1";
  41. }
  42. return crawlerService.findXiaoeknowCourse(title, type, orderField, order, crudT);
  43. }
  44. /**
  45. * Jsoup CrawlerXaoeknowCourse
  46. *
  47. * @author lvzhiqiang
  48. * 2022/9/10 21:24
  49. */
  50. @RequestMapping("/jsoupXiaoeknowCourse")
  51. @ResponseBody
  52. public R jsoupXiaoeknowCourse(Integer status, Integer isDel, Integer ignoreRetryCount) {
  53. if (null == status) {
  54. // status = 1;
  55. }
  56. if (null == isDel) {
  57. isDel = 2;
  58. }
  59. if (null == ignoreRetryCount) {
  60. // ignoreRetryCount = 2;
  61. }
  62. crawlerService.jsoupXiaoeknowCourse(status, isDel, ignoreRetryCount);
  63. return R.ok();
  64. }
  65. /**
  66. * searchIkoaMovie
  67. *
  68. * @author lvzhiqiang
  69. * 2022/9/17 12:55
  70. */
  71. @RequestMapping("/searchIkoaMovie")
  72. @ResponseBody
  73. public String searchIkoaMovie(String keywords, String movieType, String by, String page) throws Exception {
  74. if (StringUtils.isEmpty(keywords)) {
  75. throw new ParameterException("搜索关键词不能为空");
  76. }
  77. if (StringUtils.isEmpty(page)) {
  78. page = "1";
  79. }
  80. return crawlerService.searchIkoaMovie(keywords, movieType, by, page);
  81. }
  82. /**
  83. * findIkoaMovieDownloadLog
  84. *
  85. * @author lvzhiqiang
  86. * 2022/9/26 23:22
  87. */
  88. @RequestMapping("/findIkoaMovieDownloadLog")
  89. @ResponseBody
  90. public String findIkoaMovieDownloadLog(String keyword, Integer pic, String orderField, String order, String crudT) throws Exception {
  91. if (StringUtils.isEmpty(crudT)) {
  92. crudT = "1";
  93. }
  94. return crawlerService.findIkoaMovieDownloadLog(keyword, pic, orderField, order, crudT);
  95. }
  96. /**
  97. * Jsoup IkoaMovieDownloadLog
  98. *
  99. * @author lvzhiqiang
  100. * 2022/10/10 15:37
  101. */
  102. @RequestMapping("/jsoupIkoaMovieDownloadLog")
  103. @ResponseBody
  104. public R jsoupIkoaMovieDownloadLog(Integer status, Integer isDel, Integer ignoreRetryCount) throws Exception {
  105. if (null == status) {
  106. // status = 1;
  107. }
  108. if (null == isDel) {
  109. isDel = 2;
  110. }
  111. if (null == ignoreRetryCount) {
  112. // ignoreRetryCount = 2;
  113. }
  114. return R.ok().data(crawlerService.jsoupIkoaMovieDownloadLog(status, isDel, ignoreRetryCount));
  115. }
  116. /**
  117. * jsoupIkoaMovie4VideoInfo
  118. *
  119. * @author lvzhiqiang
  120. * 2022/9/25 0:37
  121. */
  122. @RequestMapping("/jsoupIkoaMovie4VideoInfo")
  123. @ResponseBody
  124. public String jsoupIkoaMovie4VideoInfo(String bitrate) throws Exception {
  125. if (StringUtils.isEmpty(bitrate)) {
  126. throw new ParameterException("bitrate不能为空");
  127. }
  128. crawlerService.jsoupIkoaMovie4VideoInfo(bitrate);
  129. return "success";
  130. }
  131. /**
  132. * findIkoaMovie4VideoInfo
  133. *
  134. * @author lvzhiqiang
  135. * 2022/10/11 14:31
  136. */
  137. @RequestMapping("/findIkoaMovie4VideoInfo")
  138. @ResponseBody
  139. public String findIkoaMovie4VideoInfo(String bitrate, String order) throws Exception {
  140. if (StringUtils.isEmpty(bitrate)) {
  141. throw new ParameterException("bitrate不能为空");
  142. }
  143. return crawlerService.findIkoaMovie4VideoInfo(bitrate, order);
  144. }
  145. /**
  146. * jsoupFacebookGroupMemberInfo
  147. *
  148. * @author lvzhiqiang
  149. * 2022/10/11 16:11
  150. */
  151. @RequestMapping("/jsoupFacebookGroupMemberInfo")
  152. @ResponseBody
  153. public String jsoupFacebookGroupMemberInfo(String email, String password, String url, String limit) throws Exception {
  154. if (StringUtils.isEmpty(email) || StringUtils.isEmpty(password) || StringUtils.isEmpty(url)) {
  155. throw new ParameterException("email|password|url不能为空");
  156. }
  157. crawler4FacebookService.jsoupFacebookGroupMemberInfo(email, password, url, limit);
  158. return "success";
  159. }
  160. /**
  161. * jsoupJavbusProfile
  162. *
  163. * @author lvzhiqiang
  164. * 2022/10/18 22:09
  165. */
  166. @RequestMapping("/jsoupJavbusProfile")
  167. @ResponseBody
  168. public String jsoupJavbusProfile(Long start, Integer limit) throws Exception {
  169. if (null == start) {
  170. throw new ParameterException("start不能为空");
  171. }
  172. crawler4JavbusService.jsoupJavbusProfile(start, limit);
  173. return "success";
  174. }
  175. /**
  176. * handleJavbusLog
  177. *
  178. * @author lvzhiqiang
  179. * 2022/10/20 9:45
  180. */
  181. @RequestMapping("/handleJavbusLog")
  182. @ResponseBody
  183. public String handleJavbusLog(Integer status) throws Exception {
  184. crawler4JavbusService.handleJavbusLog(status);
  185. return "success";
  186. }
  187. /**
  188. * findJavbusProfile
  189. *
  190. * @author lvzhiqiang
  191. * 2022/10/20 11:20
  192. */
  193. @RequestMapping("/findJavbusProfile")
  194. @ResponseBody
  195. public String findJavbusProfile(String keyword, Integer timeDay, Integer pic, String orderField, String order, Integer pageNo, Integer pageSize) throws Exception {
  196. if (null == pageNo) {
  197. pageNo = 1;
  198. }
  199. if (null == pageSize) {
  200. pageSize = 10;
  201. }
  202. return crawler4JavbusService.findJavbusProfile(keyword, timeDay, pic, orderField, order, pageNo, pageSize);
  203. }
  204. /**
  205. * Jsoup LoveFoot
  206. *
  207. * @author lvzhiqiang
  208. * 2022/11/26 15:50
  209. */
  210. @RequestMapping("/jsoupLoveFoot")
  211. @ResponseBody
  212. public R jsoupLoveFoot(Integer status, Integer isDel, Integer ignoreRetryCount) throws Exception {
  213. if (null == isDel) {
  214. isDel = 2;
  215. }
  216. if (null == ignoreRetryCount) {
  217. ignoreRetryCount = 2;
  218. }
  219. crawler4LoveFootService.jsoupLoveFoot4avnoashi(status, isDel, ignoreRetryCount);
  220. return R.ok();
  221. }
  222. }