api-download 0.0.0

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