ascraper 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/scraper/movies.rb +21 -5
- data/lib/scraper/version.rb +1 -1
- data/spec/movies_spec.rb +24 -0
- 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: a18d1c7658aeff26ae8d047dc8b9053cd7a46563
|
4
|
+
data.tar.gz: a75bc3956579032cc4aa60c902af1c1898e3e918
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46893baaa475c6081198338468096edd4c5ed5a24c277db24ad63789ddeda7cee9297a5c790e3b5c0e0c05c35ef66d462bee7ef10a83f78336127dce276b9088
|
7
|
+
data.tar.gz: de16abf7ec3a13d9a0d0947d5c7c26f8512b994472e3d3ab1bccc41ad56a8d1ccb0f6b101a1f9ebe39a632abc156adebd82e67c8ebe1faa9208f9108ef9dde48
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Add this line to your application's Gemfile:
|
6
6
|
|
7
|
-
gem '
|
7
|
+
gem 'ascraper'
|
8
8
|
|
9
9
|
And then execute:
|
10
10
|
|
@@ -12,8 +12,8 @@ And then execute:
|
|
12
12
|
|
13
13
|
Or install it yourself as:
|
14
14
|
|
15
|
-
$ gem install
|
15
|
+
$ gem install ascraper
|
16
16
|
|
17
17
|
## Usage
|
18
18
|
|
19
|
-
|
19
|
+
Do not use
|
data/lib/scraper/movies.rb
CHANGED
@@ -14,14 +14,30 @@ module Scraper
|
|
14
14
|
result.description = block.at_css('.description').content
|
15
15
|
result.url = url
|
16
16
|
|
17
|
+
result.main_image = block.at_css('.image').search('img')[0]['src']
|
18
|
+
result.imdb = block.at_css('.image').search('a')[0]['href']
|
19
|
+
|
20
|
+
result.genres = []
|
21
|
+
|
22
|
+
block.search('.genre').each do |genre|
|
23
|
+
result.genres << genre.content
|
24
|
+
end
|
25
|
+
|
26
|
+
result.tags = []
|
27
|
+
|
28
|
+
block.search('.ipsTag').each do |tag|
|
29
|
+
result.tags << tag.content
|
30
|
+
end
|
31
|
+
|
17
32
|
movie = Nokogiri::HTML(open(url))
|
18
33
|
|
19
|
-
|
20
|
-
|
34
|
+
result.images = movie.at_css('.image').search('a').map {|a| a['href']}.collect! {|x| x if %r{\Ahttps?:\/\/.+\.(?:jpe?g|png)\z}.match(x) }.compact.inspect
|
35
|
+
|
36
|
+
result.download_links = []
|
21
37
|
|
22
|
-
|
23
|
-
|
24
|
-
|
38
|
+
movie.css('.postarea p').each do |p|
|
39
|
+
result.download_links << p
|
40
|
+
end
|
25
41
|
|
26
42
|
results << result
|
27
43
|
end
|
data/lib/scraper/version.rb
CHANGED
data/spec/movies_spec.rb
CHANGED
@@ -32,6 +32,30 @@ describe Scraper::Movies do
|
|
32
32
|
puts @movie.url
|
33
33
|
expect(@movie.url).not_to be_empty
|
34
34
|
end
|
35
|
+
|
36
|
+
it "should return genres" do
|
37
|
+
puts @movie.genres
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should return tags" do
|
41
|
+
puts @movie.tags
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should return a main image" do
|
45
|
+
puts @movie.main_image
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should return images" do
|
49
|
+
puts @movie.images
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should return an imdb url" do
|
53
|
+
puts @movie.imdb
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should return download links" do
|
57
|
+
puts @movie.download_linksv
|
58
|
+
end
|
35
59
|
end
|
36
60
|
|
37
61
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ascraper
|
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
|
- Ahmet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|