コード例 #1
0
  public void parseHomeworkContent(Document document, Homework homework) throws Exception {
    Elements content;

    content = document.select("pre");
    if (content.size() == 0) throw new Exception(Exceptions.PARSE_FAIL);

    homework.content = content.html();
  }
コード例 #2
0
  @Override
  protected Homework parse(
      Request<Homework, HomeworkData> request, HttpResponse response, Document document)
      throws Exception {

    Homework homework = request.args.homework;
    String location = response.header("location");

    if (location != null) {
      if (!location.startsWith("http")) {
        homework.contentUrl = "http://ecourse.ccu.edu.tw/php/Testing_Assessment/" + location;
      } else {
        homework.contentUrl = location;
      }
    } else {
      parseHomeworkContent(document, homework);
    }
    return homework;
  }