• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythonwindowsphpgamebathyscaphegui翻訳comegattwitterframeworkbtronvb.net計画中(planning stage)testdomarduinodirectxpreviewerゲームエンジン

Commit MetaInfo

Revision9f37b94ed5909604a6882ac1f441853dd7a6b3fa (tree)
Zeit2009-01-14 23:49:22
Autorikeji <ikeji@f836...>
Commiterikeji

Log Message

Add plugin Feed::mixi::get_diary_list.

git-svn-id: http://dev.ikejima.org/src/svn/pragger/trunk@395 f8368ae4-1e99-dc11-9799-0018f35ab5fa

Ändern Zusammenfassung

Diff

--- /dev/null
+++ b/plugin/Feed/mixi/get_diary_list.rb
@@ -0,0 +1,34 @@
1+require 'rubygems'
2+require 'mechanize'
3+
4+def get_diary_list(config,data)
5+ username = $reg['mixi']['username']
6+ password = $reg['mixi']['password']
7+
8+ client = WWW::Mechanize.new
9+ page = client.get('http://mixi.jp/')
10+ sleep 5
11+ form = page.forms[0]
12+ form.fields.find {|f| f.name == 'email'}.value = username
13+ form.fields.find {|f| f.name == 'password'}.value = password
14+ form.fields.find {|f| f.name == 'next_url'}.value = '/home.pl'
15+ page = client.submit(form, form.buttons.first)
16+ sleep 5
17+
18+ if /url=([^"])"/ =~ page.body
19+ link = 'http://mixi.jp' + $1.to_s
20+ client.get(link)
21+ sleep 5
22+ end
23+
24+ data = []
25+ diarylist = client.get("http://mixi.jp/list_diary.pl?id=" + config['id'].to_s)
26+ sleep 5
27+ diarylist.links.each do |link|
28+ diaryurl = link.href # => 'view_diary.pl?id=12345&owner_id=2345'
29+ if /view_diary.pl\?id\=/ =~ diaryurl then
30+ data << 'http://mixi.jp/' + diaryurl
31+ end
32+ end
33+ return data.uniq
34+end