bideo 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +84 -0
- data/Rakefile +2 -0
- data/bideo.gemspec +27 -0
- data/lib/bideo.rb +14 -0
- data/lib/bideo/client.rb +29 -0
- data/lib/bideo/music.rb +4 -0
- data/lib/bideo/version.rb +3 -0
- data/lib/bideo/video.rb +19 -0
- metadata +126 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 26b3192312581edf868efdea5eb7ee5d32c99eae
|
4
|
+
data.tar.gz: 4e9b833ba88e1cc977e937055d6ca91ad6a9b35b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d733c6cd59f23ba747abd5776a84cbeb7f4e5558ef4f7e9fd6e1e15b1cfc62416dd7dc82dd17b91b142e16cc9021fbe918a4c118c4a5f0c3fe5974f6f98d0241
|
7
|
+
data.tar.gz: 600031ea2d3a294c10912424bda649671c04644e8c91d07c2c3cd13308eca88c7e581a861d85bde9fd6ea4fd1dc329f8fef83d89cca19efe14e232445cbbf7e8
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Abraham Kuri
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# [Bideo](https://github.com/kurenn/bideo)
|
2
|
+
|
3
|
+
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/kurenn/bideo?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
4
|
+
|
5
|
+
Bideo is a super simple library to download videos from Youtube and transcode them into mp3.
|
6
|
+
|
7
|
+
|
8
|
+
## Table of contents
|
9
|
+
- [Quick start](#quick-start)
|
10
|
+
- [Using the gem](#using-the-gem)
|
11
|
+
- [Contributing](#contributing)
|
12
|
+
- [License](#license)
|
13
|
+
|
14
|
+
## Quick start
|
15
|
+
|
16
|
+
Install sabisu is extremely easy, but before you get started, you need to install one dependency:
|
17
|
+
|
18
|
+
### Using OSX
|
19
|
+
|
20
|
+
```console
|
21
|
+
$ brew install ffmpeg
|
22
|
+
```
|
23
|
+
|
24
|
+
### Using Linux
|
25
|
+
|
26
|
+
You can download the package in here [https://www.ffmpeg.org/download.html#build-linux](https://www.ffmpeg.org/download.html#build-linux)
|
27
|
+
|
28
|
+
*FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation.*
|
29
|
+
|
30
|
+
After having everything nice and running, you can just install the gem:
|
31
|
+
|
32
|
+
```console
|
33
|
+
$ gem install bideo
|
34
|
+
```
|
35
|
+
|
36
|
+
or add it to your `Gemfile`
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
gem 'bideo'
|
40
|
+
```
|
41
|
+
|
42
|
+
## Using the gem
|
43
|
+
|
44
|
+
The gem will help you download music or video files really easy, for example to download a video from youtube:
|
45
|
+
|
46
|
+
### Downloading & transcoding videos
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
movie = Bideo::Video.new("https://www.youtube.com/watch?v=z8AQQrbVTfQ")
|
50
|
+
movie.download("/Users/<yourusername>/Desktop")
|
51
|
+
```
|
52
|
+
|
53
|
+
That's it, but wait there is more, if you want to transcode the video to an mp3 format for example, just call the `transcode` method:
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
movie.transcode
|
57
|
+
```
|
58
|
+
|
59
|
+
**For videos you can add a playlist from youtube and it will download all the videos from the playlist. Same goes for the transcoding.**
|
60
|
+
|
61
|
+
The file will be transcoded on the same directory you downloaded the videos previously.
|
62
|
+
|
63
|
+
### Downloading music
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
music = Bideo::Music("http://a_url_for_music")
|
67
|
+
music.download("/Users/<yourusername>/Desktop")
|
68
|
+
```
|
69
|
+
|
70
|
+
And that is it.
|
71
|
+
|
72
|
+
|
73
|
+
## Contributing
|
74
|
+
|
75
|
+
Please submit all pull requests against a separate branch. Please follow the standard for naming the variables, mixins, etc.
|
76
|
+
|
77
|
+
In case you are wondering what to attack, we hnow have a milestone with the version to work, some fixes and refactors. Feel free to start one.
|
78
|
+
|
79
|
+
Thanks!
|
80
|
+
|
81
|
+
|
82
|
+
## Licenses
|
83
|
+
|
84
|
+
Code released under [the MIT license](LICENSE).
|
data/Rakefile
ADDED
data/bideo.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'bideo/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "bideo"
|
8
|
+
spec.version = Bideo::VERSION
|
9
|
+
spec.authors = ["Abraham Kuri"]
|
10
|
+
spec.email = ["kurenn@icalialabs.com"]
|
11
|
+
spec.summary = %q{A video and music downloader made in ruby}
|
12
|
+
spec.description = %q{A video and music downloader made in ruby}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "pry"
|
24
|
+
|
25
|
+
spec.add_dependency "streamio-ffmpeg", "1.0.0"
|
26
|
+
spec.add_dependency "viddl-rb", "1.1.1"
|
27
|
+
end
|
data/lib/bideo.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'pry'
|
2
|
+
require "bideo/version"
|
3
|
+
require 'securerandom'
|
4
|
+
require "bideo/client"
|
5
|
+
require "bideo/music"
|
6
|
+
require "bideo/video"
|
7
|
+
require "streamio-ffmpeg"
|
8
|
+
require "open-uri"
|
9
|
+
require "viddl-rb"
|
10
|
+
|
11
|
+
module Bideo
|
12
|
+
# Your code goes here...
|
13
|
+
end
|
14
|
+
|
data/lib/bideo/client.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
module Bideo
|
2
|
+
class Client
|
3
|
+
attr_reader :url, :download_urls, :session, :file_names, :save_directory
|
4
|
+
|
5
|
+
def initialize(url = "")
|
6
|
+
@session = SecureRandom.hex(8)
|
7
|
+
@file_names = ViddlRb.get_names(url)
|
8
|
+
@url = url
|
9
|
+
@download_urls = ViddlRb.get_urls_exts(url)
|
10
|
+
end
|
11
|
+
|
12
|
+
def download(path = "#{Dir.pwd}/tmp" )
|
13
|
+
@save_directory = "#{path}/#{self.session}"
|
14
|
+
|
15
|
+
urls_and_file_names = self.download_urls.zip(self.file_names)
|
16
|
+
Dir.mkdir(@save_directory)
|
17
|
+
|
18
|
+
urls_and_file_names.each do |download_url, file_name|
|
19
|
+
open("#{@save_directory}/#{file_name}", "wb") do |file|
|
20
|
+
open(download_url[:url]) do |uri|
|
21
|
+
file.write(uri.read)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
self
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/bideo/music.rb
ADDED
data/lib/bideo/video.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Bideo
|
2
|
+
class Video < Bideo::Client
|
3
|
+
|
4
|
+
def transcode(format = "mp3")
|
5
|
+
Dir.foreach(self.save_directory) do |item|
|
6
|
+
next if item == '.' or item == '..'
|
7
|
+
# do work on real items
|
8
|
+
puts item
|
9
|
+
|
10
|
+
movie = FFMPEG::Movie.new("#{self.save_directory}/#{item}")
|
11
|
+
|
12
|
+
item_name = item.split(".")[0]
|
13
|
+
movie.transcode("#{self.save_directory}/#{item_name}.#{format}")
|
14
|
+
end
|
15
|
+
|
16
|
+
self
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bideo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Abraham Kuri
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-03 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: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: streamio-ffmpeg
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.0.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.0.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: viddl-rb
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.1.1
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.1.1
|
83
|
+
description: A video and music downloader made in ruby
|
84
|
+
email:
|
85
|
+
- kurenn@icalialabs.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- Gemfile
|
92
|
+
- LICENSE.txt
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- bideo.gemspec
|
96
|
+
- lib/bideo.rb
|
97
|
+
- lib/bideo/client.rb
|
98
|
+
- lib/bideo/music.rb
|
99
|
+
- lib/bideo/version.rb
|
100
|
+
- lib/bideo/video.rb
|
101
|
+
homepage: ''
|
102
|
+
licenses:
|
103
|
+
- MIT
|
104
|
+
metadata: {}
|
105
|
+
post_install_message:
|
106
|
+
rdoc_options: []
|
107
|
+
require_paths:
|
108
|
+
- lib
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
requirements: []
|
120
|
+
rubyforge_project:
|
121
|
+
rubygems_version: 2.4.2
|
122
|
+
signing_key:
|
123
|
+
specification_version: 4
|
124
|
+
summary: A video and music downloader made in ruby
|
125
|
+
test_files: []
|
126
|
+
has_rdoc:
|