예제 #1
0
def fetch(fmgr):
    """
    Fetch verdicts.
    """
    crawler = FJUDCrawler()
    while fmgr.has_fjud_record():
        rec = fmgr.pop_fjud_record()
        crawler.fetch(court=rec.court,
                      needle=rec.needle,
                      year=rec.get_start_year())
        fmgr.remove_fjud_record(rec)
        print("Sleep 60s for polite interaction with the server.")
        time.sleep(1*60)
    crawler.quit()
예제 #2
0
def main():
    """
    Search for bad verdicts and download them again.
    """

    # If <pre> exists, the file has verdict text in it.
    serials = files_without_word(u"<pre>")
    for serial in serials:
        serial = serial.decode("utf-8")
        crawler = FJUDCrawler()
        if u"台上" in serial:
            crawler.fetch(court=u"最高法院", serial=serial, overwrite=True)
        else:
            crawler.fetch(court=u"臺灣高等法院", serial=serial, overwrite=True)
        crawler.quit()
        time.sleep(3)