本科生学生信息接口用到的xpath
+ *看着挺唬人的,其实直接浏览器选择元素复制xpath就行了
+ *这里的xpath只要网站UI不整什么花活就不会出问题
+ * + * @author lensfrex + * @create 2022-10-22 22:16 + */ +final class StudentInfoXpath { + public static final String STUDENT_NUMBER = "//*[@id=\"xjkpTable\"]/tbody/tr[3]/td[5]"; + + public static final String COLLEGE = "//*[@id=\"xjkpTable\"]/tbody/tr[3]/td[1]"; + + public static final String MAJOR = "//*[@id=\"xjkpTable\"]/tbody/tr[3]/td[2]"; + + public static final String CLASS = "//*[@id=\"xjkpTable\"]/tbody/tr[3]/td[4]"; + + public static final String NAME = "//*[@id=\"xjkpTable\"]/tbody/tr[4]/td[2]"; + + public static final String SEX = "//*[@id=\"xjkpTable\"]/tbody/tr[4]/td[4]"; + + public static final String BIRTHDAY = "//*[@id=\"xjkpTable\"]/tbody/tr[5]/td[2]"; + + public static final String HOMETOWN = "//*[@id=\"xjkpTable\"]/tbody/tr[7]/td[2]"; + + public static final String NATIONALITY = "//*[@id=\"xjkpTable\"]/tbody/tr[8]/td[4]"; + + public static final String ID_NUMBER = "//*[@id=\"xjkpTable\"]/tbody/tr[50]/td[4]"; +} \ No newline at end of file diff --git a/mywust-core/src/main/java/cn/linghang/mywust/core/parser/undergraduate/TrainingPlanPageParser.java b/mywust-core/src/main/java/cn/linghang/mywust/core/parser/undergraduate/TrainingPlanPageParser.java index 25510cb..77e9f3d 100644 --- a/mywust-core/src/main/java/cn/linghang/mywust/core/parser/undergraduate/TrainingPlanPageParser.java +++ b/mywust-core/src/main/java/cn/linghang/mywust/core/parser/undergraduate/TrainingPlanPageParser.java @@ -3,7 +3,6 @@ package cn.linghang.mywust.core.parser.undergraduate; import cn.linghang.mywust.core.exception.ParseException; import cn.linghang.mywust.core.parser.Parser; import org.jsoup.Jsoup; -import org.jsoup.nodes.Element; import org.jsoup.select.Elements; public class TrainingPlanPageParser implements Parser本科生学生信息接口用到的xpath
- *看着挺唬人的,其实直接浏览器选择元素复制xpath就行了
- *这里的xpath只要网站UI不整什么花活就不会出问题
- * - * @author lensfrex - * @create 2022-10-22 22:16 - */ -public class StudentInfoXpath { - public static final String STUDENT_NUMBER = "//*[@id=\"xjkpTable\"]/tbody/tr[3]/td[5]"; - - public static final String COLLEGE = "//*[@id=\"xjkpTable\"]/tbody/tr[3]/td[1]"; - - public static final String MAJOR = "//*[@id=\"xjkpTable\"]/tbody/tr[3]/td[2]"; - - public static final String CLASS = "//*[@id=\"xjkpTable\"]/tbody/tr[3]/td[4]"; - - public static final String NAME = "//*[@id=\"xjkpTable\"]/tbody/tr[4]/td[2]"; - - public static final String SEX = "//*[@id=\"xjkpTable\"]/tbody/tr[4]/td[4]"; - - public static final String BIRTHDAY = "//*[@id=\"xjkpTable\"]/tbody/tr[5]/td[2]"; - - public static final String HOMETOWN = "//*[@id=\"xjkpTable\"]/tbody/tr[7]/td[2]"; - - public static final String NATIONALITY = "//*[@id=\"xjkpTable\"]/tbody/tr[8]/td[4]"; - - public static final String ID_NUMBER = "//*[@id=\"xjkpTable\"]/tbody/tr[50]/td[4]"; -} diff --git a/mywust-core/src/main/java/cn/linghang/mywust/core/request/graduate/GraduateRequestFactory.java b/mywust-core/src/main/java/cn/linghang/mywust/core/request/graduate/GraduateRequestFactory.java index a24700c..00f9b00 100644 --- a/mywust-core/src/main/java/cn/linghang/mywust/core/request/graduate/GraduateRequestFactory.java +++ b/mywust-core/src/main/java/cn/linghang/mywust/core/request/graduate/GraduateRequestFactory.java @@ -15,18 +15,18 @@ public class GraduateRequestFactory extends RequestFactory { return makeHttpRequest(Graduate.GRADUATE_CAPTCHA_API); } - private static final Map