zippyshare 1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 04b59d48a2e228ce7103313d1a298116b4c58976
4
+ data.tar.gz: a683cb03a59fcc1ee7b69688f434f53d0340367c
5
+ SHA512:
6
+ metadata.gz: 5775f0e59dd628632bfac57ff64bc1cfae3bde5feac97e34cb47170ebdd567289e93038c9b91add8fe39f5aec9a9b8088d3219d841deeb16c899c7daa1c0a56b
7
+ data.tar.gz: 4d4e4c770d123365f41155e609353537cf2dfd1dee91341230c324781b1ac4b3bdb1dcc61482c4bdb85e0f9dda46631d29f832bb8efb3cd1fea1bf0f1b122dd3
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in zippyrb.gemspec
8
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Lotus
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,67 @@
1
+ [![Build Status](https://travis-ci.org/yoru/zippy.svg?branch=master)](https://travis-ci.org/yoru/zippy)
2
+ [![Gem](https://img.shields.io/gem/v/zippyshare.svg)](https://rubygems.org/gems/zippyshare)
3
+
4
+ # Zippy
5
+
6
+ This is a straightfoward script to download files from Zippyshare. It takes the
7
+ direct download link then delegates the download to wget, a small tool which
8
+ manages downloads better than any other.
9
+
10
+ ## Installation
11
+
12
+ $ gem install zippyshare
13
+
14
+ ## Usage
15
+
16
+ ```
17
+ Commands:
18
+ zippy batch <file> <simultaneous> # Parse each line of <FILE>
19
+ zippy download <url> # Download single <URL>
20
+ zippy help [COMMAND] # Describe available commands or one specific command
21
+ ```
22
+
23
+ ### Examples
24
+
25
+ ```bash
26
+ # Download a single file.
27
+ zippy download 'http://www35.zippyshare.com/v/lUtTQ7im/file.html'
28
+
29
+ # Loop through each line of <links.txt>, two simultaneous downloads.
30
+ zippy batch 'links.txt' 2
31
+ ```
32
+
33
+ ## FAQ
34
+
35
+ ### Is resume supported?
36
+
37
+ Yes.
38
+
39
+ ### Why wget?
40
+
41
+ Wget is always present on nearly every Linux distribuition. It's a simple tool
42
+ that does its job.
43
+
44
+ ### How to use X instead wget?
45
+
46
+ Pull requests are welcome, maybe.
47
+
48
+ ```ruby
49
+ require 'zippy/parser'
50
+
51
+ link = Zippy::Parser.parse("http://www35.zippyshare.com/v/lUtTQ7im/file.html")
52
+
53
+ # do something with interesting...
54
+ ```
55
+
56
+ ## Contributing
57
+
58
+ Bug reports and pull requests are welcome.
59
+
60
+ Don't forget to run:
61
+
62
+ 1. `rubocop -a` to fix offenses.
63
+ 2. `rake spec` to run the tests.
64
+
65
+ ## License
66
+
67
+ The gem is available as open source under the terms of the [MIT License](LICENSE).
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'zippy/cli'
5
+
6
+ Zippy::CLI.start
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'zippy/cli'
4
+ require 'zippy/parser'
5
+
6
+ module Zippy
7
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'parallel'
4
+ require 'shellwords'
5
+ require 'thor'
6
+ require 'zippy/parser'
7
+
8
+ module Zippy
9
+ class CLI < Thor
10
+ desc 'download <url>', 'Download single <URL>'
11
+ def download(url)
12
+ down_url = Zippy::Parser.parse(url)
13
+ system format('wget -cq --show-progress %s', Shellwords.escape(down_url))
14
+ end
15
+
16
+ desc 'batch <file> <simultaneous>', 'Parse each line of <FILE>'
17
+ def batch(file, n = 0)
18
+ links = File.readlines(file).each.map(&:strip)
19
+ Parallel.each(links, in_threads: n.to_i) { |link| download(link) }
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dentaku'
4
+ require 'open-uri'
5
+
6
+ module Zippy
7
+ module Parser
8
+ def self.parse(url)
9
+ return 'Invalid URL' unless url.include? 'zippyshare'
10
+
11
+ math = Dentaku::Calculator.new
12
+
13
+ chalange = open(url).read.match(/"(.*?)" \+ \((.*?)\) \+ "(.*?)"/)
14
+ result = chalange[1] + math.evaluate(chalange[2]).to_s + chalange[3]
15
+
16
+ "http://#{url.split('/')[2]}#{result}"
17
+ end
18
+ end
19
+ end
metadata ADDED
@@ -0,0 +1,164 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zippyshare
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.1'
5
+ platform: ruby
6
+ authors:
7
+ - Lotus
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-01-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dentaku
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
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: parallel
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: thor
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
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: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.16'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.16'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.11.3
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.11.3
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '10.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '10.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.52.1
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.52.1
125
+ description:
126
+ email: lotus@disr.it
127
+ executables:
128
+ - zippy
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - Gemfile
133
+ - LICENSE
134
+ - README.md
135
+ - Rakefile
136
+ - bin/zippy
137
+ - lib/zippy.rb
138
+ - lib/zippy/cli.rb
139
+ - lib/zippy/parser.rb
140
+ homepage: https://github.com/yoru/zippy
141
+ licenses:
142
+ - MIT
143
+ metadata: {}
144
+ post_install_message:
145
+ rdoc_options: []
146
+ require_paths:
147
+ - lib
148
+ required_ruby_version: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ required_rubygems_version: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ requirements: []
159
+ rubyforge_project:
160
+ rubygems_version: 2.6.13
161
+ signing_key:
162
+ specification_version: 4
163
+ summary: Simple script to download files from Zippyshare.
164
+ test_files: []