Class: VineDl::Video
- Inherits:
-
Object
- Object
- VineDl::Video
- Defined in:
- lib/vine_dl/video.rb
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #download(path, options = {}) ⇒ Object
- #file_name ⇒ Object
-
#initialize(_user, _client_video) ⇒ Video
constructor
A new instance of Video.
- #video_url ⇒ Object
Constructor Details
#initialize(_user, _client_video) ⇒ Video
Returns a new instance of Video.
8 9 10 11 |
# File 'lib/vine_dl/video.rb', line 8 def initialize(_user, _client_video) @user = _user @client_video = _client_video end |
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
6 7 8 |
# File 'lib/vine_dl/video.rb', line 6 def user @user end |
Instance Method Details
#download(path, options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/vine_dl/video.rb', line 13 def download(path, = {}) create_directory = .fetch(:create_directory, false) # TODO: Find the dir more robustly. directory = File.join(path.split("/")[0..-2]) if create_directory && !File.directory?(directory) Dir.mkdir(directory) end write_to_file(path) path end |
#file_name ⇒ Object
32 33 34 35 |
# File 'lib/vine_dl/video.rb', line 32 def file_name # TODO: Get the video name more robustly. @file_name ||= video_url.split("videos_h264high/")[1] end |
#video_url ⇒ Object
27 28 29 30 |
# File 'lib/vine_dl/video.rb', line 27 def video_url # TODO: Get the url without the query more robustly. @video_url ||= client_video.videoUrl.split("?")[0] end |