CQPadアップデート 0.65


CQPadは、クローラをGUIでふにふにするためのツールです。


詳細
http://d.hatena.ne.jp/ruby-U/20100608/1275986703


ダウンロード
http://dl.dropbox.com/u/1651917/hosting/etc/cqpad/dropindex.html


更新点は

  • パーサのバグを修正
  • 安定性の向上
  • 応答性の向上
  • プラグイン対応
  • 進捗の詳細な表示
  • 文字コード判定精度の向上
  • ダウンロードウェイト時間を設定できるようにした
  • ダウンロードリトライ回数を設定できるようにした
  • 標準入力の対応(適当)

など。


プラグインで、集めたURLに対する処理を記述できるようにしました。
プラグインJythonで記述します。標準ライブラリを添付しているのでPythonistaも安心?です。
/extension/plugin/以下にサンプルが入っています。

#テキストエリアに表示するテキストを生成するプラグインの例
def call(API):
    results = API.getData().get("results") #result of query
    
    result_title = ""
    result_file  = API.createTemporaryFile("txt") #temporary file
    
    f = open(result_file.getPath(), "w")
    for loader in results:
        title = loader.getTitle().strip()
        if not result_title:
            result_title = title
        f.write( "----------------------------------------\n" )
        f.write( "[" )
        f.write( " %s" % title.encode("utf-8", "replace") )
        f.write( "]\n" )
        f.write( loader.getText().encode("utf-8", "replace") )
        f.write( "\n" )
    f.close()
    return (result_title, result_file)
#テキストをファイルに保存するプラグインの例
def call(API):
    data = API.getData()
    title = data.get("title")
    text  = data.get("text")
    
    save_file = "%s.txt" % title
    f = open(save_file, "w")
    for line in open(text.getPath(), "r"):
        f.write( line )
    f.close()
    return "\"%s\" saved" % save_file

いろいろと改善して、ようやく使い物になってきたかなぁというところです。