hack3rnews 0.0.0 → 0.0.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 +4 -4
- data/lib/hack3rnews.rb +10 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82e9fe3f6cc5f6fa373cae0c63a4058114bb417de0d91a0c55fad23fb1de445a
|
4
|
+
data.tar.gz: 4e696613d05b3b9682e131d4a0b1f494549ba2a0a7c89be06301b6c3ff063ec6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f528de6bcafaaff9da60e90d2ce4392af3446ca819942d24f7b62d5a8cd1fc8f832b44f65f7f42bbb17c7fc921bff2ae880535fd92262957e187a476eb5217c9
|
7
|
+
data.tar.gz: 8458a45c5e0dbf386da32bc42aa8ced08b8397a106467002cef97e6354230de05cccbcdfc9fc9031a0e2c4c912655c30c49820d0ab632ff054850ce9dc1f95e5
|
data/lib/hack3rnews.rb
CHANGED
@@ -33,13 +33,9 @@ class HackerNew
|
|
33
33
|
|
34
34
|
private
|
35
35
|
def capture_item_kids(type, opt = {})
|
36
|
-
kids = []
|
37
36
|
item = request_item(type, opt[:item_id])
|
38
37
|
kid_ids = capture_ids(item, opt)
|
39
|
-
|
40
|
-
kids << request_item('item', kid_id)
|
41
|
-
end
|
42
|
-
kids
|
38
|
+
capture_items(kid_ids)
|
43
39
|
end
|
44
40
|
|
45
41
|
def capture_ids(item, opt)
|
@@ -49,12 +45,16 @@ class HackerNew
|
|
49
45
|
end
|
50
46
|
|
51
47
|
def capture_stories(type, num)
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
48
|
+
story_ids = request_bunch(type, num)
|
49
|
+
capture_items(story_ids)
|
50
|
+
end
|
51
|
+
|
52
|
+
def capture_items(item_ids)
|
53
|
+
items = []
|
54
|
+
while item_id = item_ids.shift
|
55
|
+
items << request_item('item', item_id)
|
56
56
|
end
|
57
|
-
|
57
|
+
items
|
58
58
|
end
|
59
59
|
|
60
60
|
def request(url)
|