valda-video_scraper 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- mode:ruby; coding:utf-8 -*-
|
2
|
+
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/base')
|
4
|
+
|
5
|
+
module WWW
|
6
|
+
module VideoScraper
|
7
|
+
class EicBook < Base
|
8
|
+
attr_reader :capture_urls
|
9
|
+
url_regex %r!\Ahttp://www\.eic-book\.com/(detail_\d+\.html).*!
|
10
|
+
|
11
|
+
def scrape
|
12
|
+
uri = URI.parse(@page_url)
|
13
|
+
html = http_get("#{uri.scheme}://#{uri.host}#{uri.path}?flg=sm")
|
14
|
+
doc = Hpricot(html.toutf8)
|
15
|
+
raise FileNotFound unless flashvars = doc.at('//object //param[@name="FlashVars"]')
|
16
|
+
flashvars = CGI.parse(flashvars.attributes['value'])
|
17
|
+
@video_url = flashvars['flv'][0]
|
18
|
+
@title = CGI.unescapeHTML(doc.at('//h2[@class="detailTtl"]').inner_html).gsub(' ', ' ') rescue nil
|
19
|
+
html = http_get("#{uri.scheme}://#{uri.host}#{uri.path}?flg=h4")
|
20
|
+
doc = Hpricot(html.toutf8)
|
21
|
+
if img = doc.at('//div[@class="detailMN"]/img[@class="waku01"]')
|
22
|
+
@thumb_url = URI.join("#{uri.scheme}://#{uri.host}", img.attributes['src']).to_s
|
23
|
+
end
|
24
|
+
html = http_get("#{uri.scheme}://#{uri.host}#{uri.path}?flg=cp")
|
25
|
+
doc = Hpricot(html.toutf8)
|
26
|
+
@capture_urls = []
|
27
|
+
doc.search('//div[@class="detailMN"]/img[@class="waku01"]') do |img|
|
28
|
+
@capture_urls << URI.join("#{uri.scheme}://#{uri.host}", img.attributes['src']).to_s
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/www/video_scraper.rb
CHANGED
@@ -15,10 +15,10 @@ end
|
|
15
15
|
|
16
16
|
module WWW
|
17
17
|
module VideoScraper
|
18
|
-
VERSION = '1.0.
|
18
|
+
VERSION = '1.0.4'
|
19
19
|
|
20
|
-
MODULES_NAME = %w(adult_satellites age_sage ameba_vision dailymotion
|
21
|
-
nico_video pornhub pornotube red_tube tube8 veoh
|
20
|
+
MODULES_NAME = %w(adult_satellites age_sage ameba_vision dailymotion eic_book
|
21
|
+
moro_tube nico_video pornhub pornotube red_tube tube8 veoh
|
22
22
|
you_porn you_tube your_file_host)
|
23
23
|
|
24
24
|
@@modules = MODULES_NAME.map do |name|
|
@@ -35,7 +35,7 @@ class TestVideoScraper < Test::Unit::TestCase
|
|
35
35
|
|
36
36
|
def test_scrape
|
37
37
|
vs = WWW::VideoScraper.scrape('http://www.yourfilehost.com/media.php?cat=video&file=XV436__03.wmv')
|
38
|
-
assert_kind_of WWW::VideoScraper::
|
38
|
+
assert_kind_of WWW::VideoScraper::YourFileHost, vs
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# -*- mode:ruby; coding:utf-8 -*-
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
4
|
+
|
5
|
+
class EicBook < Test::Unit::TestCase
|
6
|
+
def test_scrape
|
7
|
+
vs = WWW::VideoScraper::EicBook.scrape('http://www.eic-book.com/detail_12759.html', default_opt)
|
8
|
+
assert_equal 'http://www.eic-book.com/detail_12759.html', vs.page_url
|
9
|
+
assert_equal 'http://flv.idol-mile.com/book/12759.flv', vs.video_url
|
10
|
+
assert_equal 'http://www.eic-book.com/img/product/h4/pp_12759.jpg', vs.thumb_url
|
11
|
+
assert_equal '藤木あやか DVD 「お蔵入り寸前!藤木あやか A面」', vs.title
|
12
|
+
assert_equal 24, vs.capture_urls.count
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: valda-video_scraper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- YAMAGUCHI Seiji
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-02-10 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -50,10 +50,10 @@ files:
|
|
50
50
|
- test/www/video_scraper/test_dailymotion.rb
|
51
51
|
- test/www/video_scraper/test_age_sage.rb
|
52
52
|
- test/www/video_scraper/test_pornotube.rb
|
53
|
-
- test/www/video_scraper/test_your_file_host_flymake.rb
|
54
53
|
- test/www/video_scraper/test_tube8.rb
|
55
54
|
- test/www/video_scraper/test_your_file_host.rb
|
56
55
|
- test/www/video_scraper/test_moro_tube.rb
|
56
|
+
- test/www/video_scraper/test_eic_book.rb
|
57
57
|
- test/www/video_scraper/test_veoh.rb
|
58
58
|
- test/www/video_scraper/test_pornhub.rb
|
59
59
|
- test/www/video_scraper/test_nico_video.rb
|
@@ -63,12 +63,14 @@ files:
|
|
63
63
|
- test/www/video_scraper/test_red_tube.rb
|
64
64
|
- test/www/video_scraper/test_base.rb
|
65
65
|
- test/www/test_video_scraper.rb
|
66
|
+
- test/www/test_video_scraper_flymake.rb
|
66
67
|
- lib/www
|
67
68
|
- lib/www/video_scraper
|
68
69
|
- lib/www/video_scraper/nico_video.rb
|
69
70
|
- lib/www/video_scraper/you_porn.rb
|
70
71
|
- lib/www/video_scraper/ameba_vision.rb
|
71
72
|
- lib/www/video_scraper/age_sage.rb
|
73
|
+
- lib/www/video_scraper/eic_book.rb
|
72
74
|
- lib/www/video_scraper/pornotube.rb
|
73
75
|
- lib/www/video_scraper/adult_satellites.rb
|
74
76
|
- lib/www/video_scraper/you_tube.rb
|