niconico 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df82c4e26df5f6e3fd88b09775a014a65600fb3b
4
- data.tar.gz: dccb4490003953bcbc1bac19b533f775e506cdde
3
+ metadata.gz: 178df7276651dc0b9075d0cee6421c57ea0412a7
4
+ data.tar.gz: 3e6285ae48a8ff5c29c39bbcee1eb394be0be620
5
5
  SHA512:
6
- metadata.gz: c56db982b4c804be9d889360b752396bb321bd2e88c874e709dc5d9bb2853348b330de2421d4aca67888e1fa19688953be8353945ed1ce2b890984c0a7f422d8
7
- data.tar.gz: 5bea438a9fd9264d97328918663b1287bc5164d320ca2a0237bfc448a6c6915861cf875d4e4f6cbc81dd83d9eca5dbf970ff08f251cc8aa688f77d5542a06de4
6
+ metadata.gz: d29f2441bd54014a1c94b26fa97865f70f089e2e7ce42f48230721b7327102e8bbe6170838a3b17ef777718584a7c44b4df028f09df2caa1889ad131e78d7dce
7
+ data.tar.gz: 51e778a8b3086e7239cf4f5172df862f46b3866b40d03f66655645223af69466efea25cd813745958330808e0aaa82e7294cdfb49e64f40b1d1c10422f08d253
@@ -5,7 +5,7 @@ class Niconico
5
5
  keys.each do |key|
6
6
  binding.eval(<<-EOM, __FILE__, __LINE__.succ)
7
7
  define_method(:#{key}) do
8
- get() unless fetched?
8
+ get() if @#{key}.nil? && !fetched?
9
9
  @#{key}
10
10
  end
11
11
  EOM
@@ -7,7 +7,7 @@ class Niconico
7
7
 
8
8
  page = @agent.get(url = "http://www.nicovideo.jp/mylist/#{i.to_s.sub(/^mylist\//,"")}")
9
9
  #require 'ir_b'; ir b
10
- if page.search("script").map(&:inner_text).find{|x| /preload/ =~ x }.match(/Mylist\.preload\(\d+, (.+?)\);/)
10
+ if page.search("script").map(&:inner_text).find{|x| /\tMylist\.preload/ =~ x }.match(/\tMylist\.preload\(\d+, (.+?)\);\n/)
11
11
  json = JSON.parse($1)
12
12
  #require 'pp'; pp json
13
13
  json.sort_by{|item| item["create_time"].to_f }.map do |item|
@@ -1,3 +1,3 @@
1
1
  class Niconico
2
- VERSION = "1.4.0"
2
+ VERSION = "1.4.1"
3
3
  end
@@ -14,7 +14,7 @@ class Niconico
14
14
  deferrable :id, :title,
15
15
  :description, :description_raw,
16
16
  :url, :video_url, :type,
17
- :tags, :mylist_comment
17
+ :tags, :mylist_comment, :api_data
18
18
 
19
19
  def initialize(parent, video_id, defer=nil)
20
20
  @parent = parent
@@ -51,8 +51,9 @@ class Niconico
51
51
  end
52
52
  getflv = Hash[@agent.get_file("#{Niconico::URL[:getflv]}?v=#{@thread_id}#{additional_params}").scan(/([^&]+)=([^&]+)/).map{|(k,v)| [k.to_sym,CGI.unescape(v)] }]
53
53
 
54
- if api_data = @page.at("#watchAPIDataContainer")
55
- video_detail = JSON.parse(api_data.text())["videoDetail"]
54
+ if api_data_node = @page.at("#watchAPIDataContainer")
55
+ @api_data = JSON.parse(api_data_node.text())
56
+ video_detail = @api_data["videoDetail"]
56
57
  @title ||= video_detail["title"] if video_detail["title"]
57
58
  @description ||= video_detail["description"] if video_detail["description"]
58
59
  @tags ||= video_detail["tagList"].map{|e| e["tag"]}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: niconico
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shota Fukumori (sora_h)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-28 00:00:00.000000000 Z
11
+ date: 2014-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize
@@ -84,3 +84,4 @@ signing_key:
84
84
  specification_version: 4
85
85
  summary: wrapper of Mechanize, optimized for nicovideo.
86
86
  test_files: []
87
+ has_rdoc: