xvideos_helper 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -26,9 +26,6 @@ Or install it yourself as:
26
26
  require 'xvideos_helper'
27
27
  adult = XvideosHelper::Client.new
28
28
  movie_data = adult.movies_of('http://www.xvideos.com') # default 35 objects
29
-
30
- adult.movies_limit = 10
31
- movie_data = adult.movies_of('http://www.xvideos.com') # return 10 objects
32
29
  ```
33
30
 
34
31
  - return
@@ -36,6 +33,7 @@ Or install it yourself as:
36
33
  ```ruby
37
34
  {
38
35
  0 => {
36
+ "movie_url" => "http://flashservice.xvideos.com/embedframe/6243093",
39
37
  "movie_page_url"=> "http://jp.xvideos.com/video2017657/0/jp_kyoko_ayana_qc05-02_by_zeus4096_asian_cumshots_asian_swallow_japanese_chinese",
40
38
  "movie_thumnail_url"=> "http://img100.xvideos.com/videos/thumbs/46/a0/69/46a069b72731e3c22ddf917d9fb1cbca/46a069b72731e3c22ddf917d9fb1cbca.4.jpg",
41
39
  "description"=>"Jp Kyoko Ayana Qc05-02 By Zeus4096 asian ...",
@@ -57,8 +55,6 @@ Or install it yourself as:
57
55
  sexy = XvideosHelper::Client.new
58
56
  tags_data = sexy.tag_data_lists # default 1997 objects
59
57
 
60
- sexy.tags_limit = 10
61
- tags_data = sexy.tag_data_lists # return 10 objects
62
58
  ```
63
59
 
64
60
  - return
@@ -76,6 +72,51 @@ Or install it yourself as:
76
72
  }
77
73
  ```
78
74
 
75
+ ### define limit
76
+
77
+ - movie
78
+
79
+ ```ruby
80
+ require 'xvideos_helper'
81
+ adult = XvideosHelper::Client.new
82
+ adult.movies_limit = 10
83
+ movie_data = adult.movies_of('http://www.xvideos.com') # return 10 objects
84
+ ```
85
+
86
+ - tag
87
+
88
+ ```ruby
89
+ require 'xvideos_helper'
90
+ sexy.tags_limit = 10
91
+ tags_data = sexy.tag_data_lists # return 10 objects
92
+ ```
93
+ ## example
94
+
95
+ - Get movie information from HOME.
96
+
97
+ ```ruby
98
+ adult = XvideosHelper::Client.new
99
+ movie_data = adult.movies_of('http://www.xvideos.com')
100
+ ```
101
+
102
+ - Get movie information from all tag pages.
103
+
104
+ ```ruby
105
+ adult = XvideosHelper::Client.new
106
+ tags_data = sexy.tag_data_lists
107
+ tag_movie_data = []
108
+ tags_data.each do |tag|
109
+ tag_movie_data << adult.movies_of("http://www.xvideos.com/tags/#{tag}")
110
+ end
111
+ ```
112
+
113
+ - Get popular movie information.
114
+
115
+ ```ruby
116
+ adult = XvideosHelper::Client.new
117
+ movie_data = adult.movies_of("http://www.xvideos.com/hits/")
118
+ ```
119
+
79
120
  ## Contributing
80
121
 
81
122
  1. Fork it
@@ -7,6 +7,7 @@ module XvideosHelper
7
7
  attr_accessor :movies_limit,:tags_limit
8
8
  def initialize
9
9
  @domain ||= Env::XVIDES_URL_JP
10
+ @iframe_url ||= Env::XVIDES_IFRAME_URL
10
11
  @movies_limit ||= -1
11
12
  @tags_limit ||= -1
12
13
  end
@@ -58,6 +59,9 @@ private
58
59
  parsed_data[index]['description'] = (elm.children[0].content.match(/<p><a href=".+">(.+)<\/a><\/p>/))[1]
59
60
  end
60
61
 
62
+ # iframe url
63
+ parsed_data[index]['movie_url'] = @iframe_url + (parsed_data[index]['movie_page_url'].match(/\/video(\d+)\/.*/))[1]
64
+
61
65
  # description
62
66
  post.search('p/a').each do |a|
63
67
  parsed_data[index]['description'] = a.inner_text
@@ -2,4 +2,5 @@
2
2
  module Env
3
3
  XVIDES_URL_JP = 'http://jp.xvideos.com'
4
4
  XVIDES_TAG_URL = "#{XVIDES_URL_JP}/tags"
5
+ XVIDES_IFRAME_URL = 'http://flashservice.xvideos.com/embedframe/'
5
6
  end
@@ -1,3 +1,3 @@
1
1
  module XvideosHelper
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -7,6 +7,7 @@ describe "XvideosHelper::Client" do
7
7
  lists = @xh.movies_of("http://jp.xvideos.com/")
8
8
  lists.count.should > 0
9
9
  lists.each do |key,list|
10
+ list["movie_url"].should match(/^http:\/\/.+\/\d+$/)
10
11
  list["movie_page_url"].should match(/^http:\/\/.+/)
11
12
  list["movie_thumnail_url"].should match(/^http:\/\/.+/)
12
13
  list["description"].should_not be_nil
@@ -46,6 +47,7 @@ describe "XvideosHelper::Client" do
46
47
  lists = @xh.movies_of("http://jp.xvideos.com/")
47
48
  lists.count.should == 1
48
49
  lists.each do |key,list|
50
+ list["movie_url"].should match(/^http:\/\/.+\/\d+$/)
49
51
  list["movie_page_url"].should match(/^http:\/\/.+/)
50
52
  list["movie_thumnail_url"].should match(/^http:\/\/.+/)
51
53
  list["description"].should_not be_nil
@@ -60,6 +62,7 @@ describe "XvideosHelper::Client" do
60
62
  lists = @xh.movies_of("http://jp.xvideos.com/")
61
63
  lists.count.should == 0
62
64
  lists.each do |key,list|
65
+ list["movie_url"].should match(/^http:\/\/.+\/\d+$/)
63
66
  list["movie_page_url"].should match(/^http:\/\/.+/)
64
67
  list["movie_thumnail_url"].should match(/^http:\/\/.+/)
65
68
  list["description"].should_not be_nil
@@ -7,6 +7,7 @@ describe "XvideosHelper::Crawler" do
7
7
  lists = @xh.get_data_from("http://jp.xvideos.com/",'movie')
8
8
  lists.count.should > 0
9
9
  lists.each do |key,list|
10
+ list["movie_url"].should match(/^http:\/\/.+\/\d+$/)
10
11
  list["movie_page_url"].should match(/^http:\/\/.+/)
11
12
  list["movie_thumnail_url"].should match(/^http:\/\/.+/)
12
13
  list["description"].should_not be_nil
@@ -21,6 +22,7 @@ describe "XvideosHelper::Crawler" do
21
22
  lists = @xh.get_data_from("http://jp.xvideos.com/",'movie')
22
23
  lists.count.should == 0
23
24
  lists.each do |key,list|
25
+ list["movie_url"].should match(/^http:\/\/.+\/\d+$/)
24
26
  list["movie_page_url"].should match(/^http:\/\/.+/)
25
27
  list["movie_thumnail_url"].should match(/^http:\/\/.+/)
26
28
  list["description"].should_not be_nil
@@ -35,6 +37,7 @@ describe "XvideosHelper::Crawler" do
35
37
  lists = @xh.get_data_from("http://jp.xvideos.com/",'movie')
36
38
  lists.count.should == 1
37
39
  lists.each do |key,list|
40
+ list["movie_url"].should match(/^http:\/\/.+\/\d+$/)
38
41
  list["movie_page_url"].should match(/^http:\/\/.+/)
39
42
  list["movie_thumnail_url"].should match(/^http:\/\/.+/)
40
43
  list["description"].should_not be_nil
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xvideos_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-30 00:00:00.000000000 Z
12
+ date: 2013-12-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler