shopee 0.1.1 → 0.1.2
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/bin/shopee +1 -1
- data/lib/shopee.rb +4 -4
- data/lib/shopee/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3aff6cf07785ae43aa42c1f7d802ed94a74a1f53
|
4
|
+
data.tar.gz: c9ac1da5895b9ed8d9e823b4f9a77bb6630aa83e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 902449372a269b53f95fadb46d434ada76547d44bf67242e2feb2b62482126bc9e176894fef5aa4314ad5054fc60c9aecac0189b368d9b07076dc8019d7aa63a
|
7
|
+
data.tar.gz: da698c2812a2dccb9f88f1c39df063c1a1db922e00077a23108bf6c11b0d610f6930034aab6d5787da20c529e96d8b704fcd87d6807d894ced913b97f4c5e8b6
|
data/bin/shopee
CHANGED
@@ -38,7 +38,7 @@ Commander.configure do
|
|
38
38
|
c.action do |args, options|
|
39
39
|
shopeecate = ShopeeScrape::ShopeeListGoodsByCate.new(args[0])
|
40
40
|
goods = shopeecate.goods
|
41
|
-
puts shopeecate.search_keyword(goods, args[1])
|
41
|
+
puts shopeecate.search_keyword(goods, args[1], args[2])
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
data/lib/shopee.rb
CHANGED
@@ -20,8 +20,8 @@ module ShopeeScrape
|
|
20
20
|
@goods ||= extract_goods
|
21
21
|
end
|
22
22
|
|
23
|
-
def search_keyword(good, keyword)
|
24
|
-
@similar ||= find_similiar_goods(goods, keyword)
|
23
|
+
def search_keyword(good, keyword, list_num)
|
24
|
+
@similar ||= find_similiar_goods(goods, keyword, list_num)
|
25
25
|
end
|
26
26
|
|
27
27
|
private
|
@@ -70,7 +70,7 @@ module ShopeeScrape
|
|
70
70
|
results
|
71
71
|
end
|
72
72
|
|
73
|
-
def find_similiar_goods(goods, keyword)
|
73
|
+
def find_similiar_goods(goods, keyword, list_num)
|
74
74
|
jarow = FuzzyStringMatch::JaroWinkler.create( :native )
|
75
75
|
rank = {}
|
76
76
|
goods.each do |good|
|
@@ -82,7 +82,7 @@ module ShopeeScrape
|
|
82
82
|
rank_after_sort = Hash[rank.sort_by{|k, v| v}.reverse]
|
83
83
|
key = rank_after_sort.keys()
|
84
84
|
results = []
|
85
|
-
for i in 0..
|
85
|
+
for i in 0..list_num.to_i - 1
|
86
86
|
good_name = key[i]
|
87
87
|
goods.each do |good|
|
88
88
|
if good['name'] == good_name
|
data/lib/shopee/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sheng Jung Wu
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2015-
|
14
|
+
date: 2015-12-06 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: minitest
|