url_to_contents 0.0.3 → 0.0.5

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 ADDED
@@ -0,0 +1 @@
1
+ /pkg
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- url_to_contents (0.0.2)
4
+ url_to_contents (0.0.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -0,0 +1,7 @@
1
+ module UrlToContents
2
+ module Models
3
+ module BaseAttributes
4
+ attr_accessor :author, :content, :date, :title, :media, :source_url
5
+ end
6
+ end
7
+ end
@@ -1,7 +1,7 @@
1
1
  module UrlToContents
2
2
  module Models
3
3
  class Tudou
4
- attr_accessor :author, :content, :date
4
+ include UrlToContents::Models::BaseAttributes
5
5
  end
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
1
  module UrlToContents
2
2
  module Models
3
3
  class Weibo
4
- attr_accessor :author, :content, :date
4
+ include UrlToContents::Models::BaseAttributes
5
5
  end
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
1
  module UrlToContents
2
2
  module Models
3
3
  class Youku
4
- attr_accessor :author, :content, :date
4
+ include UrlToContents::Models::BaseAttributes
5
5
  end
6
6
  end
7
7
  end
@@ -13,8 +13,10 @@ module UrlToContents
13
13
 
14
14
  def youku
15
15
  youku = UrlToContents::Models::Youku.new
16
+ youku.title = @doc.css('.title a').text
17
+ youku.content = @doc.css('.body #long2 .item')[0].text
16
18
  @doc.css('#panel_share > .panel_con > .p1 > .item').each do |u|
17
- youku.content = u.xpath('input').attr('value').value if u.css('.label').children.text == "flash地址: "
19
+ youku.media = u.xpath('input').attr('value').value if u.css('.label').children.text == "flash地址: "
18
20
  end
19
21
  return youku
20
22
  end
@@ -29,6 +31,10 @@ module UrlToContents
29
31
 
30
32
  def todou
31
33
  end
34
+
35
+ def Invalid_url
36
+ return nil
37
+ end
32
38
  end
33
39
 
34
40
  end
@@ -22,6 +22,7 @@ module UrlToContents
22
22
  return Youku if url.include?('v.youku.com')
23
23
  return Weibo if (url.include?('weibo.com')|| url.include?('weibo.cn'))
24
24
  return Tudou if url.include?('tudou.com')
25
+ return Invalid_url
25
26
  end
26
27
 
27
28
  def parse
@@ -1,3 +1,3 @@
1
1
  module UrlToContents
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -1,9 +1,11 @@
1
1
  require "url_to_contents/version"
2
+ require "url_to_contents/models/base_attributes"
2
3
  require "url_to_contents/site"
3
4
  require "url_to_contents/url"
4
5
  require "url_to_contents/parser"
5
6
 
6
7
 
8
+
7
9
  module UrlToContents
8
10
  # Your code goes here...
9
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: url_to_contents
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -18,12 +18,14 @@ executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
+ - .gitignore
21
22
  - Gemfile
22
23
  - Gemfile.lock
23
24
  - LICENSE.txt
24
25
  - README.md
25
26
  - Rakefile
26
27
  - lib/url_to_contents.rb
28
+ - lib/url_to_contents/models/base_attributes.rb
27
29
  - lib/url_to_contents/models/tudou.rb
28
30
  - lib/url_to_contents/models/weibo.rb
29
31
  - lib/url_to_contents/models/youku.rb