Changeset 3411

Show
Ignore:
Timestamp:
12/21/07 17:50:25 (5 years ago)
Author:
saronpasu
Message:

lang/ruby/misc/tumblr_autofollow.rb: ajax対応

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/ruby/misc/tumblr_autofollow.rb

    r3329 r3411  
    7474    end 
    7575  end 
     76  ajax_links = Array.new 
     77  (page/"a").each do |link| 
     78    if link.inner_text =~ /other people/ 
     79      ajax_links.push("http://www.tumblr.com"+$1) if link.to_html =~ /'(\/dashboard\/notes\/.+\/.+)'/ 
     80    end 
     81  end 
     82  unless ajax_links.first.nil? 
     83    id=nil 
     84    ajax_links.each do |link| 
     85      page = agent.post(link) 
     86      page.links.each do |id| 
     87        if id.href =~ /^http:\/\/[0-9a-zA-Z_-]+\.tumblr\.com\/$/ 
     88          rebloggers.push id.text unless id.text.empty? 
     89        end 
     90      end 
     91    end 
     92  end 
     93  rebloggers.uniq! 
    7694  auto_following_list.concat rebloggers - followings 
    7795end 
     
    97115 
    98116#=== closing phase ===# 
    99 # url = "http://www.tumblr.com/logout" 
    100 # p "logout www.tumblr.com" 
    101 # agent.get(url, REFERER_PAGE) 
    102 #=== end closing phase ===# 
     117#url = "http://www.tumblr.com/logout" 
     118#p "logout www.tumblr.com" 
     119#agent.get(url, REFERER_PAGE) 
     120#=== closing phase ===# 
    103121 
    104122