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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a95cfbe149bb77c19450a761e899ad8e9811fa2
4
- data.tar.gz: 11958eb8b2195a5336ce6e4e4ce055b8df6c5773
3
+ metadata.gz: a18d1c7658aeff26ae8d047dc8b9053cd7a46563
4
+ data.tar.gz: a75bc3956579032cc4aa60c902af1c1898e3e918
5
5
  SHA512:
6
- metadata.gz: e7fdecb114609b09b2b4f5d3f5f7d0aa74babd5d4c62011adb1342971452b705256cb7614df3b36f0dd875cd7e7a8b30433ee82d1507dcd1703fb1b4ca7f8377
7
- data.tar.gz: ae55f31b711ee451c75c10d217ce54ea58ffa7a89ecb3fe03be21bd69d6c942ba58cd1a59805db0d9bfde61b552042199e9615abb62c2fa5f3a506b475885a31
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 'scraper'
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 scraper
15
+ $ gem install ascraper
16
16
 
17
17
  ## Usage
18
18
 
19
- TODO: Write usage instructions here
19
+ Do not use
@@ -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
- # [0] NFO [1] Main Image [Rest] Other Images
20
- 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
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
- # movie.css('.postarea p').each do |p|
23
- # raise p.inspect
24
- # end
38
+ movie.css('.postarea p').each do |p|
39
+ result.download_links << p
40
+ end
25
41
 
26
42
  results << result
27
43
  end
@@ -1,3 +1,3 @@
1
1
  module Scraper
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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.1
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-28 00:00:00.000000000 Z
11
+ date: 2014-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler