xvideos_helper 0.0.1
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.
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +85 -0
- data/Rakefile +6 -0
- data/bin/xvideos_helper +3 -0
- data/lib/xvideos_helper/client.rb +41 -0
- data/lib/xvideos_helper/crawler.rb +101 -0
- data/lib/xvideos_helper/env.rb +5 -0
- data/lib/xvideos_helper/version.rb +3 -0
- data/lib/xvideos_helper.rb +5 -0
- data/spec/lib/client_spec.rb +96 -0
- data/spec/lib/crawler_spec.rb +97 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/xvideos_helper_spec.rb +7 -0
- data/xvideos_helper.gemspec +24 -0
- metadata +117 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2013 YuheiNakasaka
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# XvideosHelper
|
|
2
|
+
|
|
3
|
+
XvideosHelper is a gem to support for adult site creater.This gem provides xvideo's data like movie url or movie page url for you with scraping the site easily.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
gem 'xvideos_helper'
|
|
10
|
+
|
|
11
|
+
And then execute:
|
|
12
|
+
|
|
13
|
+
$ bundle
|
|
14
|
+
|
|
15
|
+
Or install it yourself as:
|
|
16
|
+
|
|
17
|
+
$ gem install xvideos_helper
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
### movies_of(target_url)
|
|
22
|
+
|
|
23
|
+
- Get movie data
|
|
24
|
+
|
|
25
|
+
```ruby
|
|
26
|
+
require 'xvideos_helper'
|
|
27
|
+
adult = XvideosHelper::Client.new
|
|
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
|
+
```
|
|
33
|
+
|
|
34
|
+
- return
|
|
35
|
+
|
|
36
|
+
```ruby
|
|
37
|
+
{
|
|
38
|
+
0 => {
|
|
39
|
+
"movie_page_url"=> "http://jp.xvideos.com/video2017657/0/jp_kyoko_ayana_qc05-02_by_zeus4096_asian_cumshots_asian_swallow_japanese_chinese",
|
|
40
|
+
"movie_thumnail_url"=> "http://img100.xvideos.com/videos/thumbs/46/a0/69/46a069b72731e3c22ddf917d9fb1cbca/46a069b72731e3c22ddf917d9fb1cbca.4.jpg",
|
|
41
|
+
"description"=>"Jp Kyoko Ayana Qc05-02 By Zeus4096 asian ...",
|
|
42
|
+
"duration"=>"(19min)",
|
|
43
|
+
"movie_quality"=>"Pornquality:98%"
|
|
44
|
+
},
|
|
45
|
+
1 => {
|
|
46
|
+
...
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### tag_data_lists
|
|
52
|
+
|
|
53
|
+
- Get all tags data
|
|
54
|
+
|
|
55
|
+
```ruby
|
|
56
|
+
require 'xvideos_helper'
|
|
57
|
+
sexy = XvideosHelper::Client.new
|
|
58
|
+
tags_data = sexy.tag_data_lists # default 1997 objects
|
|
59
|
+
|
|
60
|
+
sexy.tags_limit = 10
|
|
61
|
+
tags_data = sexy.tag_data_lists # return 10 objects
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
- return
|
|
65
|
+
|
|
66
|
+
```ruby
|
|
67
|
+
{
|
|
68
|
+
0 => {
|
|
69
|
+
tag_name => 'sex'
|
|
70
|
+
tag_url => 'http://jp.xvideos.com/tags/sex'
|
|
71
|
+
tag_count => 320165
|
|
72
|
+
},
|
|
73
|
+
1 => {
|
|
74
|
+
...
|
|
75
|
+
},
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Contributing
|
|
80
|
+
|
|
81
|
+
1. Fork it
|
|
82
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
83
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
84
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
85
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/bin/xvideos_helper
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
require 'xvideos_helper/env'
|
|
3
|
+
require 'xvideos_helper/crawler'
|
|
4
|
+
|
|
5
|
+
module XvideosHelper
|
|
6
|
+
class Client
|
|
7
|
+
attr_accessor :domain, :tag_url
|
|
8
|
+
def initialize
|
|
9
|
+
@crawler = XvideosHelper::Crawler.new
|
|
10
|
+
@domain ||= Env::XVIDES_URL_JP
|
|
11
|
+
@tag_url ||= Env::XVIDES_TAG_URL
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# get movie information according to target
|
|
15
|
+
def movies_of(target)
|
|
16
|
+
begin
|
|
17
|
+
return @crawler.get_data_from(target,'movie')
|
|
18
|
+
rescue Exception => e
|
|
19
|
+
raise e
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# tag's url lists
|
|
24
|
+
def tag_data_lists
|
|
25
|
+
begin
|
|
26
|
+
return @crawler.get_data_from(@tag_url,'taglist')
|
|
27
|
+
rescue Exception => e
|
|
28
|
+
raise e
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def movies_limit=(limit)
|
|
33
|
+
@crawler.movies_limit = limit
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def tags_limit=(limit)
|
|
37
|
+
@crawler.tags_limit = limit
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
require 'open-uri'
|
|
3
|
+
require "nokogiri"
|
|
4
|
+
|
|
5
|
+
module XvideosHelper
|
|
6
|
+
class Crawler
|
|
7
|
+
attr_accessor :movies_limit,:tags_limit
|
|
8
|
+
def initialize
|
|
9
|
+
@domain ||= Env::XVIDES_URL_JP
|
|
10
|
+
@movies_limit ||= -1
|
|
11
|
+
@tags_limit ||= -1
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def get_data_from(url,from)
|
|
15
|
+
begin
|
|
16
|
+
source = html(url)
|
|
17
|
+
if from == 'movie'
|
|
18
|
+
return parsed_movie_data(source)
|
|
19
|
+
elsif from == 'taglist'
|
|
20
|
+
return parsed_tag_data(source)
|
|
21
|
+
else
|
|
22
|
+
return {}
|
|
23
|
+
end
|
|
24
|
+
rescue Exception => e
|
|
25
|
+
raise e
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
def html(url)
|
|
31
|
+
begin
|
|
32
|
+
return Nokogiri.HTML(open(url).read)
|
|
33
|
+
rescue Exception => e
|
|
34
|
+
raise e
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# main crawler
|
|
39
|
+
def parsed_movie_data(data)
|
|
40
|
+
parsed_data = {}
|
|
41
|
+
index = 0
|
|
42
|
+
|
|
43
|
+
data.xpath('//div[@class="thumbBlock"]/div[@class="thumbInside"]').each do |post|
|
|
44
|
+
begin
|
|
45
|
+
# limit
|
|
46
|
+
break if @movies_limit == index
|
|
47
|
+
parsed_data[index] = {}
|
|
48
|
+
# thumbnail infomation
|
|
49
|
+
post.search('div[@class="thumb"]/a').each do |a|
|
|
50
|
+
parsed_data[index]['movie_page_url'] = "#{@domain}#{a.attribute('href').value}"
|
|
51
|
+
parsed_data[index]['movie_thumnail_url'] = "#{a.children.attribute('src').value}"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# if script tag is contained
|
|
55
|
+
post.search('script').each do |elm|
|
|
56
|
+
parsed_data[index]['movie_page_url'] = @domain + (elm.children[0].content.match(/href="(.+?)">/))[1]
|
|
57
|
+
parsed_data[index]['movie_thumnail_url'] = (elm.children[0].content.match(/src="(.+?)"/))[1]
|
|
58
|
+
parsed_data[index]['description'] = (elm.children[0].content.match(/<p><a href=".+">(.+)<\/a><\/p>/))[1]
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# description
|
|
62
|
+
post.search('p/a').each do |a|
|
|
63
|
+
parsed_data[index]['description'] = a.inner_text
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# metadata
|
|
67
|
+
post.search('p[@class="metadata"]/span[@class="bg"]').each do |span|
|
|
68
|
+
text = span.inner_text.gsub(/(\t|\s|\n)+/,'')
|
|
69
|
+
parsed_data[index]['duration'] = (text.match(/\(.+\)/))[0]
|
|
70
|
+
parsed_data[index]['movie_quality'] = text.sub(/\(.+\)/,'')
|
|
71
|
+
end
|
|
72
|
+
index += 1
|
|
73
|
+
rescue Exception => e
|
|
74
|
+
raise e
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
return parsed_data
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# tag list crawler
|
|
81
|
+
def parsed_tag_data(data)
|
|
82
|
+
parsed_data = {}
|
|
83
|
+
index = 0
|
|
84
|
+
data.xpath('//div[@id="main"]/ul[@id="tags"]/li').each do |li|
|
|
85
|
+
begin
|
|
86
|
+
# limit
|
|
87
|
+
break if @tags_limit == index
|
|
88
|
+
parsed_data[index] = {}
|
|
89
|
+
# tag info
|
|
90
|
+
parsed_data[index]['tag_name'] = li.children.children.inner_text
|
|
91
|
+
parsed_data[index]['tag_url'] = "#{@domain}#{li.children.attribute('href').value}"
|
|
92
|
+
parsed_data[index]['tag_count'] = li.inner_text.sub(/.+\s/,'')
|
|
93
|
+
index += 1
|
|
94
|
+
rescue Exception => e
|
|
95
|
+
raise e
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
return parsed_data
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "XvideosHelper::Client" do
|
|
4
|
+
context 'movies_of' do
|
|
5
|
+
it 'return valid values' do
|
|
6
|
+
@xh = XvideosHelper::Client.new
|
|
7
|
+
lists = @xh.movies_of("http://jp.xvideos.com/")
|
|
8
|
+
lists.count.should > 0
|
|
9
|
+
lists.each do |key,list|
|
|
10
|
+
list["movie_page_url"].should match(/^http:\/\/.+/)
|
|
11
|
+
list["movie_thumnail_url"].should match(/^http:\/\/.+/)
|
|
12
|
+
list["description"].should_not be_nil
|
|
13
|
+
list["duration"].should_not be_nil
|
|
14
|
+
list["movie_quality"].should_not be_nil
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'raises error if invalid url' do
|
|
19
|
+
@xh = XvideosHelper::Client.new
|
|
20
|
+
lambda {@xh.movies_of("invalid://jp.xvideos.com/")}.should raise_error
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
context 'tag_data_lists' do
|
|
25
|
+
it 'return valid values' do
|
|
26
|
+
@xh = XvideosHelper::Client.new
|
|
27
|
+
@xh.tag_data_lists.count.should > 0
|
|
28
|
+
@xh.tag_data_lists.each do |key,list|
|
|
29
|
+
list['tag_name'].should_not be_nil
|
|
30
|
+
list['tag_url'].should match(/^http:\/\/.+/)
|
|
31
|
+
list['tag_count'].should_not be_nil
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'raises error if invalid url' do
|
|
36
|
+
@xh = XvideosHelper::Client.new
|
|
37
|
+
@xh.tag_url = 'aaaaaaaa'
|
|
38
|
+
lambda {@xh.tag_data_lists}.should raise_error
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
context 'movies_limit=' do
|
|
43
|
+
it 'changes limit to 1' do
|
|
44
|
+
@xh = XvideosHelper::Client.new
|
|
45
|
+
@xh.movies_limit = 1
|
|
46
|
+
lists = @xh.movies_of("http://jp.xvideos.com/")
|
|
47
|
+
lists.count.should == 1
|
|
48
|
+
lists.each do |key,list|
|
|
49
|
+
list["movie_page_url"].should match(/^http:\/\/.+/)
|
|
50
|
+
list["movie_thumnail_url"].should match(/^http:\/\/.+/)
|
|
51
|
+
list["description"].should_not be_nil
|
|
52
|
+
list["duration"].should_not be_nil
|
|
53
|
+
list["movie_quality"].should_not be_nil
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it 'changes limit to 0' do
|
|
58
|
+
@xh = XvideosHelper::Client.new
|
|
59
|
+
@xh.movies_limit = 0
|
|
60
|
+
lists = @xh.movies_of("http://jp.xvideos.com/")
|
|
61
|
+
lists.count.should == 0
|
|
62
|
+
lists.each do |key,list|
|
|
63
|
+
list["movie_page_url"].should match(/^http:\/\/.+/)
|
|
64
|
+
list["movie_thumnail_url"].should match(/^http:\/\/.+/)
|
|
65
|
+
list["description"].should_not be_nil
|
|
66
|
+
list["duration"].should_not be_nil
|
|
67
|
+
list["movie_quality"].should_not be_nil
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
context 'tags_limit=' do
|
|
73
|
+
it 'changes limit to 1' do
|
|
74
|
+
@xh = XvideosHelper::Client.new
|
|
75
|
+
@xh.tags_limit = 1
|
|
76
|
+
@xh.tag_data_lists.count.should == 1
|
|
77
|
+
@xh.tag_data_lists.each do |key,list|
|
|
78
|
+
list['tag_name'].should_not be_nil
|
|
79
|
+
list['tag_url'].should match(/^http:\/\/.+/)
|
|
80
|
+
list['tag_count'].should_not be_nil
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
it 'changes limit to 0' do
|
|
85
|
+
@xh = XvideosHelper::Client.new
|
|
86
|
+
@xh.tags_limit = 0
|
|
87
|
+
@xh.tag_data_lists.count.should == 0
|
|
88
|
+
@xh.tag_data_lists.each do |key,list|
|
|
89
|
+
list['tag_name'].should_not be_nil
|
|
90
|
+
list['tag_url'].should match(/^http:\/\/.+/)
|
|
91
|
+
list['tag_count'].should_not be_nil
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
end
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "XvideosHelper::Crawler" do
|
|
4
|
+
context 'get_data_from' do
|
|
5
|
+
it 'return valid movie information' do
|
|
6
|
+
@xh = XvideosHelper::Crawler.new
|
|
7
|
+
lists = @xh.get_data_from("http://jp.xvideos.com/",'movie')
|
|
8
|
+
lists.count.should > 0
|
|
9
|
+
lists.each do |key,list|
|
|
10
|
+
list["movie_page_url"].should match(/^http:\/\/.+/)
|
|
11
|
+
list["movie_thumnail_url"].should match(/^http:\/\/.+/)
|
|
12
|
+
list["description"].should_not be_nil
|
|
13
|
+
list["duration"].should_not be_nil
|
|
14
|
+
list["movie_quality"].should_not be_nil
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'return 0 movie information' do
|
|
19
|
+
@xh = XvideosHelper::Crawler.new
|
|
20
|
+
@xh.movies_limit = 0
|
|
21
|
+
lists = @xh.get_data_from("http://jp.xvideos.com/",'movie')
|
|
22
|
+
lists.count.should == 0
|
|
23
|
+
lists.each do |key,list|
|
|
24
|
+
list["movie_page_url"].should match(/^http:\/\/.+/)
|
|
25
|
+
list["movie_thumnail_url"].should match(/^http:\/\/.+/)
|
|
26
|
+
list["description"].should_not be_nil
|
|
27
|
+
list["duration"].should_not be_nil
|
|
28
|
+
list["movie_quality"].should_not be_nil
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it 'return 1 movie information' do
|
|
33
|
+
@xh = XvideosHelper::Crawler.new
|
|
34
|
+
@xh.movies_limit = 1
|
|
35
|
+
lists = @xh.get_data_from("http://jp.xvideos.com/",'movie')
|
|
36
|
+
lists.count.should == 1
|
|
37
|
+
lists.each do |key,list|
|
|
38
|
+
list["movie_page_url"].should match(/^http:\/\/.+/)
|
|
39
|
+
list["movie_thumnail_url"].should match(/^http:\/\/.+/)
|
|
40
|
+
list["description"].should_not be_nil
|
|
41
|
+
list["duration"].should_not be_nil
|
|
42
|
+
list["movie_quality"].should_not be_nil
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it 'return valid tag lists' do
|
|
47
|
+
@xh = XvideosHelper::Crawler.new
|
|
48
|
+
lists = @xh.get_data_from("http://jp.xvideos.com/tags",'taglist')
|
|
49
|
+
lists.count.should > 0
|
|
50
|
+
lists.each do |key,list|
|
|
51
|
+
list['tag_name'].should_not be_nil
|
|
52
|
+
list['tag_url'].should match(/^http:\/\/.+/)
|
|
53
|
+
list['tag_count'].should_not be_nil
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it 'return 0 tag list' do
|
|
58
|
+
@xh = XvideosHelper::Crawler.new
|
|
59
|
+
@xh.tags_limit = 0
|
|
60
|
+
lists = @xh.get_data_from("http://jp.xvideos.com/tags",'taglist')
|
|
61
|
+
lists.count.should == 0
|
|
62
|
+
lists.each do |key,list|
|
|
63
|
+
list['tag_name'].should_not be_nil
|
|
64
|
+
list['tag_url'].should match(/^http:\/\/.+/)
|
|
65
|
+
list['tag_count'].should_not be_nil
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
it 'return 1 tag list' do
|
|
70
|
+
@xh = XvideosHelper::Crawler.new
|
|
71
|
+
@xh.tags_limit = 1
|
|
72
|
+
lists = @xh.get_data_from("http://jp.xvideos.com/tags",'taglist')
|
|
73
|
+
lists.count.should == 1
|
|
74
|
+
lists.each do |key,list|
|
|
75
|
+
list['tag_name'].should_not be_nil
|
|
76
|
+
list['tag_url'].should match(/^http:\/\/.+/)
|
|
77
|
+
list['tag_count'].should_not be_nil
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
it 'return empty object if undifined name or the other objects' do
|
|
82
|
+
@xh = XvideosHelper::Crawler.new
|
|
83
|
+
lists = @xh.get_data_from("http://jp.xvideos.com/",'undifined_name')
|
|
84
|
+
lists.should == {}
|
|
85
|
+
lists = @xh.get_data_from("http://jp.xvideos.com/",{})
|
|
86
|
+
lists.should == {}
|
|
87
|
+
lists = @xh.get_data_from("http://jp.xvideos.com/",[])
|
|
88
|
+
lists.should == {}
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
it 'raises error if invalid url' do
|
|
92
|
+
@xh = XvideosHelper::Crawler.new
|
|
93
|
+
lambda {@xh.movies_of("invalid://jp.xvideos.com/",'movie')}.should raise_error
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'xvideos_helper/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "xvideos_helper"
|
|
8
|
+
spec.version = XvideosHelper::VERSION
|
|
9
|
+
spec.authors = ["YuheiNakasaka"]
|
|
10
|
+
spec.email = ["yuhei.nakasaka@gmail.com"]
|
|
11
|
+
spec.description = %q{xvideos_helper is a gem to support for adult site creater.}
|
|
12
|
+
spec.summary = %q{This gem get movie infomation from xvideo.com.}
|
|
13
|
+
spec.homepage = "https://github.com/YuheiNakasaka/xvideos_helper"
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files`.split($/)
|
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
+
spec.require_paths = ["lib"]
|
|
20
|
+
|
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
|
22
|
+
spec.add_development_dependency "rake"
|
|
23
|
+
spec.add_development_dependency "rspec"
|
|
24
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: xvideos_helper
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
prerelease:
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- YuheiNakasaka
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2013-11-30 00:00:00.000000000 Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
15
|
+
name: bundler
|
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
|
17
|
+
none: false
|
|
18
|
+
requirements:
|
|
19
|
+
- - ~>
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '1.3'
|
|
22
|
+
type: :development
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
26
|
+
requirements:
|
|
27
|
+
- - ~>
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '1.3'
|
|
30
|
+
- !ruby/object:Gem::Dependency
|
|
31
|
+
name: rake
|
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
|
33
|
+
none: false
|
|
34
|
+
requirements:
|
|
35
|
+
- - ! '>='
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '0'
|
|
38
|
+
type: :development
|
|
39
|
+
prerelease: false
|
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
+
none: false
|
|
42
|
+
requirements:
|
|
43
|
+
- - ! '>='
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: '0'
|
|
46
|
+
- !ruby/object:Gem::Dependency
|
|
47
|
+
name: rspec
|
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
|
49
|
+
none: false
|
|
50
|
+
requirements:
|
|
51
|
+
- - ! '>='
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0'
|
|
54
|
+
type: :development
|
|
55
|
+
prerelease: false
|
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
none: false
|
|
58
|
+
requirements:
|
|
59
|
+
- - ! '>='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
description: xvideos_helper is a gem to support for adult site creater.
|
|
63
|
+
email:
|
|
64
|
+
- yuhei.nakasaka@gmail.com
|
|
65
|
+
executables:
|
|
66
|
+
- xvideos_helper
|
|
67
|
+
extensions: []
|
|
68
|
+
extra_rdoc_files: []
|
|
69
|
+
files:
|
|
70
|
+
- .gitignore
|
|
71
|
+
- .rspec
|
|
72
|
+
- .travis.yml
|
|
73
|
+
- Gemfile
|
|
74
|
+
- LICENSE.txt
|
|
75
|
+
- README.md
|
|
76
|
+
- Rakefile
|
|
77
|
+
- bin/xvideos_helper
|
|
78
|
+
- lib/xvideos_helper.rb
|
|
79
|
+
- lib/xvideos_helper/client.rb
|
|
80
|
+
- lib/xvideos_helper/crawler.rb
|
|
81
|
+
- lib/xvideos_helper/env.rb
|
|
82
|
+
- lib/xvideos_helper/version.rb
|
|
83
|
+
- spec/lib/client_spec.rb
|
|
84
|
+
- spec/lib/crawler_spec.rb
|
|
85
|
+
- spec/spec_helper.rb
|
|
86
|
+
- spec/xvideos_helper_spec.rb
|
|
87
|
+
- xvideos_helper.gemspec
|
|
88
|
+
homepage: https://github.com/YuheiNakasaka/xvideos_helper
|
|
89
|
+
licenses:
|
|
90
|
+
- MIT
|
|
91
|
+
post_install_message:
|
|
92
|
+
rdoc_options: []
|
|
93
|
+
require_paths:
|
|
94
|
+
- lib
|
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
96
|
+
none: false
|
|
97
|
+
requirements:
|
|
98
|
+
- - ! '>='
|
|
99
|
+
- !ruby/object:Gem::Version
|
|
100
|
+
version: '0'
|
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
|
+
none: false
|
|
103
|
+
requirements:
|
|
104
|
+
- - ! '>='
|
|
105
|
+
- !ruby/object:Gem::Version
|
|
106
|
+
version: '0'
|
|
107
|
+
requirements: []
|
|
108
|
+
rubyforge_project:
|
|
109
|
+
rubygems_version: 1.8.24
|
|
110
|
+
signing_key:
|
|
111
|
+
specification_version: 3
|
|
112
|
+
summary: This gem get movie infomation from xvideo.com.
|
|
113
|
+
test_files:
|
|
114
|
+
- spec/lib/client_spec.rb
|
|
115
|
+
- spec/lib/crawler_spec.rb
|
|
116
|
+
- spec/spec_helper.rb
|
|
117
|
+
- spec/xvideos_helper_spec.rb
|