livehouse_get 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/bin/livehouse_get +39 -0
  3. metadata +73 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3d1dff573404d029e4a7f34ba323a4a9a85d196b
4
+ data.tar.gz: 3bfbe2bd2b97ff149678d04f25e0cda8f291a3e5
5
+ SHA512:
6
+ metadata.gz: e2654ee1824bb8c20d01068b3128e1aedc0eb573f20331e21f245d95b0b26d8cbaf5146a19887ea8bb9bdb90e2133051894ff729439c75bf3e22c8282f177331
7
+ data.tar.gz: 1eb765b140b158ed6ff8aea888951e54a0a68a9e8959636c355189921f53b88553242c0c53bf7c27a75fc002247d0cf4992f926b0f5762e1003333c760549a24
data/bin/livehouse_get ADDED
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env ruby
2
+ require 'net/http'
3
+ require 'tempfile'
4
+
5
+ if ARGV.empty?
6
+ puts 'Usage: livehouse_get [URL]'
7
+ exit
8
+ end
9
+
10
+ body = Net::HTTP.get URI(ARGV.first)
11
+ body.match /(https:\/\/vod-sl\.livehouse\.in\/[^\/]+\/[^\/]+\/(\d{10})[^\/]+\/)playlist\.m3u8/
12
+ base_uri, id = $1, $2
13
+ chunklist_uri = URI($&.sub('playlist.m3u8', "#{id}record_chunklist.m3u8"))
14
+ chunklist = Net::HTTP.get(chunklist_uri).scan(/^.+\.ts$/)
15
+ queue = Queue.new
16
+ threads = []
17
+
18
+ chunklist.each{ |name| queue << URI("#{base_uri}#{name}") }
19
+
20
+ Dir.mktmpdir do |dir|
21
+ 5.times do
22
+ threads << Thread.new do
23
+ until queue.empty? do
24
+ chunk_uri = queue.pop
25
+ path = File.join(dir, File.basename(chunk_uri.to_s))
26
+ IO.write path, Net::HTTP.get(chunk_uri), mode: 'wb'
27
+ print :'.'
28
+ end
29
+ end
30
+ end
31
+ threads.each(&:join)
32
+ download_path = File.absolute_path("#{id}.ts")
33
+ File.open download_path, 'wb' do |f|
34
+ Dir[File.join(dir, '*')].sort!.each do |path|
35
+ f.write IO.read(path)
36
+ end
37
+ end
38
+ puts "\nFile saved to #{download_path}"
39
+ end
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: livehouse_get
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jian Weihang
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-09-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: livehouse video downloader
42
+ email: tonytonyjan@gmail.com
43
+ executables:
44
+ - livehouse_get
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - bin/livehouse_get
49
+ homepage: https://github.com/tonytonyjan/livehouse_get
50
+ licenses:
51
+ - MIT
52
+ metadata: {}
53
+ post_install_message:
54
+ rdoc_options: []
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ requirements: []
68
+ rubyforge_project:
69
+ rubygems_version: 2.4.5.1
70
+ signing_key:
71
+ specification_version: 4
72
+ summary: livehouse video downloader
73
+ test_files: []