Beispiel #1
0
  private void testBidHistory(String file) {
    StringBuffer sb = new StringBuffer(StringTools.cat(file));
    JHTML hDoc = new JHTML(sb);
    List<JHTML.Table> tableList = hDoc.extractTables();

    System.err.println("There were " + tableList.size() + " tables.");

    for (JHTML.Table t : tableList) {
      if (t.rowCellMatches(0, "Bidder")) {
        for (int i = 1; i < t.getRowCount() - 1; i++) {
          System.err.println("Bidder #" + i + ": " + t.getCell(0, i));
        }
      }
    }
  }
Beispiel #2
0
  public void receiveDropString(StringBuffer dropped) {
    if (dropped == null) {
      JConfig.log().logDebug("Dropped is (null)");
      return;
    }

    dropped = new StringBuffer(stripNewlines(dropped.toString()));
    if (sUberDebug) JConfig.log().logDebug("Dropping :" + dropped + ":");

    //  Is it an 'HTML Fragment' as produced by Mozilla, NS6, and IE5+?
    //  BOY it's a small bit to test against, but Mozilla starts with <HTML>,
    //  and IE5 starts with <!DOCTYPE...  The only commonality I can trust is
    //  that they'll start with a tag, not content.  I could look for <HTML>
    //  someplace in the document...  --  mrs: 28-September-2001 03:53
    if (dropped.charAt(0) == '<') {
      JHTML tinyDocument = new JHTML(dropped);
      List<String> allItemsOnPage = tinyDocument.getAllURLsOnPage(true);
      String auctionURL;

      if (allItemsOnPage == null) return;

      for (String anAllItemsOnPage : allItemsOnPage) {
        auctionURL = anAllItemsOnPage;
        if (auctionURL != null) {
          JConfig.log().logDebug("Adding: " + auctionURL.trim());
          MQFactory.getConcrete("drop")
              .enqueue(
                  new DropQObject(auctionURL.trim(), mTargetName, true)); // NONSTRING Queue Object
        }
      }
    } else {
      String newEntry = dropped.toString();

      MQFactory.getConcrete("drop")
          .enqueue(new DropQObject(newEntry.trim(), mTargetName, true)); // NONSTRING Queue Object
    }
  }
Beispiel #3
0
  private Map testMicroformats(String file) {
    StringBuffer sb = new StringBuffer(StringTools.cat(file));
    JHTML hDoc = new JHTML(sb);

    return hDoc.extractMicroformat();
  }