stylemooncat 0.0.1 → 0.0.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/stylemooncat +1 -1
- data/lib/stylemooncat/scraper.rb +26 -56
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64df36aa66038d47ee4c60665f3bc6668159cca2
|
4
|
+
data.tar.gz: 75eee9919b481fa2770b2896f2efc63590ffe286
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c966d17a66178097532e6834343300707545dc0cddb6f7aad86f5d822ce4695df6b67ae84d8b1ca25e78e8a152c3a1a466ab46411b7b6bb4079051bc45612a0
|
7
|
+
data.tar.gz: f80776ae3c3bcf27d851741d5af11e24ad3b7ea18bb68e845166e0b6efcf1b9a0475732a8fd7ecdcc88d5c6cad741cc83cff551c87d79c193f448fad4d05d851
|
data/bin/stylemooncat
CHANGED
data/lib/stylemooncat/scraper.rb
CHANGED
@@ -13,6 +13,7 @@ module StyleMoonCat
|
|
13
13
|
@@LAST_WEEK_URI = "#{@@BASE_URI}/PDList.asp?recommand=1312090002"
|
14
14
|
@@SPECIAL_DISCOUNT_URI = "#{@@BASE_URI}/PDList.asp?recommand=1312090003"
|
15
15
|
|
16
|
+
@@ALL_ITEMS_URI = "#{@@BASE_URI}/PDList.asp?item1=00"
|
16
17
|
@@TOP_URI = "#{@@BASE_URI}/PDList.asp?p1=01"
|
17
18
|
@@BOTTOM_URI = "#{@@BASE_URI}/PDList.asp?p1=02"
|
18
19
|
@@OUTER_URI = "#{@@BASE_URI}/PDList.asp?p1=03"
|
@@ -32,62 +33,31 @@ module StyleMoonCat
|
|
32
33
|
# Regular ?
|
33
34
|
@@TITLE_REGEX = /([.\p{Han}[a-zA-Z]]+)/
|
34
35
|
|
35
|
-
def
|
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
|
-
uri = uri_with_page(@@BOTTOM_URI, page)
|
61
|
-
body = fetch_data(uri)
|
62
|
-
filter(body)
|
63
|
-
end
|
64
|
-
|
65
|
-
def get_outer(page)
|
66
|
-
uri = uri_with_page(@@OUTER_URI, page)
|
67
|
-
body = fetch_data(uri)
|
68
|
-
filter(body)
|
69
|
-
end
|
70
|
-
|
71
|
-
def get_dress(page)
|
72
|
-
uri = uri_with_page(@@DRESS_URI, page)
|
73
|
-
body = fetch_data(uri)
|
74
|
-
filter(body)
|
75
|
-
end
|
76
|
-
|
77
|
-
def get_shoes(page)
|
78
|
-
uri = uri_with_page(@@SHOES_URI, page)
|
79
|
-
body = fetch_data(uri)
|
80
|
-
filter(body)
|
81
|
-
end
|
82
|
-
|
83
|
-
def get_bag(page)
|
84
|
-
uri = uri_with_page(@@BAG_URI, page)
|
85
|
-
body = fetch_data(uri)
|
86
|
-
filter(body)
|
87
|
-
end
|
88
|
-
|
89
|
-
def get_accessories(page)
|
90
|
-
uri = uri_with_page(@@ACCESSORIES_URI, page)
|
36
|
+
def scrape(category,page)
|
37
|
+
case category
|
38
|
+
when "newarrival"
|
39
|
+
uri = uri_with_page(@@NEW_ARRIVALS_URI, page)
|
40
|
+
when "lastweek"
|
41
|
+
uri = uri_with_page(@@LAST_WEEK_URI, page)
|
42
|
+
when "specialdiscount"
|
43
|
+
uri = uri_with_page(@@SPECIAL_DISCOUNT_URI, page)
|
44
|
+
when "top"
|
45
|
+
uri = uri_with_page(@@TOP_URI, page)
|
46
|
+
when "bottom"
|
47
|
+
uri = uri_with_page(@@BOTTOM_URI, page)
|
48
|
+
when "outer"
|
49
|
+
uri = uri_with_page(@@OUTER_URI, page)
|
50
|
+
when "dress"
|
51
|
+
uri = uri_with_page(@@DRESS_URI, page)
|
52
|
+
when "shose"
|
53
|
+
uri = uri_with_page(@@SHOES_URI, page)
|
54
|
+
when "bag"
|
55
|
+
uri = uri_with_page(@@BAG_URI, page)
|
56
|
+
when "accessories"
|
57
|
+
uri = uri_with_page(@@ACCESSORIES_URI, page)
|
58
|
+
else
|
59
|
+
uri = uri_with_page(@@ALL_ITEMS_URI, page)
|
60
|
+
end
|
91
61
|
body = fetch_data(uri)
|
92
62
|
filter(body)
|
93
63
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stylemooncat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Even Chang
|
@@ -13,8 +13,9 @@ bindir: bin
|
|
13
13
|
cert_chain: []
|
14
14
|
date: 2015-12-19 00:00:00.000000000 Z
|
15
15
|
dependencies: []
|
16
|
-
description: This is a gem scraping StyleMoonCat's website
|
17
|
-
items with title,price,image,and link
|
16
|
+
description: This is a gem scraping StyleMoonCat's website.Input category name and
|
17
|
+
page number,and it will return the items with title,price,image,and link in the
|
18
|
+
page of the category
|
18
19
|
email:
|
19
20
|
- kiki44552002@gmail.com
|
20
21
|
- lmherrera86@gmail.com
|