- Timestamp:
- 09/09/08 02:14:21 (2 months ago)
- Location:
- lang/ruby/nicovideo-post-ext/lib
- Files:
-
- 2 modified
-
nicovideo-post-ext.rb (modified) (2 diffs)
-
nicovideo-wayback-ext.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/ruby/nicovideo-post-ext/lib/nicovideo-post-ext.rb
r15307 r19028 20 20 # getpostkey 21 21 content = @agent.get_file(BASE_URL + "/api/getpostkey?thread=#{@params['thread_id']}&block_no=0") 22 @params.merge!(content.scan(/([^& ]+)=([^&]*)/).inject({}){|h, v| h[v[0]] = v[1]; h})22 @params.merge!(content.scan(/([^&=]+)=([^&]*)/).inject({}){|h, v| h[v[0]] = v[1]; h}) 23 23 raise "no postkey (#{content})" unless @params.key?('postkey') 24 24 … … 28 28 29 29 vpos = case time 30 when /(\d+):(\d+ \.\d+|\d+)/30 when /(\d+):(\d+(?:\.\d+)?)/ 31 31 ($1.to_i * 6000) + ($2.to_f * 100).to_i 32 when / (\d+\.\d+|\d+)/33 ($ 1.to_f * 100).to_i32 when /\d+(?:\.\d+)?/ 33 ($&.to_f * 100).to_i 34 34 end 35 35 -
lang/ruby/nicovideo-post-ext/lib/nicovideo-wayback-ext.rb
r15307 r19028 13 13 @params = get_params unless @params 14 14 thread_id = @params['thread_id'] 15 body = %!<thread res_from="-#{num}" version="20061206" thread="#{thread_id}" />!15 body = %!<thread res_from="-#{num}" version="20061206" thread="#{thread_id}"/>! 16 16 17 17 if time … … 24 24 @params.merge!(content.scan(/([^&]+)=([^&]*)/).inject({}){|h, v| h[v[0]] = v[1]; h}) 25 25 raise ArgError, "no waybackkey: #{content}" unless @params.key?('waybackkey') 26 body.sub!( /( \/>)/, {26 body.sub!(%r{(?=/>)}, { 27 27 :user_id => @params['user_id'], 28 28 :when => time.to_i, 29 29 :waybackkey => @params['waybackkey'] 30 }.map{|k,v| %! #{k}="#{v}"!}.join + ' />')30 }.map{|k,v| %! #{k}="#{v}"!}.join) 31 31 end 32 32
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)