3

Evernote クリッパーのように Web ページをキャプチャできる Rails アプリを作成したいと考えています。慣れていない場合は、ブラウザでツールバーのボタンをクリックすると、Web ページ レイアウトのかなり正確なコピーがキャプチャされます。たとえば、http://www.evernote.com/pub/jssmith072/sharedにアクセスして、そのページの 1 つのノートをクリックすると、私がキャプチャした Web ページが表示されます。どこから始めればよいかわからない理由がいくつかあります。

  • RailsアプリでレンダリングされたWebページをプログラムで取得するにはどうすればよいですか? WebKit を使用できますか?
  • この Web ページをデータベースに保存するにはどうすればよいですか?
  • この Web ページのアーカイブをブラウザー間で一貫して表示するにはどうすればよいですか?
4

1 に答える 1

0

Personally, I'd be inclined to not store it in the database at all, but rather spawn a background job to pull down the site, parse it and filter it with your readability port and then save it to the filesystem somewhere (public or non, public, depending on your needs, you can easily write an assets serving controller to expose non-public static content) using a directory scheme that identifies it uniquely.

That way you don't need to do any horrible, complicated stuff and can just let servers do what they are good at, rather than having to write something custom to pull potentially large amounts of data out of a database every time this page is viewed.

To something like that, all you need is a simple database entry with an id, an url, some kind of flag to indicate it's been downloaded successfully (or when it last failed so it can be tried again later), the path on the filesystem it should/will be stored at and perhaps a text column with a dump of the pages text in it for search purposes.

于 2010-07-10T06:45:28.753 に答える