ytsongdw 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.codeclimate.yml +18 -0
- data/.rspec +2 -0
- data/.rubocop.yml +7 -0
- data/.ruby-version +1 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +114 -0
- data/LICENSE.txt +339 -0
- data/README.md +30 -0
- data/Rakefile +52 -0
- data/VERSION +1 -0
- data/bin/ytsongdw +5 -0
- data/lib/counter.rb +4 -0
- data/lib/downloader.rb +17 -0
- data/lib/file_settings.rb +19 -0
- data/lib/playlist_downloader.rb +38 -0
- data/lib/simple_logger.rb +68 -0
- data/lib/song_downloader.rb +39 -0
- data/lib/youtube_song_downloader.rb +42 -0
- data/lib/ytsongdw.rb +12 -0
- data/songs.txt +8 -0
- data/spec/spec_helper.rb +5 -0
- data/spec/test.txt +2 -0
- data/spec/youtube_song_downloader_spec.rb +79 -0
- data/ytsongdw.gemspec +93 -0
- metadata +211 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8ab228562ac323a9d6e70a336c5b5ef34df68a30
|
4
|
+
data.tar.gz: 244f76a3de9beb69e63a6bdbd3bea45faf5f8004
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f31e3e0370d6c7c23bb83fb2746931b196419b3fd928536df1162f9e07dfaf27adfc0f80dde5e7f306023479c55c65cb73d23b334bc7289b32c05776f25249c3
|
7
|
+
data.tar.gz: 5641061a41f573a9553147b07a2bd29a85d0399c16dc46aaf94798f98563e8fb42d5e5c58878fd9be4d8a8a661cab5f747af2df02dd045a2708a559b6d60cf0d
|
data/.codeclimate.yml
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.1
|
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'memoist', '~> 0'
|
4
|
+
gem 'nokogiri', '~> 1.6'
|
5
|
+
gem 'scrapifier', '~> 0'
|
6
|
+
gem 'youtube-dl.rb', '~> 0'
|
7
|
+
|
8
|
+
group :development, :test do
|
9
|
+
gem 'codeclimate-test-reporter', '~> 1.0'
|
10
|
+
gem 'pry', '~> 0'
|
11
|
+
gem 'rdoc', '~> 3.12'
|
12
|
+
gem 'rspec', '~> 3.0'
|
13
|
+
gem 'simplecov', '~> 0', require: false
|
14
|
+
gem 'juwelier', '~> 2.1'
|
15
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (5.0.1)
|
5
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
6
|
+
i18n (~> 0.7)
|
7
|
+
minitest (~> 5.1)
|
8
|
+
tzinfo (~> 1.1)
|
9
|
+
addressable (2.4.0)
|
10
|
+
builder (3.2.2)
|
11
|
+
climate_control (0.0.3)
|
12
|
+
activesupport (>= 3.0)
|
13
|
+
cocaine (0.5.8)
|
14
|
+
climate_control (>= 0.0.3, < 1.0)
|
15
|
+
codeclimate-test-reporter (1.0.4)
|
16
|
+
simplecov
|
17
|
+
coderay (1.1.1)
|
18
|
+
concurrent-ruby (1.0.4)
|
19
|
+
descendants_tracker (0.0.4)
|
20
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
21
|
+
diff-lcs (1.2.5)
|
22
|
+
docile (1.1.5)
|
23
|
+
faraday (0.9.2)
|
24
|
+
multipart-post (>= 1.2, < 3)
|
25
|
+
git (1.3.0)
|
26
|
+
github_api (0.14.5)
|
27
|
+
addressable (~> 2.4.0)
|
28
|
+
descendants_tracker (~> 0.0.4)
|
29
|
+
faraday (~> 0.8, < 0.10)
|
30
|
+
hashie (>= 3.4)
|
31
|
+
oauth2 (~> 1.0)
|
32
|
+
hashie (3.4.6)
|
33
|
+
highline (1.7.8)
|
34
|
+
i18n (0.7.0)
|
35
|
+
json (1.8.3)
|
36
|
+
juwelier (2.1.3)
|
37
|
+
builder
|
38
|
+
bundler (>= 1.13)
|
39
|
+
git (>= 1.2.5)
|
40
|
+
github_api
|
41
|
+
highline (>= 1.6.15)
|
42
|
+
nokogiri (>= 1.5.10)
|
43
|
+
rake
|
44
|
+
rdoc
|
45
|
+
semver
|
46
|
+
jwt (1.5.6)
|
47
|
+
memoist (0.15.0)
|
48
|
+
method_source (0.8.2)
|
49
|
+
mini_portile2 (2.1.0)
|
50
|
+
minitest (5.10.1)
|
51
|
+
multi_json (1.12.1)
|
52
|
+
multi_xml (0.6.0)
|
53
|
+
multipart-post (2.0.0)
|
54
|
+
nokogiri (1.7.0.1)
|
55
|
+
mini_portile2 (~> 2.1.0)
|
56
|
+
oauth2 (1.3.0)
|
57
|
+
faraday (>= 0.8, < 0.11)
|
58
|
+
jwt (~> 1.0)
|
59
|
+
multi_json (~> 1.3)
|
60
|
+
multi_xml (~> 0.5)
|
61
|
+
rack (>= 1.2, < 3)
|
62
|
+
pry (0.10.4)
|
63
|
+
coderay (~> 1.1.0)
|
64
|
+
method_source (~> 0.8.1)
|
65
|
+
slop (~> 3.4)
|
66
|
+
rack (2.0.1)
|
67
|
+
rake (12.0.0)
|
68
|
+
rdoc (3.12.2)
|
69
|
+
json (~> 1.4)
|
70
|
+
rspec (3.5.0)
|
71
|
+
rspec-core (~> 3.5.0)
|
72
|
+
rspec-expectations (~> 3.5.0)
|
73
|
+
rspec-mocks (~> 3.5.0)
|
74
|
+
rspec-core (3.5.4)
|
75
|
+
rspec-support (~> 3.5.0)
|
76
|
+
rspec-expectations (3.5.0)
|
77
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
78
|
+
rspec-support (~> 3.5.0)
|
79
|
+
rspec-mocks (3.5.0)
|
80
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
81
|
+
rspec-support (~> 3.5.0)
|
82
|
+
rspec-support (3.5.0)
|
83
|
+
scrapifier (0.0.6)
|
84
|
+
nokogiri (~> 1.6)
|
85
|
+
semver (1.0.1)
|
86
|
+
simplecov (0.12.0)
|
87
|
+
docile (~> 1.1.0)
|
88
|
+
json (>= 1.8, < 3)
|
89
|
+
simplecov-html (~> 0.10.0)
|
90
|
+
simplecov-html (0.10.0)
|
91
|
+
slop (3.6.0)
|
92
|
+
thread_safe (0.3.5)
|
93
|
+
tzinfo (1.2.2)
|
94
|
+
thread_safe (~> 0.1)
|
95
|
+
youtube-dl.rb (0.3.1.2016.09.11.1)
|
96
|
+
cocaine (>= 0.5.4)
|
97
|
+
|
98
|
+
PLATFORMS
|
99
|
+
ruby
|
100
|
+
|
101
|
+
DEPENDENCIES
|
102
|
+
codeclimate-test-reporter (~> 1.0)
|
103
|
+
juwelier (~> 2.1)
|
104
|
+
memoist (~> 0)
|
105
|
+
nokogiri (~> 1.6)
|
106
|
+
pry (~> 0)
|
107
|
+
rdoc (~> 3.12)
|
108
|
+
rspec (~> 3.0)
|
109
|
+
scrapifier (~> 0)
|
110
|
+
simplecov (~> 0)
|
111
|
+
youtube-dl.rb (~> 0)
|
112
|
+
|
113
|
+
BUNDLED WITH
|
114
|
+
1.13.6
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,339 @@
|
|
1
|
+
GNU GENERAL PUBLIC LICENSE
|
2
|
+
Version 2, June 1991
|
3
|
+
|
4
|
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
5
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
6
|
+
Everyone is permitted to copy and distribute verbatim copies
|
7
|
+
of this license document, but changing it is not allowed.
|
8
|
+
|
9
|
+
Preamble
|
10
|
+
|
11
|
+
The licenses for most software are designed to take away your
|
12
|
+
freedom to share and change it. By contrast, the GNU General Public
|
13
|
+
License is intended to guarantee your freedom to share and change free
|
14
|
+
software--to make sure the software is free for all its users. This
|
15
|
+
General Public License applies to most of the Free Software
|
16
|
+
Foundation's software and to any other program whose authors commit to
|
17
|
+
using it. (Some other Free Software Foundation software is covered by
|
18
|
+
the GNU Lesser General Public License instead.) You can apply it to
|
19
|
+
your programs, too.
|
20
|
+
|
21
|
+
When we speak of free software, we are referring to freedom, not
|
22
|
+
price. Our General Public Licenses are designed to make sure that you
|
23
|
+
have the freedom to distribute copies of free software (and charge for
|
24
|
+
this service if you wish), that you receive source code or can get it
|
25
|
+
if you want it, that you can change the software or use pieces of it
|
26
|
+
in new free programs; and that you know you can do these things.
|
27
|
+
|
28
|
+
To protect your rights, we need to make restrictions that forbid
|
29
|
+
anyone to deny you these rights or to ask you to surrender the rights.
|
30
|
+
These restrictions translate to certain responsibilities for you if you
|
31
|
+
distribute copies of the software, or if you modify it.
|
32
|
+
|
33
|
+
For example, if you distribute copies of such a program, whether
|
34
|
+
gratis or for a fee, you must give the recipients all the rights that
|
35
|
+
you have. You must make sure that they, too, receive or can get the
|
36
|
+
source code. And you must show them these terms so they know their
|
37
|
+
rights.
|
38
|
+
|
39
|
+
We protect your rights with two steps: (1) copyright the software, and
|
40
|
+
(2) offer you this license which gives you legal permission to copy,
|
41
|
+
distribute and/or modify the software.
|
42
|
+
|
43
|
+
Also, for each author's protection and ours, we want to make certain
|
44
|
+
that everyone understands that there is no warranty for this free
|
45
|
+
software. If the software is modified by someone else and passed on, we
|
46
|
+
want its recipients to know that what they have is not the original, so
|
47
|
+
that any problems introduced by others will not reflect on the original
|
48
|
+
authors' reputations.
|
49
|
+
|
50
|
+
Finally, any free program is threatened constantly by software
|
51
|
+
patents. We wish to avoid the danger that redistributors of a free
|
52
|
+
program will individually obtain patent licenses, in effect making the
|
53
|
+
program proprietary. To prevent this, we have made it clear that any
|
54
|
+
patent must be licensed for everyone's free use or not licensed at all.
|
55
|
+
|
56
|
+
The precise terms and conditions for copying, distribution and
|
57
|
+
modification follow.
|
58
|
+
|
59
|
+
GNU GENERAL PUBLIC LICENSE
|
60
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
61
|
+
|
62
|
+
0. This License applies to any program or other work which contains
|
63
|
+
a notice placed by the copyright holder saying it may be distributed
|
64
|
+
under the terms of this General Public License. The "Program", below,
|
65
|
+
refers to any such program or work, and a "work based on the Program"
|
66
|
+
means either the Program or any derivative work under copyright law:
|
67
|
+
that is to say, a work containing the Program or a portion of it,
|
68
|
+
either verbatim or with modifications and/or translated into another
|
69
|
+
language. (Hereinafter, translation is included without limitation in
|
70
|
+
the term "modification".) Each licensee is addressed as "you".
|
71
|
+
|
72
|
+
Activities other than copying, distribution and modification are not
|
73
|
+
covered by this License; they are outside its scope. The act of
|
74
|
+
running the Program is not restricted, and the output from the Program
|
75
|
+
is covered only if its contents constitute a work based on the
|
76
|
+
Program (independent of having been made by running the Program).
|
77
|
+
Whether that is true depends on what the Program does.
|
78
|
+
|
79
|
+
1. You may copy and distribute verbatim copies of the Program's
|
80
|
+
source code as you receive it, in any medium, provided that you
|
81
|
+
conspicuously and appropriately publish on each copy an appropriate
|
82
|
+
copyright notice and disclaimer of warranty; keep intact all the
|
83
|
+
notices that refer to this License and to the absence of any warranty;
|
84
|
+
and give any other recipients of the Program a copy of this License
|
85
|
+
along with the Program.
|
86
|
+
|
87
|
+
You may charge a fee for the physical act of transferring a copy, and
|
88
|
+
you may at your option offer warranty protection in exchange for a fee.
|
89
|
+
|
90
|
+
2. You may modify your copy or copies of the Program or any portion
|
91
|
+
of it, thus forming a work based on the Program, and copy and
|
92
|
+
distribute such modifications or work under the terms of Section 1
|
93
|
+
above, provided that you also meet all of these conditions:
|
94
|
+
|
95
|
+
a) You must cause the modified files to carry prominent notices
|
96
|
+
stating that you changed the files and the date of any change.
|
97
|
+
|
98
|
+
b) You must cause any work that you distribute or publish, that in
|
99
|
+
whole or in part contains or is derived from the Program or any
|
100
|
+
part thereof, to be licensed as a whole at no charge to all third
|
101
|
+
parties under the terms of this License.
|
102
|
+
|
103
|
+
c) If the modified program normally reads commands interactively
|
104
|
+
when run, you must cause it, when started running for such
|
105
|
+
interactive use in the most ordinary way, to print or display an
|
106
|
+
announcement including an appropriate copyright notice and a
|
107
|
+
notice that there is no warranty (or else, saying that you provide
|
108
|
+
a warranty) and that users may redistribute the program under
|
109
|
+
these conditions, and telling the user how to view a copy of this
|
110
|
+
License. (Exception: if the Program itself is interactive but
|
111
|
+
does not normally print such an announcement, your work based on
|
112
|
+
the Program is not required to print an announcement.)
|
113
|
+
|
114
|
+
These requirements apply to the modified work as a whole. If
|
115
|
+
identifiable sections of that work are not derived from the Program,
|
116
|
+
and can be reasonably considered independent and separate works in
|
117
|
+
themselves, then this License, and its terms, do not apply to those
|
118
|
+
sections when you distribute them as separate works. But when you
|
119
|
+
distribute the same sections as part of a whole which is a work based
|
120
|
+
on the Program, the distribution of the whole must be on the terms of
|
121
|
+
this License, whose permissions for other licensees extend to the
|
122
|
+
entire whole, and thus to each and every part regardless of who wrote it.
|
123
|
+
|
124
|
+
Thus, it is not the intent of this section to claim rights or contest
|
125
|
+
your rights to work written entirely by you; rather, the intent is to
|
126
|
+
exercise the right to control the distribution of derivative or
|
127
|
+
collective works based on the Program.
|
128
|
+
|
129
|
+
In addition, mere aggregation of another work not based on the Program
|
130
|
+
with the Program (or with a work based on the Program) on a volume of
|
131
|
+
a storage or distribution medium does not bring the other work under
|
132
|
+
the scope of this License.
|
133
|
+
|
134
|
+
3. You may copy and distribute the Program (or a work based on it,
|
135
|
+
under Section 2) in object code or executable form under the terms of
|
136
|
+
Sections 1 and 2 above provided that you also do one of the following:
|
137
|
+
|
138
|
+
a) Accompany it with the complete corresponding machine-readable
|
139
|
+
source code, which must be distributed under the terms of Sections
|
140
|
+
1 and 2 above on a medium customarily used for software interchange; or,
|
141
|
+
|
142
|
+
b) Accompany it with a written offer, valid for at least three
|
143
|
+
years, to give any third party, for a charge no more than your
|
144
|
+
cost of physically performing source distribution, a complete
|
145
|
+
machine-readable copy of the corresponding source code, to be
|
146
|
+
distributed under the terms of Sections 1 and 2 above on a medium
|
147
|
+
customarily used for software interchange; or,
|
148
|
+
|
149
|
+
c) Accompany it with the information you received as to the offer
|
150
|
+
to distribute corresponding source code. (This alternative is
|
151
|
+
allowed only for noncommercial distribution and only if you
|
152
|
+
received the program in object code or executable form with such
|
153
|
+
an offer, in accord with Subsection b above.)
|
154
|
+
|
155
|
+
The source code for a work means the preferred form of the work for
|
156
|
+
making modifications to it. For an executable work, complete source
|
157
|
+
code means all the source code for all modules it contains, plus any
|
158
|
+
associated interface definition files, plus the scripts used to
|
159
|
+
control compilation and installation of the executable. However, as a
|
160
|
+
special exception, the source code distributed need not include
|
161
|
+
anything that is normally distributed (in either source or binary
|
162
|
+
form) with the major components (compiler, kernel, and so on) of the
|
163
|
+
operating system on which the executable runs, unless that component
|
164
|
+
itself accompanies the executable.
|
165
|
+
|
166
|
+
If distribution of executable or object code is made by offering
|
167
|
+
access to copy from a designated place, then offering equivalent
|
168
|
+
access to copy the source code from the same place counts as
|
169
|
+
distribution of the source code, even though third parties are not
|
170
|
+
compelled to copy the source along with the object code.
|
171
|
+
|
172
|
+
4. You may not copy, modify, sublicense, or distribute the Program
|
173
|
+
except as expressly provided under this License. Any attempt
|
174
|
+
otherwise to copy, modify, sublicense or distribute the Program is
|
175
|
+
void, and will automatically terminate your rights under this License.
|
176
|
+
However, parties who have received copies, or rights, from you under
|
177
|
+
this License will not have their licenses terminated so long as such
|
178
|
+
parties remain in full compliance.
|
179
|
+
|
180
|
+
5. You are not required to accept this License, since you have not
|
181
|
+
signed it. However, nothing else grants you permission to modify or
|
182
|
+
distribute the Program or its derivative works. These actions are
|
183
|
+
prohibited by law if you do not accept this License. Therefore, by
|
184
|
+
modifying or distributing the Program (or any work based on the
|
185
|
+
Program), you indicate your acceptance of this License to do so, and
|
186
|
+
all its terms and conditions for copying, distributing or modifying
|
187
|
+
the Program or works based on it.
|
188
|
+
|
189
|
+
6. Each time you redistribute the Program (or any work based on the
|
190
|
+
Program), the recipient automatically receives a license from the
|
191
|
+
original licensor to copy, distribute or modify the Program subject to
|
192
|
+
these terms and conditions. You may not impose any further
|
193
|
+
restrictions on the recipients' exercise of the rights granted herein.
|
194
|
+
You are not responsible for enforcing compliance by third parties to
|
195
|
+
this License.
|
196
|
+
|
197
|
+
7. If, as a consequence of a court judgment or allegation of patent
|
198
|
+
infringement or for any other reason (not limited to patent issues),
|
199
|
+
conditions are imposed on you (whether by court order, agreement or
|
200
|
+
otherwise) that contradict the conditions of this License, they do not
|
201
|
+
excuse you from the conditions of this License. If you cannot
|
202
|
+
distribute so as to satisfy simultaneously your obligations under this
|
203
|
+
License and any other pertinent obligations, then as a consequence you
|
204
|
+
may not distribute the Program at all. For example, if a patent
|
205
|
+
license would not permit royalty-free redistribution of the Program by
|
206
|
+
all those who receive copies directly or indirectly through you, then
|
207
|
+
the only way you could satisfy both it and this License would be to
|
208
|
+
refrain entirely from distribution of the Program.
|
209
|
+
|
210
|
+
If any portion of this section is held invalid or unenforceable under
|
211
|
+
any particular circumstance, the balance of the section is intended to
|
212
|
+
apply and the section as a whole is intended to apply in other
|
213
|
+
circumstances.
|
214
|
+
|
215
|
+
It is not the purpose of this section to induce you to infringe any
|
216
|
+
patents or other property right claims or to contest validity of any
|
217
|
+
such claims; this section has the sole purpose of protecting the
|
218
|
+
integrity of the free software distribution system, which is
|
219
|
+
implemented by public license practices. Many people have made
|
220
|
+
generous contributions to the wide range of software distributed
|
221
|
+
through that system in reliance on consistent application of that
|
222
|
+
system; it is up to the author/donor to decide if he or she is willing
|
223
|
+
to distribute software through any other system and a licensee cannot
|
224
|
+
impose that choice.
|
225
|
+
|
226
|
+
This section is intended to make thoroughly clear what is believed to
|
227
|
+
be a consequence of the rest of this License.
|
228
|
+
|
229
|
+
8. If the distribution and/or use of the Program is restricted in
|
230
|
+
certain countries either by patents or by copyrighted interfaces, the
|
231
|
+
original copyright holder who places the Program under this License
|
232
|
+
may add an explicit geographical distribution limitation excluding
|
233
|
+
those countries, so that distribution is permitted only in or among
|
234
|
+
countries not thus excluded. In such case, this License incorporates
|
235
|
+
the limitation as if written in the body of this License.
|
236
|
+
|
237
|
+
9. The Free Software Foundation may publish revised and/or new versions
|
238
|
+
of the General Public License from time to time. Such new versions will
|
239
|
+
be similar in spirit to the present version, but may differ in detail to
|
240
|
+
address new problems or concerns.
|
241
|
+
|
242
|
+
Each version is given a distinguishing version number. If the Program
|
243
|
+
specifies a version number of this License which applies to it and "any
|
244
|
+
later version", you have the option of following the terms and conditions
|
245
|
+
either of that version or of any later version published by the Free
|
246
|
+
Software Foundation. If the Program does not specify a version number of
|
247
|
+
this License, you may choose any version ever published by the Free Software
|
248
|
+
Foundation.
|
249
|
+
|
250
|
+
10. If you wish to incorporate parts of the Program into other free
|
251
|
+
programs whose distribution conditions are different, write to the author
|
252
|
+
to ask for permission. For software which is copyrighted by the Free
|
253
|
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
254
|
+
make exceptions for this. Our decision will be guided by the two goals
|
255
|
+
of preserving the free status of all derivatives of our free software and
|
256
|
+
of promoting the sharing and reuse of software generally.
|
257
|
+
|
258
|
+
NO WARRANTY
|
259
|
+
|
260
|
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
261
|
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
262
|
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
263
|
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
264
|
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
265
|
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
266
|
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
267
|
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
268
|
+
REPAIR OR CORRECTION.
|
269
|
+
|
270
|
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
271
|
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
272
|
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
273
|
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
274
|
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
275
|
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
276
|
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
277
|
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
278
|
+
POSSIBILITY OF SUCH DAMAGES.
|
279
|
+
|
280
|
+
END OF TERMS AND CONDITIONS
|
281
|
+
|
282
|
+
How to Apply These Terms to Your New Programs
|
283
|
+
|
284
|
+
If you develop a new program, and you want it to be of the greatest
|
285
|
+
possible use to the public, the best way to achieve this is to make it
|
286
|
+
free software which everyone can redistribute and change under these terms.
|
287
|
+
|
288
|
+
To do so, attach the following notices to the program. It is safest
|
289
|
+
to attach them to the start of each source file to most effectively
|
290
|
+
convey the exclusion of warranty; and each file should have at least
|
291
|
+
the "copyright" line and a pointer to where the full notice is found.
|
292
|
+
|
293
|
+
<one line to give the program's name and a brief idea of what it does.>
|
294
|
+
Copyright (C) <year> <name of author>
|
295
|
+
|
296
|
+
This program is free software; you can redistribute it and/or modify
|
297
|
+
it under the terms of the GNU General Public License as published by
|
298
|
+
the Free Software Foundation; either version 2 of the License, or
|
299
|
+
(at your option) any later version.
|
300
|
+
|
301
|
+
This program is distributed in the hope that it will be useful,
|
302
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
303
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
304
|
+
GNU General Public License for more details.
|
305
|
+
|
306
|
+
You should have received a copy of the GNU General Public License along
|
307
|
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
308
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
309
|
+
|
310
|
+
Also add information on how to contact you by electronic and paper mail.
|
311
|
+
|
312
|
+
If the program is interactive, make it output a short notice like this
|
313
|
+
when it starts in an interactive mode:
|
314
|
+
|
315
|
+
Gnomovision version 69, Copyright (C) year name of author
|
316
|
+
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
317
|
+
This is free software, and you are welcome to redistribute it
|
318
|
+
under certain conditions; type `show c' for details.
|
319
|
+
|
320
|
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
321
|
+
parts of the General Public License. Of course, the commands you use may
|
322
|
+
be called something other than `show w' and `show c'; they could even be
|
323
|
+
mouse-clicks or menu items--whatever suits your program.
|
324
|
+
|
325
|
+
You should also get your employer (if you work as a programmer) or your
|
326
|
+
school, if any, to sign a "copyright disclaimer" for the program, if
|
327
|
+
necessary. Here is a sample; alter the names:
|
328
|
+
|
329
|
+
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
330
|
+
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
331
|
+
|
332
|
+
<signature of Ty Coon>, 1 April 1989
|
333
|
+
Ty Coon, President of Vice
|
334
|
+
|
335
|
+
This General Public License does not permit incorporating your program into
|
336
|
+
proprietary programs. If your program is a subroutine library, you may
|
337
|
+
consider it more useful to permit linking proprietary applications with the
|
338
|
+
library. If this is what you want to do, use the GNU Lesser General
|
339
|
+
Public License instead of this License.
|
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
[![Code Climate](https://codeclimate.com/github/heavenstudio/ytsongdw/badges/gpa.svg)](https://codeclimate.com/github/heavenstudio/ytsongdw)
|
2
|
+
|
3
|
+
[![Test Coverage](https://codeclimate.com/github/heavenstudio/ytsongdw/badges/coverage.svg)](https://codeclimate.com/github/heavenstudio/ytsongdw/coverage)
|
4
|
+
|
5
|
+
##
|
6
|
+
|
7
|
+
A rubygem to download the audio stream of any kind of youtube video without constraint.
|
8
|
+
It will bypass copyright restrictions, VEVO accounts...
|
9
|
+
|
10
|
+
## Install
|
11
|
+
gem install ytsongdw
|
12
|
+
|
13
|
+
## Commands
|
14
|
+
Download a song by name into folder '~/Music/'<br/>
|
15
|
+
`ytsongdw 'Titanic Song'`<br/>
|
16
|
+
Download from a youtube link into folder '~/songs/'<br/>
|
17
|
+
`ytsongdw https://www.youtube.com/watch?v=bM7SZ5SBzyY ~/songs/`<br/>
|
18
|
+
<br/>
|
19
|
+
Download all songs in a youtube playlist<br/>
|
20
|
+
`ytsongdw https://www.youtube.com/playlist?list=PL9B23A78D3D249A74`<br/>
|
21
|
+
Download multiple songs from a file containing several youtube urls, song names or playlist urls (one per line). Basically all the above options in a `.txt` file<br/>
|
22
|
+
`ytsongdw songs.txt`<br/>
|
23
|
+
<br/>
|
24
|
+
By default all the .m4a files will be stored into the folder named "~/Music/" (will be created if it doesn't exist). You can change the folder name by passing a second argument to the command line as shown in the second example above. DO NOT FORGET the endind '/' on the folder name, or else it will be treated as a filename prefix instead of a folder path.
|
25
|
+
|
26
|
+
## Original Author
|
27
|
+
Based on https://github.com/ggouzi/Youtube-Download-Songs, only changed it to download songs by name, in m4a format and supporting playlists.
|
28
|
+
|
29
|
+
## Licence
|
30
|
+
This project is licensed under the GNU GPL v2. See GPL.txt for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts 'Run `bundle install` to install missing gems'
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'juwelier'
|
15
|
+
Juwelier::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
17
|
+
gem.name = 'ytsongdw'
|
18
|
+
gem.homepage = 'http://github.com/heavenstudio/ytsongdw'
|
19
|
+
gem.license = 'GPL-2.0'
|
20
|
+
gem.summary = %(Gem to download songs from youtube videos)
|
21
|
+
gem.description = %(Supports youtube urls, playlists and fulltext search)
|
22
|
+
gem.email = 'stefano@heavenstudio.com.br'
|
23
|
+
gem.authors = %w(teonimesic ggouzi)
|
24
|
+
gem.required_ruby_version = '>= 2.0'
|
25
|
+
|
26
|
+
# dependencies defined in Gemfile
|
27
|
+
end
|
28
|
+
Juwelier::RubygemsDotOrgTasks.new
|
29
|
+
|
30
|
+
require 'rspec/core'
|
31
|
+
require 'rspec/core/rake_task'
|
32
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
33
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
34
|
+
end
|
35
|
+
|
36
|
+
desc 'Code coverage detail'
|
37
|
+
task :simplecov do
|
38
|
+
ENV['COVERAGE'] = 'true'
|
39
|
+
Rake::Task['spec'].execute
|
40
|
+
end
|
41
|
+
|
42
|
+
task default: :spec
|
43
|
+
|
44
|
+
require 'rdoc/task'
|
45
|
+
Rake::RDocTask.new do |rdoc|
|
46
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ''
|
47
|
+
|
48
|
+
rdoc.rdoc_dir = 'rdoc'
|
49
|
+
rdoc.title = "ytsongdw #{version}"
|
50
|
+
rdoc.rdoc_files.include('README*')
|
51
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
52
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.3
|
data/bin/ytsongdw
ADDED
data/lib/counter.rb
ADDED
data/lib/downloader.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Base downloader class intherited by SongDownloader and PlaylistDownloader
|
2
|
+
class Downloader
|
3
|
+
extend Memoist
|
4
|
+
|
5
|
+
attr_accessor :url, :name, :counter, :settings
|
6
|
+
|
7
|
+
YOUTUBE_BASE_URL = 'youtube.com'.freeze
|
8
|
+
YOUTUBE_HTTPS_URL = "https://www.#{YOUTUBE_BASE_URL}".freeze
|
9
|
+
YOUTUBE_SEARCH_URL = "#{YOUTUBE_HTTPS_URL}/results?search_query=".freeze
|
10
|
+
YOUTUBE_WATCH_URL = "#{YOUTUBE_HTTPS_URL}/watch?v=".freeze
|
11
|
+
MAXIMUM_NUMBER_OF_TRIES = 3
|
12
|
+
|
13
|
+
def parse_name(title)
|
14
|
+
title = title.slice(0, title.rindex('-')) if title.include? '-'
|
15
|
+
title.strip
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Simple settings class used to configure download path
|
2
|
+
class FileSettings
|
3
|
+
DOWNLOAD_DIRECTORY = '~/Music/'.freeze
|
4
|
+
|
5
|
+
attr_accessor :folder, :subfolder
|
6
|
+
|
7
|
+
def initialize(folder = nil)
|
8
|
+
@folder = folder || DOWNLOAD_DIRECTORY
|
9
|
+
end
|
10
|
+
|
11
|
+
def filepath(name)
|
12
|
+
@folder + @subfolder.to_s + sanitize(name) + '.m4a'
|
13
|
+
end
|
14
|
+
|
15
|
+
def sanitize(name)
|
16
|
+
return '' if name.nil? || name == ''
|
17
|
+
name.strip.tr('/', '|')
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Playlist downloader, calls SongDownloader for each song in playlist
|
2
|
+
class PlaylistDownloader < Downloader
|
3
|
+
LINKS_CSS_PATH = '#pl-video-table tr td a'.freeze
|
4
|
+
|
5
|
+
def self.playlist?(url)
|
6
|
+
url.include? YOUTUBE_BASE_URL + '/playlist?list='
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(url, counter, settings)
|
10
|
+
@url = url
|
11
|
+
@urls = urls
|
12
|
+
@name = parse_name(@url.scrapify[:title]) + '/'
|
13
|
+
@counter = counter.dup
|
14
|
+
@counter.playlist_current = 1
|
15
|
+
@counter.playlist_total = @urls.size
|
16
|
+
@settings = settings.dup
|
17
|
+
@settings.subfolder = @name
|
18
|
+
end
|
19
|
+
|
20
|
+
def urls
|
21
|
+
html = Nokogiri::HTML(open(url).read)
|
22
|
+
html.css(LINKS_CSS_PATH)
|
23
|
+
.select { |link| link.attr('href').include?('watch') }
|
24
|
+
.map { |link| YOUTUBE_HTTPS_URL + link.attr('href') }
|
25
|
+
.uniq
|
26
|
+
rescue
|
27
|
+
SimpleLogger.couldnt_fetch_playlist_url
|
28
|
+
[]
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.download(url, counter, settings)
|
32
|
+
playlist = new(url, counter, settings)
|
33
|
+
playlist.urls.each do |song_url|
|
34
|
+
SongDownloader.download(song_url, playlist.counter, playlist.settings)
|
35
|
+
playlist.counter.playlist_current += 1
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# Simple STDOUT logger containing all texts
|
2
|
+
module SimpleLogger
|
3
|
+
def self.log(text)
|
4
|
+
puts "# #{text}"
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.progress(element, counter)
|
8
|
+
if counter.playlist
|
9
|
+
playlist_progress(element, counter)
|
10
|
+
else
|
11
|
+
song_progress(element, counter)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.base_progress(_element, counter)
|
16
|
+
"#{counter.current}/#{counter.total}"
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.song_progress(element, counter)
|
20
|
+
log "#{base_progress(element, counter)} - #{element.name}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.playlist_progress(element, counter)
|
24
|
+
log "#{base_progress(element, counter)}" \
|
25
|
+
" <#{counter.playlist_current}/#{counter.playlist_total}>" \
|
26
|
+
" - #{element.name}"
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.maximum_number_of_tries
|
30
|
+
log 'MAXIMUM NUMBER OF TRIES EXCEEDED'
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.retry(url, name, number_of_tries)
|
34
|
+
log "COULDN'T DOWNLOAD #{url}/#{name} TRY ##{number_of_tries}"
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.downloading(song)
|
38
|
+
log "DOWNLOADING #{song.url}/#{song.name}"
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.finished_downloading
|
42
|
+
log 'FINISHED'
|
43
|
+
log ''
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.found_no_results(url)
|
47
|
+
log "DIDNT FIND ANY RESULTS FOR #{url}"
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.couldnt_fetch_playlist_url
|
51
|
+
log "COULDN'T FETCH PLAYLIST VIDEO URLS"
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.done(settings)
|
55
|
+
log "DONE (see the folder '#{settings.folder}')"
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.print_help_message
|
59
|
+
log 'You should pass one or two parameters: The song name/youtube url or the file'
|
60
|
+
log 'containing all youtube songs/urls to download and an optional folder to download'
|
61
|
+
log 'it to (defaults to ~/Music)'
|
62
|
+
log 'make sure youve run `bundle install` first to download dependencies and then one of:'
|
63
|
+
log 'Example1: bundle exec download_m4a.rb test.txt'
|
64
|
+
log 'Example2: bundle exec download_m4a.rb "https://www.youtube.com/watch?v=bM7SZ5SBzyY"'
|
65
|
+
log 'Example3: bundle exec download_m4a.rb "https://www.youtube.com/playlist?list=PL9B23A78D3D249A74"'
|
66
|
+
log 'Example4: bundle exec download_m4a.rb "Titanic Song"'
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Song downloader class, uses YoutubeDL to download only the audio
|
2
|
+
class SongDownloader < Downloader
|
3
|
+
def initialize(url, settings, counter)
|
4
|
+
@url = parse_url(url)
|
5
|
+
@counter = counter.dup
|
6
|
+
@settings = settings.dup
|
7
|
+
@name = parse_name(@url.scrapify[:title])
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.download(url, counter, settings, number_of_tries = 1)
|
11
|
+
song = new(url, settings, counter)
|
12
|
+
SimpleLogger.progress(song, song.counter)
|
13
|
+
return SimpleLogger.maximum_number_of_tries if number_of_tries > MAXIMUM_NUMBER_OF_TRIES
|
14
|
+
song.download
|
15
|
+
rescue
|
16
|
+
SimpleLogger.retry(song.url, song.name, number_of_tries)
|
17
|
+
download(url, counter, settings, number_of_tries + 1)
|
18
|
+
end
|
19
|
+
|
20
|
+
def download
|
21
|
+
SimpleLogger.downloading(self)
|
22
|
+
YoutubeDL.download url, format: 'm4a', output: settings.filepath(name)
|
23
|
+
SimpleLogger.finished_downloading
|
24
|
+
end
|
25
|
+
|
26
|
+
def parse_url(input = nil)
|
27
|
+
url = input.include?('youtu') ? input.strip : find_youtube_video(input)
|
28
|
+
url = url.slice(0, url.index('&')) if url.include? '&'
|
29
|
+
url
|
30
|
+
end
|
31
|
+
|
32
|
+
def find_youtube_video(name)
|
33
|
+
search_url = YOUTUBE_SEARCH_URL + URI.encode(name)
|
34
|
+
results = open(search_url).read
|
35
|
+
|
36
|
+
return YOUTUBE_WATCH_URL + Regexp.last_match(1) if results =~ /watch\?v=([-\w_]+)/
|
37
|
+
puts SimpleLogger.found_no_results(@url)
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Main class, receives an input for STDIN and calls respective Downloaders
|
2
|
+
class YoutubeSongDownloader
|
3
|
+
def initialize(args)
|
4
|
+
if args.length.zero? || args[0] == '-h' || args[0] == '--help'
|
5
|
+
SimpleLogger.print_help_message
|
6
|
+
exit 0
|
7
|
+
else
|
8
|
+
@input = args[0]
|
9
|
+
@counter = Counter.new
|
10
|
+
@counter.current = 1
|
11
|
+
@settings = FileSettings.new(args[1])
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def download
|
16
|
+
if @input.include?('.txt')
|
17
|
+
download_file_songs(@input)
|
18
|
+
else
|
19
|
+
@counter.total = 1
|
20
|
+
download_playlist_or_song(@input)
|
21
|
+
end
|
22
|
+
SimpleLogger.done(@settings)
|
23
|
+
end
|
24
|
+
|
25
|
+
def download_file_songs(filename)
|
26
|
+
@counter.total = File.open(filename).readlines.size
|
27
|
+
File.open(filename).each_line.with_index do |input, line_number|
|
28
|
+
@counter.current = line_number + 1
|
29
|
+
download_playlist_or_song(input)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def download_playlist_or_song(input)
|
34
|
+
if PlaylistDownloader.playlist?(input)
|
35
|
+
@counter.playlist = true
|
36
|
+
PlaylistDownloader.download(input, @counter, @settings)
|
37
|
+
else
|
38
|
+
@counter.playlist = false
|
39
|
+
SongDownloader.download(input, @counter, @settings)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/ytsongdw.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
Bundler.require(:default)
|
4
|
+
|
5
|
+
require 'open-uri'
|
6
|
+
require_relative 'simple_logger'
|
7
|
+
require_relative 'counter'
|
8
|
+
require_relative 'file_settings'
|
9
|
+
require_relative 'downloader'
|
10
|
+
require_relative 'playlist_downloader'
|
11
|
+
require_relative 'song_downloader'
|
12
|
+
require_relative 'youtube_song_downloader'
|
data/songs.txt
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
FFVII battle theme
|
2
|
+
FFVII boss theme
|
3
|
+
https://www.youtube.com/watch?v=IneWEraHyl8
|
4
|
+
https://www.youtube.com/watch?v=9DvRCykzHy4
|
5
|
+
https://www.youtube.com/watch?v=ifXalt3MJtM
|
6
|
+
https://www.youtube.com/watch?v=p7ZsBPK656s
|
7
|
+
https://www.youtube.com/watch?v=ovPwUihaVdE
|
8
|
+
https://www.youtube.com/playlist?list=PL9B23A78D3D249A74
|
data/spec/spec_helper.rb
ADDED
data/spec/test.txt
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
|
3
|
+
describe YoutubeSongDownloader do
|
4
|
+
let(:upload_directory) { "#{__dir__}/tmp/" }
|
5
|
+
let(:downloader) { described_class.new(args) }
|
6
|
+
|
7
|
+
before do
|
8
|
+
$stdout = StringIO.new
|
9
|
+
FileUtils.rm_rf upload_directory
|
10
|
+
Dir.mkdir upload_directory
|
11
|
+
end
|
12
|
+
|
13
|
+
after(:all) do
|
14
|
+
$stdout = STDOUT
|
15
|
+
end
|
16
|
+
|
17
|
+
def exit_status
|
18
|
+
downloader.download
|
19
|
+
rescue SystemExit => e
|
20
|
+
e.status
|
21
|
+
end
|
22
|
+
|
23
|
+
def number_of_files
|
24
|
+
Dir["#{upload_directory}**/*.m4a"].length
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'with no arguments' do
|
28
|
+
let(:args) { [] }
|
29
|
+
it 'exits' do
|
30
|
+
expect(exit_status).to be_zero
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'with argument "-h"' do
|
35
|
+
let(:args) { ['-h'] }
|
36
|
+
it 'exits' do
|
37
|
+
expect(exit_status).to be_zero
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'with argument "--help"' do
|
42
|
+
let(:args) { ['--help'] }
|
43
|
+
it 'exits' do
|
44
|
+
expect(exit_status).to be_zero
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context 'with a youtube url as the first argument' do
|
49
|
+
let(:args) { ['https://youtu.be/xZ2P-_mF2Ek', upload_directory] }
|
50
|
+
|
51
|
+
it 'downloads its song' do
|
52
|
+
expect { downloader.download }.to change { number_of_files }.from(0).to(1)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context 'with a youtube text as the first argument' do
|
57
|
+
let(:args) { ['weirdstringtosearchfor', upload_directory] }
|
58
|
+
|
59
|
+
it 'finds and downloads the song of the first video that matches the text' do
|
60
|
+
expect { downloader.download }.to change { number_of_files }.from(0).to(1)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context 'with a playlist url as the first argument' do
|
65
|
+
let(:args) { ['https://www.youtube.com/playlist?list=PL8-XLhqOZkDE0krq95qaGIKSSYdDFXoYM', upload_directory] }
|
66
|
+
|
67
|
+
it 'downloads all songs of videos on the playlist' do
|
68
|
+
expect { downloader.download }.to change { number_of_files }.from(0).to(2)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
context 'with a file as the first argument' do
|
73
|
+
let(:args) { ["#{__dir__}/test.txt", upload_directory] }
|
74
|
+
|
75
|
+
it 'downloads all songs contained in file' do
|
76
|
+
expect { downloader.download }.to change { number_of_files }.from(0).to(2)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
data/ytsongdw.gemspec
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
# Generated by juwelier
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: ytsongdw 0.1.3 ruby lib
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "ytsongdw"
|
9
|
+
s.version = "0.1.3"
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
13
|
+
s.authors = ["teonimesic", "ggouzi"]
|
14
|
+
s.date = "2017-01-05"
|
15
|
+
s.description = "Supports youtube urls, playlists and fulltext search"
|
16
|
+
s.email = "stefano@heavenstudio.com.br"
|
17
|
+
s.executables = ["ytsongdw"]
|
18
|
+
s.extra_rdoc_files = [
|
19
|
+
"LICENSE.txt",
|
20
|
+
"README.md"
|
21
|
+
]
|
22
|
+
s.files = [
|
23
|
+
".codeclimate.yml",
|
24
|
+
".rspec",
|
25
|
+
".rubocop.yml",
|
26
|
+
".ruby-version",
|
27
|
+
"Gemfile",
|
28
|
+
"Gemfile.lock",
|
29
|
+
"LICENSE.txt",
|
30
|
+
"README.md",
|
31
|
+
"Rakefile",
|
32
|
+
"VERSION",
|
33
|
+
"bin/ytsongdw",
|
34
|
+
"lib/counter.rb",
|
35
|
+
"lib/downloader.rb",
|
36
|
+
"lib/file_settings.rb",
|
37
|
+
"lib/playlist_downloader.rb",
|
38
|
+
"lib/simple_logger.rb",
|
39
|
+
"lib/song_downloader.rb",
|
40
|
+
"lib/youtube_song_downloader.rb",
|
41
|
+
"lib/ytsongdw.rb",
|
42
|
+
"songs.txt",
|
43
|
+
"spec/spec_helper.rb",
|
44
|
+
"spec/test.txt",
|
45
|
+
"spec/youtube_song_downloader_spec.rb",
|
46
|
+
"ytsongdw.gemspec"
|
47
|
+
]
|
48
|
+
s.homepage = "http://github.com/heavenstudio/ytsongdw"
|
49
|
+
s.licenses = ["GPL-2.0"]
|
50
|
+
s.required_ruby_version = Gem::Requirement.new(">= 2.0")
|
51
|
+
s.rubygems_version = "2.5.1"
|
52
|
+
s.summary = "Gem to download songs from youtube videos"
|
53
|
+
|
54
|
+
if s.respond_to? :specification_version then
|
55
|
+
s.specification_version = 4
|
56
|
+
|
57
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
58
|
+
s.add_runtime_dependency(%q<memoist>, ["~> 0"])
|
59
|
+
s.add_runtime_dependency(%q<nokogiri>, ["~> 1.6"])
|
60
|
+
s.add_runtime_dependency(%q<scrapifier>, ["~> 0"])
|
61
|
+
s.add_runtime_dependency(%q<youtube-dl.rb>, ["~> 0"])
|
62
|
+
s.add_development_dependency(%q<codeclimate-test-reporter>, ["~> 1.0"])
|
63
|
+
s.add_development_dependency(%q<pry>, ["~> 0"])
|
64
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
65
|
+
s.add_development_dependency(%q<rspec>, ["~> 3.0"])
|
66
|
+
s.add_development_dependency(%q<simplecov>, ["~> 0"])
|
67
|
+
s.add_development_dependency(%q<juwelier>, ["~> 2.1"])
|
68
|
+
else
|
69
|
+
s.add_dependency(%q<memoist>, ["~> 0"])
|
70
|
+
s.add_dependency(%q<nokogiri>, ["~> 1.6"])
|
71
|
+
s.add_dependency(%q<scrapifier>, ["~> 0"])
|
72
|
+
s.add_dependency(%q<youtube-dl.rb>, ["~> 0"])
|
73
|
+
s.add_dependency(%q<codeclimate-test-reporter>, ["~> 1.0"])
|
74
|
+
s.add_dependency(%q<pry>, ["~> 0"])
|
75
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
76
|
+
s.add_dependency(%q<rspec>, ["~> 3.0"])
|
77
|
+
s.add_dependency(%q<simplecov>, ["~> 0"])
|
78
|
+
s.add_dependency(%q<juwelier>, ["~> 2.1"])
|
79
|
+
end
|
80
|
+
else
|
81
|
+
s.add_dependency(%q<memoist>, ["~> 0"])
|
82
|
+
s.add_dependency(%q<nokogiri>, ["~> 1.6"])
|
83
|
+
s.add_dependency(%q<scrapifier>, ["~> 0"])
|
84
|
+
s.add_dependency(%q<youtube-dl.rb>, ["~> 0"])
|
85
|
+
s.add_dependency(%q<codeclimate-test-reporter>, ["~> 1.0"])
|
86
|
+
s.add_dependency(%q<pry>, ["~> 0"])
|
87
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
88
|
+
s.add_dependency(%q<rspec>, ["~> 3.0"])
|
89
|
+
s.add_dependency(%q<simplecov>, ["~> 0"])
|
90
|
+
s.add_dependency(%q<juwelier>, ["~> 2.1"])
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
metadata
ADDED
@@ -0,0 +1,211 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ytsongdw
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- teonimesic
|
8
|
+
- ggouzi
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2017-01-05 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: memoist
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: nokogiri
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.6'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.6'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: scrapifier
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: youtube-dl.rb
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: codeclimate-test-reporter
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '1.0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '1.0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: pry
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: rdoc
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '3.12'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '3.12'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: rspec
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '3.0'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '3.0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: simplecov
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - "~>"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
type: :development
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: juwelier
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - "~>"
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '2.1'
|
147
|
+
type: :development
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - "~>"
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '2.1'
|
154
|
+
description: Supports youtube urls, playlists and fulltext search
|
155
|
+
email: stefano@heavenstudio.com.br
|
156
|
+
executables:
|
157
|
+
- ytsongdw
|
158
|
+
extensions: []
|
159
|
+
extra_rdoc_files:
|
160
|
+
- LICENSE.txt
|
161
|
+
- README.md
|
162
|
+
files:
|
163
|
+
- ".codeclimate.yml"
|
164
|
+
- ".rspec"
|
165
|
+
- ".rubocop.yml"
|
166
|
+
- ".ruby-version"
|
167
|
+
- Gemfile
|
168
|
+
- Gemfile.lock
|
169
|
+
- LICENSE.txt
|
170
|
+
- README.md
|
171
|
+
- Rakefile
|
172
|
+
- VERSION
|
173
|
+
- bin/ytsongdw
|
174
|
+
- lib/counter.rb
|
175
|
+
- lib/downloader.rb
|
176
|
+
- lib/file_settings.rb
|
177
|
+
- lib/playlist_downloader.rb
|
178
|
+
- lib/simple_logger.rb
|
179
|
+
- lib/song_downloader.rb
|
180
|
+
- lib/youtube_song_downloader.rb
|
181
|
+
- lib/ytsongdw.rb
|
182
|
+
- songs.txt
|
183
|
+
- spec/spec_helper.rb
|
184
|
+
- spec/test.txt
|
185
|
+
- spec/youtube_song_downloader_spec.rb
|
186
|
+
- ytsongdw.gemspec
|
187
|
+
homepage: http://github.com/heavenstudio/ytsongdw
|
188
|
+
licenses:
|
189
|
+
- GPL-2.0
|
190
|
+
metadata: {}
|
191
|
+
post_install_message:
|
192
|
+
rdoc_options: []
|
193
|
+
require_paths:
|
194
|
+
- lib
|
195
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - ">="
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: '2.0'
|
200
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
201
|
+
requirements:
|
202
|
+
- - ">="
|
203
|
+
- !ruby/object:Gem::Version
|
204
|
+
version: '0'
|
205
|
+
requirements: []
|
206
|
+
rubyforge_project:
|
207
|
+
rubygems_version: 2.5.1
|
208
|
+
signing_key:
|
209
|
+
specification_version: 4
|
210
|
+
summary: Gem to download songs from youtube videos
|
211
|
+
test_files: []
|