shopee 0.0.3 → 0.0.4

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: faa99a20e2035ee242760cb2681bcbfcc5591825
4
- data.tar.gz: 36203bc1871eaa52c1efa0ec04b7e2759318eebf
3
+ metadata.gz: fee05fa45486149f88eecf70a95026e06ee8f20b
4
+ data.tar.gz: f9eacfd40a7e014908f719d6ebe1834b97b9ee60
5
5
  SHA512:
6
- metadata.gz: af6cd7ff10975f479b6c2d4612abbb7ae8e529617ad63eaa3c3402d3c211ab3c06374394086e0a9c45656f7aade9524a31772fe21f5dd2af1509d0d3171cc693
7
- data.tar.gz: 260a76965c1192de67e4fb19b242c5d8ec6796369078a0d03a353796d993a8622a402aac705df06251220abe086421650526ce84c3f927b6077c010c8ecb1c3e
6
+ metadata.gz: e0d30dca68612c2e27c16e57c3b0c7c38b1fb44b55a17dd190dcb930d457718ee4d1b1f3067bdfb3cc2f1358027ab5f4c8baa009befd237df59cf6909b9022ec
7
+ data.tar.gz: adb0ae673f2f074d82d21f9581423ad5a14e99d82a50ed72f6de30c24293eed7d06a2aed5e12912c3e28034a6bd63dfc72416886285bfb3f84159780299e67f1
data/README.md CHANGED
@@ -1,13 +1,13 @@
1
- # Ideate-and-Scrape
1
+ Shopee
2
+ ==
3
+ Scrape informations from
4
+ - [Mobie01](http://www.mobile01.com) - [Exacted data](https://github.com/lockys/Mobile01-Ruten-Scraper/blob/master/output/mobile01-category)
5
+ - [Shopee](http://shopee.tw/mobile/) (depreciated)
2
6
 
3
- [![Build Status](https://travis-ci.org/Smartibuy/ideate-and-scrape.svg?branch=master)](https://travis-ci.org/Smartibuy/ideate-and-scrape)
7
+ [![Build Status](https://travis-ci.org/Smartibuy/shopee.svg?branch=master)](https://travis-ci.org/Smartibuy/shopee)
4
8
  [![Gem Version](https://badge.fury.io/rb/shopee.svg)](https://badge.fury.io/rb/shopee)
5
9
 
6
- ## Description
7
-
8
- Parse Category from [Shopee](http://shopee.tw/mobile/)
9
-
10
- ### Installation
10
+ ### Get started
11
11
  - Install packages
12
12
  ```
13
13
  $ gem install shopee
data/bin/shopee ADDED
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'json'
4
+ require 'rubygems'
5
+ require 'commander'
6
+ require_relative '../lib/shopee'
7
+
8
+
9
+ Commander.configure do
10
+ program :name, 'shopee'
11
+ program :version, '0.0.4'
12
+ program :description, 'Scrape informations from Mobile01'
13
+
14
+ command :show do |c|
15
+ c.syntax = 'shopee show all-cate'
16
+ c.description = 'List all categories'
17
+
18
+ c.action do |args, options|
19
+ shopeecate = ShopeeScrape::ShopeeListAll.new
20
+ puts shopeecate.get_categories
21
+ end
22
+ end
23
+
24
+ end
@@ -0,0 +1,143 @@
1
+ {
2
+ "電腦資訊": "http://www.mobile01.com/mpcatlist.php?c=1",
3
+ "桌上型電腦": "http://www.mobile01.com/mpcatlist.php?c=9",
4
+ "核心組件": "http://www.mobile01.com/mpcatlist.php?c=11",
5
+ "儲存裝置": "http://www.mobile01.com/mpcatlist.php?c=58",
6
+ "顯示設備": "http://www.mobile01.com/mpcatlist.php?c=59",
7
+ "網路設備": "http://www.mobile01.com/mpcatlist.php?c=60",
8
+ "電腦周邊設備": "http://www.mobile01.com/mpcatlist.php?c=13",
9
+ "機殼、散熱與電源": "http://www.mobile01.com/mpcatlist.php?c=62",
10
+ "電腦軟體與書籍": "http://www.mobile01.com/mpcatlist.php?c=12",
11
+ "耗材、線材與雜項": "http://www.mobile01.com/mpcatlist.php?c=61",
12
+ "筆記型電腦": "http://www.mobile01.com/mpcatlist.php?c=10",
13
+ "筆記型電腦周邊": "http://www.mobile01.com/mpcatlist.php?c=56",
14
+ "平板電腦": "http://www.mobile01.com/mpcatlist.php?c=55",
15
+ "蘋果電腦": "http://www.mobile01.com/mpcatlist.php?c=54",
16
+ "蘋果電腦周邊": "http://www.mobile01.com/mpcatlist.php?c=57",
17
+ "其它": "http://www.mobile01.com/mpcatlist.php?c=116",
18
+ "手持通訊": "http://www.mobile01.com/mpcatlist.php?c=2",
19
+ "手機": "http://www.mobile01.com/mpcatlist.php?c=14",
20
+ "Android": "http://www.mobile01.com/mpcatlist.php?c=20000001",
21
+ "iPhone": "http://www.mobile01.com/mpcatlist.php?c=20000002",
22
+ "Windows Phone": "http://www.mobile01.com/mpcatlist.php?c=20000003",
23
+ "其他類型": "http://www.mobile01.com/mpcatlist.php?c=20000005",
24
+ "手機配件與吊飾": "http://www.mobile01.com/mpcatlist.php?c=63",
25
+ "家用電話": "http://www.mobile01.com/mpcatlist.php?c=64",
26
+ "傳真、影印與事務機": "http://www.mobile01.com/mpcatlist.php?c=65",
27
+ "通訊週邊與耗材": "http://www.mobile01.com/mpcatlist.php?c=17",
28
+ "GPS": "http://www.mobile01.com/mpcatlist.php?c=16",
29
+ "攝影器材": "http://www.mobile01.com/mpcatlist.php?c=3",
30
+ "攝影機": "http://www.mobile01.com/mpcatlist.php?c=20",
31
+ "傳統底片相機": "http://www.mobile01.com/mpcatlist.php?c=70",
32
+ "消費級數位相機": "http://www.mobile01.com/mpcatlist.php?c=19",
33
+ "數位單眼相機": "http://www.mobile01.com/mpcatlist.php?c=18",
34
+ "相機其他周邊": "http://www.mobile01.com/mpcatlist.php?c=22",
35
+ "相機鏡頭": "http://www.mobile01.com/mpcatlist.php?c=67",
36
+ "攝影背包": "http://www.mobile01.com/mpcatlist.php?c=51",
37
+ "數位相機電池": "http://www.mobile01.com/mpcatlist.php?c=68",
38
+ "數位相機充電器": "http://www.mobile01.com/mpcatlist.php?c=69",
39
+ "記憶卡與行動相簿": "http://www.mobile01.com/mpcatlist.php?c=71",
40
+ "相片印表機與數位相框": "http://www.mobile01.com/mpcatlist.php?c=21",
41
+ "數位家電": "http://www.mobile01.com/mpcatlist.php?c=4",
42
+ "電視機": "http://www.mobile01.com/mpcatlist.php?c=23",
43
+ "音響與隨身聽": "http://www.mobile01.com/mpcatlist.php?c=75",
44
+ "影音設備周邊": "http://www.mobile01.com/mpcatlist.php?c=24",
45
+ "投影機與布幕": "http://www.mobile01.com/mpcatlist.php?c=72",
46
+ "生活小家電": "http://www.mobile01.com/mpcatlist.php?c=25",
47
+ "廚房小家電": "http://www.mobile01.com/mpcatlist.php?c=76",
48
+ "淨水設備": "http://www.mobile01.com/mpcatlist.php?c=74",
49
+ "健康與美容小家電": "http://www.mobile01.com/mpcatlist.php?c=77",
50
+ "冰箱": "http://www.mobile01.com/mpcatlist.php?c=78",
51
+ "洗衣與乾衣機": "http://www.mobile01.com/mpcatlist.php?c=79",
52
+ "冷氣空調": "http://www.mobile01.com/mpcatlist.php?c=80",
53
+ "休閒娛樂": "http://www.mobile01.com/mpcatlist.php?c=5",
54
+ "電玩主機": "http://www.mobile01.com/mpcatlist.php?c=27",
55
+ "電玩遊戲": "http://www.mobile01.com/mpcatlist.php?c=73",
56
+ "動漫電玩週邊": "http://www.mobile01.com/mpcatlist.php?c=85",
57
+ "電腦與線上遊戲": "http://www.mobile01.com/mpcatlist.php?c=26",
58
+ "懷舊童玩": "http://www.mobile01.com/mpcatlist.php?c=83",
59
+ "遙控模型": "http://www.mobile01.com/mpcatlist.php?c=81",
60
+ "金屬與鐵道模型": "http://www.mobile01.com/mpcatlist.php?c=82",
61
+ "益智遊戲": "http://www.mobile01.com/mpcatlist.php?c=84",
62
+ "玩具與模型": "http://www.mobile01.com/mpcatlist.php?c=29",
63
+ "書籍雜誌": "http://www.mobile01.com/mpcatlist.php?c=30",
64
+ "電視電影": "http://www.mobile01.com/mpcatlist.php?c=31",
65
+ "音樂歌曲": "http://www.mobile01.com/mpcatlist.php?c=32",
66
+ "生活用品": "http://www.mobile01.com/mpcatlist.php?c=7",
67
+ "名產美食": "http://www.mobile01.com/mpcatlist.php?c=47",
68
+ "運動健身綜合": "http://www.mobile01.com/mpcatlist.php?c=34",
69
+ "休閒旅遊": "http://www.mobile01.com/mpcatlist.php?c=35",
70
+ "鐘錶名品": "http://www.mobile01.com/mpcatlist.php?c=872",
71
+ "生活居家": "http://www.mobile01.com/mpcatlist.php?c=38",
72
+ "寵物用品": "http://www.mobile01.com/mpcatlist.php?c=86",
73
+ "汽車": "http://www.mobile01.com/mpcatlist.php?c=1300",
74
+ "轎車、跑車": "http://www.mobile01.com/mpcatlist.php?c=1309",
75
+ "休旅車": "http://www.mobile01.com/mpcatlist.php?c=1310",
76
+ "貨車、其他車種": "http://www.mobile01.com/mpcatlist.php?c=1311",
77
+ "汽車用品": "http://www.mobile01.com/mpcatlist.php?c=130000001",
78
+ "汽車精品": "http://www.mobile01.com/mpcatlist.php?c=1312",
79
+ "美容清潔": "http://www.mobile01.com/mpcatlist.php?c=1313",
80
+ "油品": "http://www.mobile01.com/mpcatlist.php?c=1314",
81
+ "其他汽車用品": "http://www.mobile01.com/mpcatlist.php?c=1315",
82
+ "影音設備": "http://www.mobile01.com/mpcatlist.php?c=1316",
83
+ "汽車零件": "http://www.mobile01.com/mpcatlist.php?c=130000002",
84
+ "車燈": "http://www.mobile01.com/mpcatlist.php?c=1317",
85
+ "輪胎、鋁圈": "http://www.mobile01.com/mpcatlist.php?c=1318",
86
+ "底盤系統": "http://www.mobile01.com/mpcatlist.php?c=1319",
87
+ "電機、冷卻系統": "http://www.mobile01.com/mpcatlist.php?c=1320",
88
+ "煞車系統": "http://www.mobile01.com/mpcatlist.php?c=1321",
89
+ "空力套件": "http://www.mobile01.com/mpcatlist.php?c=1322",
90
+ "引擎、傳動與其它": "http://www.mobile01.com/mpcatlist.php?c=1323",
91
+ "機車": "http://www.mobile01.com/mpcatlist.php?c=40",
92
+ "機車騎士用品": "http://www.mobile01.com/mpcatlist.php?c=1324",
93
+ "機車用品": "http://www.mobile01.com/mpcatlist.php?c=52",
94
+ "機車零組件": "http://www.mobile01.com/mpcatlist.php?c=53",
95
+ "自行車": "http://www.mobile01.com/mpcatlist.php?c=117",
96
+ "公路車": "http://www.mobile01.com/mpcatlist.php?c=93",
97
+ "登山車": "http://www.mobile01.com/mpcatlist.php?c=92",
98
+ "小徑與摺疊車": "http://www.mobile01.com/mpcatlist.php?c=94",
99
+ "休閒與通勤車": "http://www.mobile01.com/mpcatlist.php?c=41",
100
+ "人身部品": "http://www.mobile01.com/mpcatlist.php?c=11700001",
101
+ "安全帽": "http://www.mobile01.com/mpcatlist.php?c=126",
102
+ "車衣、車褲": "http://www.mobile01.com/mpcatlist.php?c=127",
103
+ "其它人身部品": "http://www.mobile01.com/mpcatlist.php?c=128",
104
+ "自行車用品": "http://www.mobile01.com/mpcatlist.php?c=11700002",
105
+ "車燈、碼表": "http://www.mobile01.com/mpcatlist.php?c=129",
106
+ "收納袋、車袋": "http://www.mobile01.com/mpcatlist.php?c=130",
107
+ "清潔保養用品": "http://www.mobile01.com/mpcatlist.php?c=131",
108
+ "其它周邊配件": "http://www.mobile01.com/mpcatlist.php?c=132",
109
+ "自行車零件": "http://www.mobile01.com/mpcatlist.php?c=11700003",
110
+ "車架、前叉、避震器": "http://www.mobile01.com/mpcatlist.php?c=133",
111
+ "龍頭、車把": "http://www.mobile01.com/mpcatlist.php?c=134",
112
+ "煞車、變速系統零件": "http://www.mobile01.com/mpcatlist.php?c=135",
113
+ "輪組、內外胎": "http://www.mobile01.com/mpcatlist.php?c=136",
114
+ "座墊、座管": "http://www.mobile01.com/mpcatlist.php?c=137",
115
+ "其它車用零件": "http://www.mobile01.com/mpcatlist.php?c=138",
116
+ "男性時尚": "http://www.mobile01.com/mpcatlist.php?c=865",
117
+ "服飾與襯衫": "http://www.mobile01.com/mpcatlist.php?c=866",
118
+ "外套與夾克": "http://www.mobile01.com/mpcatlist.php?c=867",
119
+ "男用長短褲": "http://www.mobile01.com/mpcatlist.php?c=868",
120
+ "男用鞋與靴": "http://www.mobile01.com/mpcatlist.php?c=869",
121
+ "男性內衣褲襪": "http://www.mobile01.com/mpcatlist.php?c=870",
122
+ "男性飾品與配件": "http://www.mobile01.com/mpcatlist.php?c=871",
123
+ "女性流行": "http://www.mobile01.com/mpcatlist.php?c=6",
124
+ "彩妝與保養": "http://www.mobile01.com/mpcatlist.php?c=36",
125
+ "嬰幼童與母親": "http://www.mobile01.com/mpcatlist.php?c=37",
126
+ "流行女裝": "http://www.mobile01.com/mpcatlist.php?c=43",
127
+ "女性飾品與配件": "http://www.mobile01.com/mpcatlist.php?c=44",
128
+ "女鞋": "http://www.mobile01.com/mpcatlist.php?c=45",
129
+ "女性內衣": "http://www.mobile01.com/mpcatlist.php?c=46",
130
+ "代購與虛擬物品": "http://www.mobile01.com/mpcatlist.php?c=239",
131
+ "3C物品代購": "http://www.mobile01.com/mpcatlist.php?c=240",
132
+ "動漫電玩代購": "http://www.mobile01.com/mpcatlist.php?c=241",
133
+ "服飾配件代購": "http://www.mobile01.com/mpcatlist.php?c=242",
134
+ "其他物品代購": "http://www.mobile01.com/mpcatlist.php?c=243",
135
+ "手機門號/加值/預付卡": "http://www.mobile01.com/mpcatlist.php?c=244",
136
+ "遊戲點卡/虛寶": "http://www.mobile01.com/mpcatlist.php?c=245",
137
+ "票卷": "http://www.mobile01.com/mpcatlist.php?c=246",
138
+ "房屋地產": "http://www.mobile01.com/mpcatlist.php?c=87",
139
+ "北部地區": "http://www.mobile01.com/mpcatlist.php?c=88",
140
+ "中部地區": "http://www.mobile01.com/mpcatlist.php?c=89",
141
+ "南部地區": "http://www.mobile01.com/mpcatlist.php?c=90",
142
+ "東部與外島地區": "http://www.mobile01.com/mpcatlist.php?c=91"
143
+ }
@@ -0,0 +1,142 @@
1
+ ALL_LINK = { "電腦資訊"=>"http://www.mobile01.com/mpcatlist.php?c=1",
2
+ "桌上型電腦"=>"http://www.mobile01.com/mpcatlist.php?c=9",
3
+ "核心組件"=>"http://www.mobile01.com/mpcatlist.php?c=11",
4
+ "儲存裝置"=>"http://www.mobile01.com/mpcatlist.php?c=58",
5
+ "顯示設備"=>"http://www.mobile01.com/mpcatlist.php?c=59",
6
+ "網路設備"=>"http://www.mobile01.com/mpcatlist.php?c=60",
7
+ "電腦周邊設備"=>"http://www.mobile01.com/mpcatlist.php?c=13",
8
+ "機殼、散熱與電源"=>"http://www.mobile01.com/mpcatlist.php?c=62",
9
+ "電腦軟體與書籍"=>"http://www.mobile01.com/mpcatlist.php?c=12",
10
+ "耗材、線材與雜項"=>"http://www.mobile01.com/mpcatlist.php?c=61",
11
+ "筆記型電腦"=>"http://www.mobile01.com/mpcatlist.php?cir=10",
12
+ "筆記型電腦周邊"=>"http://www.mobile01.com/mpcatlist.php?c=56",
13
+ "平板電腦"=>"http://www.mobile01.com/mpcatlist.php?c=55",
14
+ "蘋果電腦"=>"http://www.mobile01.com/mpcatlist.php?c=54",
15
+ "蘋果電腦周邊"=>"http://www.mobile01.com/mpcatlist.php?c=57",
16
+ "其它"=>"http://www.mobile01.com/mpcatlist.php?c=116",
17
+ "手持通訊"=>"http://www.mobile01.com/mpcatlist.php?c=2",
18
+ "手機"=>"http://www.mobile01.com/mpcatlist.php?c=14",
19
+ "Android"=>"http://www.mobile01.com/mpcatlist.php?c=20000001",
20
+ "iPhone"=>"http://www.mobile01.com/mpcatlist.php?c=20000002",
21
+ "Windows Phone"=>"http://www.mobile01.com/mpcatlist.php?c=20000003",
22
+ "其他類型"=>"http://www.mobile01.com/mpcatlist.php?c=20000005",
23
+ "手機配件與吊飾"=>"http://www.mobile01.com/mpcatlist.php?c=63",
24
+ "家用電話"=>"http://www.mobile01.com/mpcatlist.php?c=64",
25
+ "傳真、影印與事務機"=>"http://www.mobile01.com/mpcatlist.php?c=65",
26
+ "通訊週邊與耗材"=>"http://www.mobile01.com/mpcatlist.php?c=17",
27
+ "GPS"=>"http://www.mobile01.com/mpcatlist.php?c=16",
28
+ "攝影器材"=>"http://www.mobile01.com/mpcatlist.php?c=3",
29
+ "攝影機"=>"http://www.mobile01.com/mpcatlist.php?c=20",
30
+ "傳統底片相機"=>"http://www.mobile01.com/mpcatlist.php?c=70",
31
+ "消費級數位相機"=>"http://www.mobile01.com/mpcatlist.php?c=19",
32
+ "數位單眼相機"=>"http://www.mobile01.com/mpcatlist.php?c=18",
33
+ "相機其他周邊"=>"http://www.mobile01.com/mpcatlist.php?c=22",
34
+ "相機鏡頭"=>"http://www.mobile01.com/mpcatlist.php?c=67",
35
+ "攝影背包"=>"http://www.mobile01.com/mpcatlist.php?c=51",
36
+ "數位相機電池"=>"http://www.mobile01.com/mpcatlist.php?c=68",
37
+ "數位相機充電器"=>"http://www.mobile01.com/mpcatlist.php?c=69",
38
+ "記憶卡與行動相簿"=>"http://www.mobile01.com/mpcatlist.php?c=71",
39
+ "相片印表機與數位相框"=>"http://www.mobile01.com/mpcatlist.php?c=21",
40
+ "數位家電"=>"http://www.mobile01.com/mpcatlist.php?c=4",
41
+ "電視機"=>"http://www.mobile01.com/mpcatlist.php?c=23",
42
+ "音響與隨身聽"=>"http://www.mobile01.com/mpcatlist.php?c=75",
43
+ "影音設備周邊"=>"http://www.mobile01.com/mpcatlist.php?c=24",
44
+ "投影機與布幕"=>"http://www.mobile01.com/mpcatlist.php?c=72",
45
+ "生活小家電"=>"http://www.mobile01.com/mpcatlist.php?c=25",
46
+ "廚房小家電"=>"http://www.mobile01.com/mpcatlist.php?c=76",
47
+ "淨水設備"=>"http://www.mobile01.com/mpcatlist.php?c=74",
48
+ "健康與美容小家電"=>"http://www.mobile01.com/mpcatlist.php?c=77",
49
+ "冰箱"=>"http://www.mobile01.com/mpcatlist.php?c=78",
50
+ "洗衣與乾衣機"=>"http://www.mobile01.com/mpcatlist.php?c=79",
51
+ "冷氣空調"=>"http://www.mobile01.com/mpcatlist.php?c=80",
52
+ "休閒娛樂"=>"http://www.mobile01.com/mpcatlist.php?c=5",
53
+ "電玩主機"=>"http://www.mobile01.com/mpcatlist.php?c=27",
54
+ "電玩遊戲"=>"http://www.mobile01.com/mpcatlist.php?c=73",
55
+ "動漫電玩週邊"=>"http://www.mobile01.com/mpcatlist.php?c=85",
56
+ "電腦與線上遊戲"=>"http://www.mobile01.com/mpcatlist.php?c=26",
57
+ "懷舊童玩"=>"http://www.mobile01.com/mpcatlist.php?c=83",
58
+ "遙控模型"=>"http://www.mobile01.com/mpcatlist.php?c=81",
59
+ "金屬與鐵道模型"=>"http://www.mobile01.com/mpcatlist.php?c=82",
60
+ "益智遊戲"=>"http://www.mobile01.com/mpcatlist.php?c=84",
61
+ "玩具與模型"=>"http://www.mobile01.com/mpcatlist.php?c=29",
62
+ "書籍雜誌"=>"http://www.mobile01.com/mpcatlist.php?c=30",
63
+ "電視電影"=>"http://www.mobile01.com/mpcatlist.php?c=31",
64
+ "音樂歌曲"=>"http://www.mobile01.com/mpcatlist.php?c=32",
65
+ "生活用品"=>"http://www.mobile01.com/mpcatlist.php?c=7",
66
+ "名產美食"=>"http://www.mobile01.com/mpcatlist.php?c=47",
67
+ "運動健身綜合"=>"http://www.mobile01.com/mpcatlist.php?c=34",
68
+ "休閒旅遊"=>"http://www.mobile01.com/mpcatlist.php?c=35",
69
+ "鐘錶名品"=>"http://www.mobile01.com/mpcatlist.php?c=872",
70
+ "生活居家"=>"http://www.mobile01.com/mpcatlist.php?c=38",
71
+ "寵物用品"=>"http://www.mobile01.com/mpcatlist.php?c=86",
72
+ "汽車"=>"http://www.mobile01.com/mpcatlist.php?c=1300",
73
+ "轎車、跑車"=>"http://www.mobile01.com/mpcatlist.php?c=1309",
74
+ "休旅車"=>"http://www.mobile01.com/mpcatlist.php?c=1310",
75
+ "貨車、其他車種"=>"http://www.mobile01.com/mpcatlist.php?c=1311",
76
+ "汽車用品"=>"http://www.mobile01.com/mpcatlist.php?c=130000001",
77
+ "汽車精品"=>"http://www.mobile01.com/mpcatlist.php?c=1312",
78
+ "美容清潔"=>"http://www.mobile01.com/mpcatlist.php?c=1313",
79
+ "油品"=>"http://www.mobile01.com/mpcatlist.php?c=1314",
80
+ "其他汽車用品"=>"http://www.mobile01.com/mpcatlist.php?c=1315",
81
+ "影音設備"=>"http://www.mobile01.com/mpcatlist.php?c=1316",
82
+ "汽車零件"=>"http://www.mobile01.com/mpcatlist.php?c=130000002",
83
+ "車燈"=>"http://www.mobile01.com/mpcatlist.php?c=1317",
84
+ "輪胎、鋁圈"=>"http://www.mobile01.com/mpcatlist.php?c=1318",
85
+ "底盤系統"=>"http://www.mobile01.com/mpcatlist.php?c=1319",
86
+ "電機、冷卻系統"=>"http://www.mobile01.com/mpcatlist.php?c=1320",
87
+ "煞車系統"=>"http://www.mobile01.com/mpcatlist.php?c=1321",
88
+ "空力套件"=>"http://www.mobile01.com/mpcatlist.php?c=1322",
89
+ "引擎、傳動與其它"=>"http://www.mobile01.com/mpcatlist.php?c=1323",
90
+ "機車"=>"http://www.mobile01.com/mpcatlist.php?c=40",
91
+ "機車騎士用品"=>"http://www.mobile01.com/mpcatlist.php?c=1324",
92
+ "機車用品"=>"http://www.mobile01.com/mpcatlist.php?c=52",
93
+ "機車零組件"=>"http://www.mobile01.com/mpcatlist.php?c=53",
94
+ "自行車"=>"http://www.mobile01.com/mpcatlist.php?c=117",
95
+ "公路車"=>"http://www.mobile01.com/mpcatlist.php?c=93",
96
+ "登山車"=>"http://www.mobile01.com/mpcatlist.php?c=92",
97
+ "小徑與摺疊車"=>"http://www.mobile01.com/mpcatlist.php?c=94",
98
+ "休閒與通勤車"=>"http://www.mobile01.com/mpcatlist.php?c=41",
99
+ "人身部品"=>"http://www.mobile01.com/mpcatlist.php?c=11700001",
100
+ "安全帽"=>"http://www.mobile01.com/mpcatlist.php?c=126",
101
+ "車衣、車褲"=>"http://www.mobile01.com/mpcatlist.php?c=127",
102
+ "其它人身部品"=>"http://www.mobile01.com/mpcatlist.php?c=128",
103
+ "自行車用品"=>"http://www.mobile01.com/mpcatlist.php?c=11700002",
104
+ "車燈、碼表"=>"http://www.mobile01.com/mpcatlist.php?c=129",
105
+ "收納袋、車袋"=>"http://www.mobile01.com/mpcatlist.php?c=130",
106
+ "清潔保養用品"=>"http://www.mobile01.com/mpcatlist.php?c=131",
107
+ "其它周邊配件"=>"http://www.mobile01.com/mpcatlist.php?c=132",
108
+ "自行車零件"=>"http://www.mobile01.com/mpcatlist.php?c=11700003",
109
+ "車架、前叉、避震器"=>"http://www.mobile01.com/mpcatlist.php?c=133",
110
+ "龍頭、車把"=>"http://www.mobile01.com/mpcatlist.php?c=134",
111
+ "煞車、變速系統零件"=>"http://www.mobile01.com/mpcatlist.php?c=135",
112
+ "輪組、內外胎"=>"http://www.mobile01.com/mpcatlist.php?c=136",
113
+ "座墊、座管"=>"http://www.mobile01.com/mpcatlist.php?c=137",
114
+ "其它車用零件"=>"http://www.mobile01.com/mpcatlist.php?c=138",
115
+ "男性時尚"=>"http://www.mobile01.com/mpcatlist.php?c=865",
116
+ "服飾與襯衫"=>"http://www.mobile01.com/mpcatlist.php?c=866",
117
+ "外套與夾克"=>"http://www.mobile01.com/mpcatlist.php?c=867",
118
+ "男用長短褲"=>"http://www.mobile01.com/mpcatlist.php?c=868",
119
+ "男用鞋與靴"=>"http://www.mobile01.com/mpcatlist.php?c=869",
120
+ "男性內衣褲襪"=>"http://www.mobile01.com/mpcatlist.php?c=870",
121
+ "男性飾品與配件"=>"http://www.mobile01.com/mpcatlist.php?c=871",
122
+ "女性流行"=>"http://www.mobile01.com/mpcatlist.php?c=6",
123
+ "彩妝與保養"=>"http://www.mobile01.com/mpcatlist.php?c=36",
124
+ "嬰幼童與母親"=>"http://www.mobile01.com/mpcatlist.php?c=37",
125
+ "流行女裝"=>"http://www.mobile01.com/mpcatlist.php?c=43",
126
+ "女性飾品與配件"=>"http://www.mobile01.com/mpcatlist.php?c=44",
127
+ "女鞋"=>"http://www.mobile01.com/mpcatlist.php?c=45",
128
+ "女性內衣"=>"http://www.mobile01.com/mpcatlist.php?c=46",
129
+ "代購與虛擬物品"=>"http://www.mobile01.com/mpcatlist.php?c=239",
130
+ "3C物品代購"=>"http://www.mobile01.com/mpcatlist.php?c=240",
131
+ "動漫電玩代購"=>"http://www.mobile01.com/mpcatlist.php?c=241",
132
+ "服飾配件代購"=>"http://www.mobile01.com/mpcatlist.php?c=242",
133
+ "其他物品代購"=>"http://www.mobile01.com/mpcatlist.php?c=243",
134
+ "手機門號/加值/預付卡"=>"http://www.mobile01.com/mpcatlist.php?c=244",
135
+ "遊戲點卡/虛寶"=>"http://www.mobile01.com/mpcatlist.php?c=245",
136
+ "票卷"=>"http://www.mobile01.com/mpcatlist.php?c=246",
137
+ "房屋地產"=>"http://www.mobile01.com/mpcatlist.php?c=87",
138
+ "北部地區"=>"http://www.mobile01.com/mpcatlist.php?c=88",
139
+ "中部地區"=>"http://www.mobile01.com/mpcatlist.php?c=89",
140
+ "南部地區"=>"http://www.mobile01.com/mpcatlist.php?c=90",
141
+ "東部與外島地區"=>"http://www.mobile01.com/mpcatlist.php?c=91"
142
+ }
@@ -2,16 +2,11 @@ require 'oga'
2
2
  require 'open-uri'
3
3
  require 'json'
4
4
 
5
-
6
- module ShopeeTileScrape
7
- class ShopeeTile
8
-
9
- URL = 'http://mall.shopee.tw/?utm_source=OrganicA&utm_medium=OrganicA&utm_campaign=lp_home_mall'
10
- XPATH_CARD = "//div[(@class='title')]"
11
- CARD_TITLE_XPATH = "//div[(@class='list-wrapper')]"
12
-
13
- def initialize
14
- parse_html
5
+ module ShopeeScrape
6
+ class ShopeeListGoods
7
+ def initialize(category, page)
8
+ @category = category
9
+ @page = page
15
10
  end
16
11
 
17
12
  def titles
@@ -42,4 +37,26 @@ module ShopeeTileScrape
42
37
  result.to_json
43
38
  end
44
39
  end
40
+
41
+ # =============================
42
+ # List all category of mobile01
43
+ # =============================
44
+ class ShopeeListAll
45
+ require_relative './data/mobile_category'
46
+
47
+ def initialize
48
+ @cate_name = ALL_LINK
49
+ end
50
+
51
+ def get_categories
52
+ @titles ||= extract_json
53
+ end
54
+
55
+ private
56
+
57
+ def extract_json
58
+ list = @cate_name.keys()
59
+ end
60
+ end
61
+
45
62
  end
@@ -1,4 +1,4 @@
1
- module ShopeeTileScrape
2
- VERSION = '0.0.3'
3
- DATE = '2015-10-17'
1
+ module ShopeeScrape
2
+ VERSION = '0.0.4'
3
+ DATE = '2015-11-09'
4
4
  end
data/shopee.gemspec CHANGED
@@ -2,15 +2,15 @@ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
2
2
  require 'shopee/version'
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'shopee'
5
- s.version = ShopeeTileScrape::VERSION
6
- s.date = ShopeeTileScrape::DATE
7
- s.executables << 'shopee_titles'
8
- s.summary = 'Scrape categories of shopee!'
9
- s.description = 'Scrape categories of shopee!'
5
+ s.version = ShopeeScrape::VERSION
6
+ s.date = ShopeeScrape::DATE
7
+ s.executables << 'shopee'
8
+ s.summary = 'Scrape categories of mobile01!'
9
+ s.description = 'Scrape categories of mobile01!'
10
10
  s.authors = ['Sheng Jung Wu', 'Calvin Jeng', 'Henry Chang', 'Yi Wei Huang']
11
11
  s.files = `git ls-files`.split("\n")
12
12
  s.test_files = `git ls-files spec/*`.split("\n")
13
- s.homepage = 'https://github.com/Smartibuy/ideate-and-scrape'
13
+ s.homepage = 'https://github.com/Smartibuy/shopee'
14
14
  s.license = 'MIT'
15
15
 
16
16
  # depend gem
@@ -19,4 +19,4 @@ Gem::Specification.new do |s|
19
19
  s.add_development_dependency 'webmock'
20
20
  s.add_runtime_dependency 'oga'
21
21
  s.add_runtime_dependency 'json'
22
- end
22
+ end
data/spec/shopee_spec.rb CHANGED
@@ -1,25 +1,167 @@
1
1
  require 'minitest/autorun'
2
2
  require 'webmock/minitest'
3
3
  require 'json'
4
- require_relative '../lib/shopee_scrap'
4
+ require_relative '../lib/shopee'
5
5
  require_relative './vcr'
6
6
 
7
- CATEGORY_LIST = ['女生衣著', '男生衣著', '女生包包與配件', '男生包包與配件', '女鞋', '男鞋','3C相關', '手機平板與周邊', '居家生活',
8
- '娛樂、收藏', '代買代購', '服務、票券', '化妝、保養品', '嬰幼童與母親', '美食、伴手禮', '寵物', '戶外、運動',
9
- '家電影音', '電玩遊戲相關', '其他類別']
7
+ CATEGORY_LIST = [ '電腦資訊',
8
+ '桌上型電腦',
9
+ '核心組件',
10
+ '儲存裝置',
11
+ '顯示設備',
12
+ '網路設備',
13
+ '電腦周邊設備',
14
+ '機殼、散熱與電源',
15
+ '電腦軟體與書籍',
16
+ '耗材、線材與雜項',
17
+ '筆記型電腦',
18
+ '筆記型電腦周邊',
19
+ '平板電腦',
20
+ '蘋果電腦',
21
+ '蘋果電腦周邊',
22
+ '其它',
23
+ '手持通訊',
24
+ '手機',
25
+ 'Android',
26
+ 'iPhone',
27
+ 'Windows Phone',
28
+ '其他類型',
29
+ '手機配件與吊飾',
30
+ '家用電話',
31
+ '傳真、影印與事務機',
32
+ '通訊週邊與耗材',
33
+ 'GPS',
34
+ '攝影器材',
35
+ '攝影機',
36
+ '傳統底片相機',
37
+ '消費級數位相機',
38
+ '數位單眼相機',
39
+ '相機其他周邊',
40
+ '相機鏡頭',
41
+ '攝影背包',
42
+ '數位相機電池',
43
+ '數位相機充電器',
44
+ '記憶卡與行動相簿',
45
+ '相片印表機與數位相框',
46
+ '數位家電',
47
+ '電視機',
48
+ '音響與隨身聽',
49
+ '影音設備周邊',
50
+ '投影機與布幕',
51
+ '生活小家電',
52
+ '廚房小家電',
53
+ '淨水設備',
54
+ '健康與美容小家電',
55
+ '冰箱',
56
+ '洗衣與乾衣機',
57
+ '冷氣空調',
58
+ '休閒娛樂',
59
+ '電玩主機',
60
+ '電玩遊戲',
61
+ '動漫電玩週邊',
62
+ '電腦與線上遊戲',
63
+ '懷舊童玩',
64
+ '遙控模型',
65
+ '金屬與鐵道模型',
66
+ '益智遊戲',
67
+ '玩具與模型',
68
+ '書籍雜誌',
69
+ '電視電影',
70
+ '音樂歌曲',
71
+ '生活用品',
72
+ '名產美食',
73
+ '運動健身綜合',
74
+ '休閒旅遊',
75
+ '鐘錶名品',
76
+ '生活居家',
77
+ '寵物用品',
78
+ '汽車',
79
+ '轎車、跑車',
80
+ '休旅車',
81
+ '貨車、其他車種',
82
+ '汽車用品',
83
+ '汽車精品',
84
+ '美容清潔',
85
+ '油品',
86
+ '其他汽車用品',
87
+ '影音設備',
88
+ '汽車零件',
89
+ '車燈',
90
+ '輪胎、鋁圈',
91
+ '底盤系統',
92
+ '電機、冷卻系統',
93
+ '煞車系統',
94
+ '空力套件',
95
+ '引擎、傳動與其它',
96
+ '機車',
97
+ '機車騎士用品',
98
+ '機車用品',
99
+ '機車零組件',
100
+ '自行車',
101
+ '公路車',
102
+ '登山車',
103
+ '小徑與摺疊車',
104
+ '休閒與通勤車',
105
+ '人身部品',
106
+ '安全帽',
107
+ '車衣、車褲',
108
+ '其它人身部品',
109
+ '自行車用品',
110
+ '車燈、碼表',
111
+ '收納袋、車袋',
112
+ '清潔保養用品',
113
+ '其它周邊配件',
114
+ '自行車零件',
115
+ '車架、前叉、避震器',
116
+ '龍頭、車把',
117
+ '煞車、變速系統零件',
118
+ '輪組、內外胎',
119
+ '座墊、座管',
120
+ '其它車用零件',
121
+ '男性時尚',
122
+ '服飾與襯衫',
123
+ '外套與夾克',
124
+ '男用長短褲',
125
+ '男用鞋與靴',
126
+ '男性內衣褲襪',
127
+ '男性飾品與配件',
128
+ '女性流行',
129
+ '彩妝與保養',
130
+ '嬰幼童與母親',
131
+ '流行女裝',
132
+ '女性飾品與配件',
133
+ '女鞋',
134
+ '女性內衣',
135
+ '代購與虛擬物品',
136
+ '3C物品代購',
137
+ '動漫電玩代購',
138
+ '服飾配件代購',
139
+ '其他物品代購',
140
+ '手機門號/加值/預付卡',
141
+ '遊戲點卡/虛寶',
142
+ '票卷',
143
+ '房屋地產',
144
+ '北部地區',
145
+ '中部地區',
146
+ '南部地區',
147
+ '東部與外島地區' ]
10
148
 
11
- TESTAMENT_ARR = []
12
-
13
- CATEGORY_LIST.each do |e|
14
- TESTAMENT_ARR.push({'title' => e})
15
- end
16
149
 
17
- VCR.use_cassette('shopee') do
18
- scraper = ShopeeTileScrape::ShopeeTile.new
19
- describe 'Shopee testament using vcr' do
20
- it 'should return an array of string and name of categories' do
21
- category_arr = JSON.parse(scraper.titles)
22
- category_arr.must_equal TESTAMENT_ARR
23
- end
150
+ describe 'Testing all categories of mobile01.' do
151
+ it 'should return an array of string and name of categories.' do
152
+ lister = ShopeeScrape::ShopeeListAll.new
153
+ category_arr = lister.get_categories
154
+ category_arr.must_equal CATEGORY_LIST
24
155
  end
25
- end
156
+ end
157
+
158
+ # VCR.use_cassette('shopee') do
159
+ # //It should be placed outside.
160
+ # scraper = ShopeeTileScrape::ShopeeTile.new
161
+ # describe 'Shopee testament using vcr' do
162
+ # it 'should return an array of string and name of categories' do
163
+ # category_arr = JSON.parse(scraper.titles)
164
+ # category_arr.must_equal TESTAMENT_ARR
165
+ # end
166
+ # end
167
+ # end
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.0.3
4
+ version: 0.0.4
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-10-17 00:00:00.000000000 Z
14
+ date: 2015-11-09 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: minitest
@@ -83,10 +83,10 @@ dependencies:
83
83
  - - ">="
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0'
86
- description: Scrape categories of shopee!
86
+ description: Scrape categories of mobile01!
87
87
  email:
88
88
  executables:
89
- - shopee_titles
89
+ - shopee
90
90
  extensions: []
91
91
  extra_rdoc_files: []
92
92
  files:
@@ -96,14 +96,16 @@ files:
96
96
  - LICENSE
97
97
  - README.md
98
98
  - Rakefile
99
- - bin/shopee_titles
99
+ - bin/shopee
100
+ - lib/data/mobile_category.json
101
+ - lib/data/mobile_category.rb
102
+ - lib/shopee.rb
100
103
  - lib/shopee/version.rb
101
- - lib/shopee_scrap.rb
102
104
  - shopee.gemspec
103
105
  - spec/fixtures/vcr_cassettes/shopee.yml
104
106
  - spec/shopee_spec.rb
105
107
  - spec/vcr.rb
106
- homepage: https://github.com/Smartibuy/ideate-and-scrape
108
+ homepage: https://github.com/Smartibuy/shopee
107
109
  licenses:
108
110
  - MIT
109
111
  metadata: {}
@@ -123,10 +125,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
125
  version: '0'
124
126
  requirements: []
125
127
  rubyforge_project:
126
- rubygems_version: 2.4.6
128
+ rubygems_version: 2.4.5.1
127
129
  signing_key:
128
130
  specification_version: 4
129
- summary: Scrape categories of shopee!
131
+ summary: Scrape categories of mobile01!
130
132
  test_files:
131
133
  - spec/fixtures/vcr_cassettes/shopee.yml
132
134
  - spec/shopee_spec.rb
data/bin/shopee_titles DELETED
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'json'
3
- require_relative '../lib/shopee_scrap'
4
-
5
- begin
6
- google_news = ShopeeTileScrape::ShopeeTile.new
7
- news_arr = JSON.parse(google_news.titles)
8
-
9
- news_arr.each do |hash|
10
- puts "#{hash['title']} "
11
- end
12
-
13
- rescue => e
14
- puts "Error occured - see details: #{e}"
15
- end