matthew as a q.

競技プログラミングメイン

クローラメモ

集合知プログラミング』読み進めてる。

  • 落ちるサイトと落ちないサイト

wikipediaの記事をインデキシングするときには、なんか落ちる。

>>> crawler=searchengine.crawler('searchindex_prf.db')
>>> crawler.createindextables()
>>> pages=['http://en.wikipedia.org/wiki/Pseudorandom_function_family']
>>> crawler.crawl(pages)
Indexing http://en.wikipedia.org/wiki/Pseudorandom_function_family
Indexing http://en.wikipedia.org/wiki/Help:Contents
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "searchengine.py", line 113, in crawl
    self.addlinkref(page,url,linkText)
  File "searchengine.py", line 88, in addlinkref
    wordid=self.getentryid('wordlist','word',word)
  File "searchengine.py", line 25, in getentryid
    cur=self.con.execute("select rowid from %s where %s='%s'" % (table,field,value))
pysqlite2.dbapi2.OperationalError: unrecognized token: "'readers''"


食べログだと落ちない。
pagesの中身をhttp://tabelog.com/kyoto/rstLst/ramen/にして同様に実行。

  • 理由の推察

なんでだろうね。
よくわからん。眠い