vine_dl 0.1.0

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: 05d1afa0e6c1a654d85888e7483981f53c6c4b7f
4
+ data.tar.gz: 452b3a7cf08b0b1a937aec477a24058bff49639e
5
+ SHA512:
6
+ metadata.gz: 89ac1118dfecf6af9b4f15ef42b493c2bbad79537ed500bc74e740b66d68f7cacaca671a2de6efef37a80c8695028ea9de000147c95f9ecdff9e07e79cdb6695
7
+ data.tar.gz: e3917e3df07c24d8315765ba498a5d95b7a2cbc9d66584aaae44d692c09ee7f759f5fc9fde176b244884b93fab81fe160099530165f58950379d8f2f8bf5c300
@@ -0,0 +1,4 @@
1
+ VINE_USERNAME=YOUR_REAL_VINE_USERNAME
2
+ VINE_PASSWORD=YOUR_REAL_VINE_PASSWORD
3
+ NO_MOCKS=false
4
+ NO_DELETE_DOWNLOADED_FILES=false
@@ -0,0 +1,4 @@
1
+ /downloads
2
+ /lib/downloads
3
+ /spec/tmp
4
+ .env
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.12.5
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at danielvassallo87@gmail.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vine_dl.gemspec
4
+ gemspec
@@ -0,0 +1,36 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ vine_dl (0.1.0)
5
+ vine_client (~> 0.0.7)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ dotenv (2.1.1)
11
+ faraday (0.9.2)
12
+ multipart-post (>= 1.2, < 3)
13
+ faraday_middleware (0.10.0)
14
+ faraday (>= 0.7.4, < 0.10)
15
+ hashie (2.1.2)
16
+ minitest (5.9.0)
17
+ multipart-post (2.0.0)
18
+ rake (10.4.2)
19
+ vine_client (0.0.7)
20
+ faraday (~> 0.8)
21
+ faraday_middleware (~> 0.8)
22
+
23
+ PLATFORMS
24
+ ruby
25
+
26
+ DEPENDENCIES
27
+ bundler (~> 1.12)
28
+ dotenv (~> 2.1.1)
29
+ hashie (>= 2.0.2, < 3.0.0)
30
+ minitest
31
+ rake (~> 10.0)
32
+ vine_client (~> 0.0.7)
33
+ vine_dl!
34
+
35
+ BUNDLED WITH
36
+ 1.12.5
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 dannyvassallo
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,93 @@
1
+ [![Build Status](https://travis-ci.org/dannyvassallo/vine_dl.svg?branch=gem)](https://travis-ci.org/dannyvassallo/vine_dl)
2
+
3
+ # VineDl
4
+
5
+ A rubygem to auth in and rip a users Vine videos.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'vine_dl'
13
+ ```
14
+
15
+ OR
16
+
17
+ Install from github:
18
+
19
+ ```ruby
20
+ gem 'vine_dl', :git => 'git://github.com/dannyvassallo/vine_dl.git'
21
+ ```
22
+
23
+ And then execute:
24
+
25
+ $ bundle
26
+
27
+ Or install it yourself as:
28
+
29
+ $ gem install vine_dl
30
+
31
+ ## Usage
32
+
33
+ ```ruby
34
+ user = VineDl::User.new("your_vine_username", "your_vine_password")
35
+ user.videos.each do |video|
36
+ video.download("custom/path/to/wherever.mp4")
37
+ end
38
+ ```
39
+
40
+ ## Development
41
+
42
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
43
+
44
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
45
+
46
+ ## Running tests
47
+
48
+ Simply run the rake command.
49
+
50
+ ```shell
51
+ rake
52
+ # or
53
+ rake test
54
+ ```
55
+
56
+ You can configure `.env` to disable mocks in tests.
57
+ This requires valid credentials in ENV.
58
+
59
+ ```shell
60
+ VINE_USERNAME=YOUR_REAL_VINE_USERNAME
61
+ VINE_PASSWORD=YOUR_REAL_VINE_PASSWORD
62
+ NO_MOCKS=false
63
+ ```
64
+
65
+ You can tell the tests not to delete the files it downloads.
66
+
67
+ ```shell
68
+ VINE_USERNAME=YOUR_REAL_VINE_USERNAME
69
+ VINE_PASSWORD=YOUR_REAL_VINE_PASSWORD
70
+ NO_MOCKS=false
71
+ NO_DELETE_DOWNLOADED_FILES=false
72
+ ```
73
+
74
+ ## Deploying to RubyGems
75
+
76
+ ```shell
77
+ bundle exec rake release
78
+ ```
79
+
80
+ When this command runs successfully, it does two things:
81
+
82
+ 1) Your git repository will be tagged with the version number.
83
+
84
+ 2) Your gem will be accessible through RubyGems.org..
85
+
86
+ ## Contributing
87
+
88
+ Bug reports and pull requests are welcome on GitHub at https://github.com/dannyvassallo/vine_dl. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
89
+
90
+
91
+ ## License
92
+
93
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ desc "Run tests"
4
+ task :test do
5
+ Dir["#{__dir__}/spec/**/*_spec.rb"].each(&method(:load))
6
+ end
7
+
8
+ task :default => :test
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "vine_dl"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,16 @@
1
+ require "vine_dl/version"
2
+ require_relative "vine_dl/user"
3
+ require_relative "vine_dl/video"
4
+
5
+ module VineDl
6
+
7
+ module_function
8
+
9
+ def login_and_get_videos(username, password)
10
+ user = VineDl::User.new(username, password)
11
+ user.videos.each do |video|
12
+ video.download("#{__dir__}/downloads/#{video.file_name}", :create_directory => true)
13
+ end
14
+ end
15
+
16
+ end
@@ -0,0 +1,32 @@
1
+ require "vine_client"
2
+
3
+ module VineDl
4
+ class User
5
+
6
+ attr_reader :username, :password
7
+
8
+ def initialize(_username, _password)
9
+ @username = _username
10
+ @password = _password
11
+ end
12
+
13
+ def videos
14
+ @videos ||= timeline.records.map { |client_video| Video.new(self, client_video) }
15
+ end
16
+
17
+ def timeline
18
+ @timeline ||= client.timelines(twitter_id)
19
+ end
20
+
21
+ def twitter_id
22
+ @twitter_id ||= client.user_info.fetch(:twitterId)
23
+ end
24
+
25
+ private
26
+
27
+ def client
28
+ @client ||= ::Vine::Client.new(username, password)
29
+ end
30
+
31
+ end
32
+ end
@@ -0,0 +1,3 @@
1
+ module VineDl
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,54 @@
1
+ require "open-uri"
2
+
3
+ module VineDl
4
+ class Video
5
+
6
+ attr_reader :user
7
+
8
+ def initialize(_user, _client_video)
9
+ @user = _user
10
+ @client_video = _client_video
11
+ end
12
+
13
+ def download(path, options = {})
14
+ create_directory = options.fetch(:create_directory, false)
15
+ # TODO: Find the dir more robustly.
16
+ directory = File.join(path.split("/")[0..-2])
17
+
18
+ if create_directory && !File.directory?(directory)
19
+ Dir.mkdir(directory)
20
+ end
21
+
22
+ write_to_file(path)
23
+
24
+ path
25
+ end
26
+
27
+ def video_url
28
+ # TODO: Get the url without the query more robustly.
29
+ @video_url ||= client_video.videoUrl.split("?")[0]
30
+ end
31
+
32
+ def file_name
33
+ # TODO: Get the video name more robustly.
34
+ @file_name ||= video_url.split("videos_h264high/")[1]
35
+ end
36
+
37
+ private
38
+
39
+ attr_reader :client_video
40
+
41
+ def write_to_file(path)
42
+ File.open(path, "wb") do |write_stream|
43
+ download_and_write_to_stream(write_stream)
44
+ end
45
+ end
46
+
47
+ def download_and_write_to_stream(write_stream)
48
+ open(video_url, "rb") do |read_stream|
49
+ write_stream.write(read_stream.read)
50
+ end
51
+ end
52
+
53
+ end
54
+ end
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vine_dl/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vine_dl"
8
+ spec.version = VineDl::VERSION
9
+ spec.authors = ["dannyvassallo"]
10
+ spec.email = ["danielvassallo87@gmail.com"]
11
+
12
+ spec.summary = %q{A Vine video ripper written in Ruby}
13
+ spec.description = %q{Auth a user in to vine and download the available videos to your computer or server.}
14
+ spec.homepage = "https://github.com/dannyvassallo/vine_dl.git"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "hashie", ">= 2.0.2", "< 3.0.0"
23
+ spec.add_development_dependency "bundler", "~> 1.12"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "vine_client", "~> 0.0.7"
26
+ spec.add_development_dependency "minitest"
27
+ spec.add_development_dependency "dotenv", "~> 2.1.1"
28
+
29
+
30
+ spec.add_runtime_dependency "vine_client", "~> 0.0.7"
31
+ end
metadata ADDED
@@ -0,0 +1,165 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vine_dl
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - dannyvassallo
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-07-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: hashie
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 2.0.2
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: 3.0.0
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 2.0.2
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 3.0.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: bundler
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.12'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.12'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '10.0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '10.0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: vine_client
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: 0.0.7
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: 0.0.7
75
+ - !ruby/object:Gem::Dependency
76
+ name: minitest
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: dotenv
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: 2.1.1
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: 2.1.1
103
+ - !ruby/object:Gem::Dependency
104
+ name: vine_client
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: 0.0.7
110
+ type: :runtime
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: 0.0.7
117
+ description: Auth a user in to vine and download the available videos to your computer
118
+ or server.
119
+ email:
120
+ - danielvassallo87@gmail.com
121
+ executables: []
122
+ extensions: []
123
+ extra_rdoc_files: []
124
+ files:
125
+ - ".env.example"
126
+ - ".gitignore"
127
+ - ".travis.yml"
128
+ - CODE_OF_CONDUCT.md
129
+ - Gemfile
130
+ - Gemfile.lock
131
+ - LICENSE.txt
132
+ - README.md
133
+ - Rakefile
134
+ - bin/console
135
+ - bin/setup
136
+ - lib/vine_dl.rb
137
+ - lib/vine_dl/user.rb
138
+ - lib/vine_dl/version.rb
139
+ - lib/vine_dl/video.rb
140
+ - vine_dl.gemspec
141
+ homepage: https://github.com/dannyvassallo/vine_dl.git
142
+ licenses:
143
+ - MIT
144
+ metadata: {}
145
+ post_install_message:
146
+ rdoc_options: []
147
+ require_paths:
148
+ - lib
149
+ required_ruby_version: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ required_rubygems_version: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
159
+ requirements: []
160
+ rubyforge_project:
161
+ rubygems_version: 2.5.1
162
+ signing_key:
163
+ specification_version: 4
164
+ summary: A Vine video ripper written in Ruby
165
+ test_files: []