zing-download 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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f8177dbd1fc4941b4cc5a6d5f59710faf5eb16cf
4
+ data.tar.gz: b8a0b6b8130d48daf4012e650f740bbe44b8efe8
5
+ SHA512:
6
+ metadata.gz: 9df52612df678d08c0616bd679ab954d045d1c9f56cac4eb5667a7e0778ff662e1383350f3ebf2ae62bc362d801fdecfa8926c858e5480f0aff282e891dd39dc
7
+ data.tar.gz: 430d1fd96f32a59854b4435c8bca92ffa9f079ca3af00311e5e171b4c7cf6924695b986bec7603a85cef8829c994590e9a3f7408776096c822d2dde20d7b897e
@@ -0,0 +1,14 @@
1
+ require 'download/api_mp3'
2
+
3
+ class Download
4
+
5
+ def self.get_link_down(link)
6
+ if(link =~ /http:\/\/mp3.zing.vn\/bai\-hat\/(.*?).html/)
7
+ @mp3 = Mp3.new(link)
8
+ source = @mp3.get_link_down
9
+ else
10
+ source = "Failed to load source !"
11
+ end
12
+ source
13
+ end
14
+ end
@@ -0,0 +1,21 @@
1
+ require 'open-uri'
2
+ require './api_download'
3
+ class Download::Mp3
4
+
5
+ def initialize(link)
6
+ @link = link
7
+ end
8
+ def get_link_down
9
+ html = open(@link).read
10
+ xml_link = html.match(/http:\/\/mp3.zing.vn\/xml\/song\-xml\/(.*?)\"/).to_s
11
+ xml_link = xml_link.gsub!('"',"")
12
+ source_xml = open(xml_link).read
13
+ source_xml = source_xml.gsub("<![CDATA[","")
14
+ source_xml = source_xml.gsub("]]>","")
15
+ #source = XmlSimple.xml_in(source_xml)
16
+ #source = Hash.from_xml(source_xml).to_json
17
+ source = source_xml.match(/http:\/\/mp3.zing.vn\/xml\/load-song\/(.*?)\</).to_s
18
+ source = source.gsub!("<","")
19
+ return source
20
+ end
21
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zing-download
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - TuanDH
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-04-07 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A simple hello world gem
14
+ email: tuandh@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/api_download.rb
20
+ - lib/download/api_mp3.rb
21
+ homepage: http://rubygems.org/gems/hola
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 2.5.1
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: Hola!
45
+ test_files: []