nokaya 0.0.8 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +58 -50
- data/bin/nokaya +0 -0
- data/lib/nokaya.rb +0 -2
- data/lib/nokaya/adn.rb +35 -0
- data/lib/nokaya/app.rb +74 -110
- data/lib/nokaya/basic.rb +32 -0
- data/lib/nokaya/deviantart.rb +34 -0
- data/lib/nokaya/favd.rb +35 -0
- data/lib/nokaya/flickr_album.rb +40 -0
- data/lib/nokaya/imageshack_user.rb +40 -0
- data/lib/nokaya/imgur_album.rb +37 -0
- data/lib/nokaya/instagram.rb +32 -0
- data/lib/nokaya/movie.rb +33 -0
- data/lib/nokaya/photonet.rb +31 -0
- data/lib/nokaya/status.rb +22 -4
- data/lib/nokaya/tumblr.rb +28 -0
- data/lib/nokaya/tumblr_album.rb +42 -0
- data/lib/nokaya/version.rb +1 -1
- data/lib/nokaya/workers.rb +83 -0
- data/nokaya.gemspec +7 -12
- data/spec/nokaya_spec.rb +8 -14
- data/spec/spec_helper.rb +0 -1
- metadata +37 -97
- data/lib/nokaya/getter.rb +0 -100
- data/lib/nokaya/image.rb +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d3963d242f5b924de763a5549f26a2c23ff480e
|
4
|
+
data.tar.gz: 01129dc6b118913ba2452adba063a25247133481
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6019e2867b567f8586d22b09ca1a3a887d1cc46a4d211676f84a6ac3c0e4a98dc2e47ef543e41d46d90f71a23be246512b01d8f718ba212f681d7ba2752c4eaa
|
7
|
+
data.tar.gz: 354ebc4eb8dee9d2c28bfd286fc89a4d9e29cc441dd8161f9c8f658ec57e73444ae879e2fe17cb6cff2036101419e2d7aeeaad2da499bf776abdde72cb39ef45
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,47 +1,39 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/nokaya.svg)](http://badge.fury.io/rb/nokaya)
|
2
|
+
|
1
3
|
# Nokaya
|
2
4
|
|
3
5
|
CLI to download photos from several online services including Instagram, Imgur albums, Flickr albums, App.net, Tumblr pages, Photo.net, Deviantart, etc.
|
4
6
|
|
5
7
|
Mac OS X only for the time being.
|
6
8
|
|
7
|
-
## Installation
|
9
|
+
## Installation
|
8
10
|
|
9
11
|
`gem install nokaya`
|
10
12
|
|
11
|
-
## Usage
|
12
|
-
|
13
|
-
### Instagram
|
14
|
-
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
### Instagram
|
16
|
+
|
15
17
|
`nokaya -i url`
|
16
18
|
|
17
|
-
`nokaya -i url -n file_name`
|
18
|
-
|
19
|
-
`nokaya -i url -n 'file name'`
|
20
|
-
|
21
19
|
Also accepts the IFTTT format (like 'http://ift.tt/1m2Nvz8').
|
22
20
|
|
23
21
|
Example:
|
24
22
|
|
25
23
|
`nokaya -i http://instagram.com/p/noANAfjJ7B/`
|
26
24
|
|
27
|
-
`nokaya -i http://
|
28
|
-
|
29
|
-
`nokaya -i http://ift.tt/1m2Nvz8 -n pasta`
|
30
|
-
|
31
|
-
### Tumblr post
|
25
|
+
`nokaya -i http://ift.tt/1m2Nvz8`
|
32
26
|
|
27
|
+
### Tumblr post
|
28
|
+
|
33
29
|
`nokaya -tu url`
|
34
30
|
|
35
|
-
`nokaya -tu url -n file_name`
|
36
|
-
|
37
31
|
Example:
|
38
32
|
|
39
33
|
`nokaya -tu http://spacequest.tumblr.com/post/83560738152/sexycomics-carlos-valenzuela`
|
40
34
|
|
41
|
-
|
42
|
-
|
43
|
-
### Tumblr page
|
44
|
-
|
35
|
+
### Tumblr page
|
36
|
+
|
45
37
|
Due to the various themes and layouts existing for Tumblr galleries, this feature may not work perfectly...
|
46
38
|
|
47
39
|
Nokaya will try several techniques to extract the image links, then will fallback to scraping all available links if failing at properly detecting photos.
|
@@ -52,30 +44,30 @@ Example:
|
|
52
44
|
|
53
45
|
`nokaya -tal http://brekninger.tumblr.com`
|
54
46
|
|
55
|
-
Downloads all images in the page.
|
56
|
-
|
57
|
-
### Imgur album
|
47
|
+
Downloads all images in the visible page.
|
58
48
|
|
49
|
+
### Imgur album
|
50
|
+
|
59
51
|
`nokaya -ial url`
|
60
52
|
|
61
53
|
Example:
|
62
54
|
|
63
55
|
`nokaya -ial http://imgur.com/a/JNzjB\#0`
|
64
56
|
|
65
|
-
Downloads all images in the album.
|
66
|
-
|
67
|
-
### Flickr album
|
57
|
+
Downloads all images in the album (visible page).
|
68
58
|
|
59
|
+
### Flickr album
|
60
|
+
|
69
61
|
`nokaya -fal url`
|
70
62
|
|
71
63
|
Example:
|
72
64
|
|
73
65
|
`nokaya -fal https://www.flickr.com/photos/ericdke/sets/72157644556227302/`
|
74
66
|
|
75
|
-
Downloads all images in the album.
|
76
|
-
|
77
|
-
### Photo.net page
|
67
|
+
Downloads all images in the album (visible page).
|
78
68
|
|
69
|
+
### Photo.net page
|
70
|
+
|
79
71
|
`nokaya -pnet url`
|
80
72
|
|
81
73
|
Example:
|
@@ -84,62 +76,78 @@ Example:
|
|
84
76
|
|
85
77
|
Downloads all images in the page.
|
86
78
|
|
87
|
-
### Deviantart gallery
|
88
|
-
|
79
|
+
### Deviantart gallery
|
80
|
+
|
89
81
|
`nokaya -dart url`
|
90
82
|
|
91
83
|
Example:
|
92
84
|
|
93
85
|
`nokaya -dart http://www.deviantart.com/photography/nature/waterscapes/`
|
94
86
|
|
95
|
-
Downloads all images in the gallery.
|
96
|
-
|
97
|
-
### Imageshack user gallery
|
87
|
+
Downloads all images in the gallery (visible page).
|
98
88
|
|
89
|
+
### Imageshack user gallery
|
90
|
+
|
99
91
|
`nokaya -ishu url`
|
100
92
|
|
101
93
|
Example:
|
102
94
|
|
103
95
|
`nokaya -ishu https://imageshack.com/user/ToddGilbert`
|
104
96
|
|
105
|
-
Downloads all images in the user gallery.
|
106
|
-
|
107
|
-
### Favd
|
97
|
+
Downloads all images in the user gallery (visible page).
|
108
98
|
|
99
|
+
### Favd
|
100
|
+
|
109
101
|
`nokaya favd url`
|
110
102
|
|
111
|
-
`nokaya favd url -n file_name`
|
112
|
-
|
113
103
|
Example:
|
114
104
|
|
115
105
|
`nokaya favd http://pic.favd.net/29987710`
|
116
106
|
|
117
|
-
|
107
|
+
### App.net
|
108
|
+
|
109
|
+
`nokaya adn url`
|
118
110
|
|
119
|
-
|
111
|
+
Example:
|
120
112
|
|
121
|
-
`nokaya adn
|
113
|
+
`nokaya adn https://photos.app.net/30055986/1`
|
114
|
+
|
115
|
+
### Movie
|
116
|
+
|
117
|
+
Downloads a movie poster given (part of) a movie title.
|
122
118
|
|
123
|
-
`nokaya
|
119
|
+
`nokaya movie title`
|
124
120
|
|
125
121
|
Example:
|
126
122
|
|
127
|
-
`nokaya
|
123
|
+
`nokaya movie the dark knight`
|
124
|
+
|
125
|
+
Use option `-a` to get an alternative.
|
128
126
|
|
129
|
-
|
127
|
+
This is useful for remakes:
|
130
128
|
|
131
|
-
|
129
|
+
`nokaya movie solaris`
|
132
130
|
|
133
|
-
|
131
|
+
(gives the 2002 version)
|
134
132
|
|
133
|
+
`nokaya movie -a solaris`
|
134
|
+
|
135
|
+
(gives the 1972 version)
|
136
|
+
|
137
|
+
## Options
|
138
|
+
|
139
|
+
### Name
|
140
|
+
|
135
141
|
`--name` or `-n`
|
136
142
|
|
137
143
|
Specify a name (without extension).
|
138
144
|
|
139
145
|
`nokaya -i http://instagram.com/p/noANAfjJ7B/ -n happy_dog`
|
140
146
|
|
141
|
-
|
147
|
+
`nokaya -i http://instagram.com/p/noANAfjJ7B/ -n 'happy dog'`
|
142
148
|
|
149
|
+
### Output
|
150
|
+
|
143
151
|
`--output` or `-o`
|
144
152
|
|
145
153
|
Specify an output path.
|
@@ -148,8 +156,8 @@ Specify an output path.
|
|
148
156
|
|
149
157
|
The picture(s) will be downloaded in '~/Downloads' if no output specified.
|
150
158
|
|
151
|
-
### Both
|
152
|
-
|
159
|
+
### Both
|
160
|
+
|
153
161
|
Specify both.
|
154
162
|
|
155
163
|
`nokaya -i http://instagram.com/p/noANAfjJ7B/ -o ~/Pics -n happy_dog`
|
data/bin/nokaya
CHANGED
File without changes
|
data/lib/nokaya.rb
CHANGED
data/lib/nokaya/adn.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Nokaya
|
3
|
+
class ADN < Basic
|
4
|
+
|
5
|
+
attr_reader :author
|
6
|
+
|
7
|
+
def initialize args, options
|
8
|
+
super(args, options)
|
9
|
+
@type = :adn
|
10
|
+
parsed = self.parse(args[0])
|
11
|
+
@image_url = [self.get_basic(parsed)]
|
12
|
+
@author = author(parsed)
|
13
|
+
@file_name = [name()]
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def author page
|
19
|
+
page.css('.p-nickname')[0].text
|
20
|
+
end
|
21
|
+
|
22
|
+
def post_id args
|
23
|
+
/\d+{2}/.match(args[0])
|
24
|
+
end
|
25
|
+
|
26
|
+
def name
|
27
|
+
unless @name.nil?
|
28
|
+
"#{@type.to_s}-#{@name}"
|
29
|
+
else
|
30
|
+
"#{@type.to_s}-#{@workers.sanitize(@author)}-#{post_id(args)}.jpg"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
data/lib/nokaya/app.rb
CHANGED
@@ -1,168 +1,132 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
module Nokaya
|
3
3
|
class App < Thor
|
4
|
+
|
4
5
|
package_name "Nokaya"
|
5
|
-
require_relative 'getter'
|
6
|
-
require_relative 'image'
|
7
|
-
require_relative 'status'
|
8
6
|
|
9
|
-
|
7
|
+
%w{basic status movie workers instagram favd adn tumblr tumblr_album imgur_album flickr_album photonet deviantart imageshack_user}.each {|file| require_relative "#{file}"}
|
8
|
+
|
9
|
+
desc "movie TITLE", "Get the movie poster from IMDb (nokaya -m url)"
|
10
|
+
map "-m" => :movie
|
11
|
+
option :name, aliases: "-n", type: :string, desc: "Specify a file name without extension"
|
12
|
+
option :output, aliases: "-o", type: :string, desc: "Specify an output path"
|
13
|
+
option :alt, aliases: "-a", type: :boolean, desc: "Find an alternative response"
|
14
|
+
def movie *args
|
15
|
+
puts Status.wait
|
16
|
+
image = Movie.new(args, options)
|
17
|
+
image.save
|
18
|
+
puts Status.saved(image)
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "instagram URL", "Get the original picture from an Instagram page (nokaya -i url)"
|
10
22
|
map "-i" => :instagram
|
11
23
|
option :name, aliases: "-n", type: :string, desc: "Specify a file name without extension"
|
12
24
|
option :output, aliases: "-o", type: :string, desc: "Specify an output path"
|
13
25
|
def instagram *args
|
14
|
-
|
15
|
-
|
16
|
-
|
26
|
+
puts Status.wait
|
27
|
+
image = Instagram.new(args, options)
|
28
|
+
image.save
|
29
|
+
puts Status.saved(image)
|
17
30
|
end
|
18
31
|
|
19
|
-
desc "favd", 'Get the picture from a Favd page (nokaya favd url)'
|
32
|
+
desc "favd URL", 'Get the picture from a Favd page (nokaya favd url)'
|
20
33
|
option :name, aliases: "-n", type: :string, desc: "Specify a file name without extension"
|
21
34
|
option :output, aliases: "-o", type: :string, desc: "Specify an output path"
|
22
35
|
def favd *args
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
save_pic img_link, nokaya
|
36
|
+
puts Status.wait
|
37
|
+
image = Favd.new(args, options)
|
38
|
+
image.save
|
39
|
+
puts Status.saved(image)
|
28
40
|
end
|
29
41
|
|
30
|
-
desc "adn", "Get the picture from a photos.app.net page (nokaya adn url)"
|
42
|
+
desc "adn URL", "Get the picture from a photos.app.net page (nokaya adn url)"
|
31
43
|
option :name, aliases: "-n", type: :string, desc: "Specify a file name without extension"
|
32
44
|
option :output, aliases: "-o", type: :string, desc: "Specify an output path"
|
33
45
|
def adn *args
|
34
|
-
|
35
|
-
|
36
|
-
|
46
|
+
puts Status.wait
|
47
|
+
image = ADN.new(args, options)
|
48
|
+
image.save
|
49
|
+
puts Status.saved(image)
|
37
50
|
end
|
38
51
|
|
39
|
-
desc "tumblr", "Get the picture from a Tumblr post (nokaya -tu url)"
|
52
|
+
desc "tumblr URL", "Get the picture from a Tumblr post (nokaya -tu url)"
|
40
53
|
map "-tu" => :tumblr
|
41
54
|
option :name, aliases: "-n", type: :string, desc: "Specify a file name without extension"
|
42
55
|
option :output, aliases: "-o", type: :string, desc: "Specify an output path"
|
43
56
|
def tumblr *args
|
44
|
-
|
45
|
-
|
46
|
-
|
57
|
+
puts Status.wait
|
58
|
+
image = Tumblr.new(args, options)
|
59
|
+
image.save
|
60
|
+
puts Status.saved(image)
|
47
61
|
end
|
48
62
|
|
49
|
-
desc "tumblr_album", "Get all pictures from a Tumblr page (nokaya -tal url)"
|
63
|
+
desc "tumblr_album URL", "Get all pictures from a Tumblr page (nokaya -tal url)"
|
50
64
|
map "-tal" => :tumblr_album
|
51
65
|
option :output, aliases: "-o", type: :string, desc: "Specify an output path"
|
52
66
|
def tumblr_album *args
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
save_album img_links, nokaya
|
67
|
+
puts Status.wait
|
68
|
+
image = TumblrAlbum.new(args, options)
|
69
|
+
image.save
|
70
|
+
puts Status.saved_album(image)
|
58
71
|
end
|
59
72
|
|
60
|
-
desc "imgur_album", "Get all pictures from an Imgur album (nokaya -ial url)"
|
73
|
+
desc "imgur_album URL", "Get all pictures from an Imgur album (nokaya -ial url)"
|
61
74
|
map "-ial" => :imgur_album
|
62
75
|
option :output, aliases: "-o", type: :string, desc: "Specify an output path"
|
63
76
|
def imgur_album *args
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
save_album img_links, nokaya
|
77
|
+
puts Status.wait
|
78
|
+
image = ImgurAlbum.new(args, options)
|
79
|
+
image.save
|
80
|
+
puts Status.saved_album(image)
|
69
81
|
end
|
70
82
|
|
71
|
-
desc "flickr_album", "Get all pictures from a Flickr album (nokaya -fal url)"
|
83
|
+
desc "flickr_album URL", "Get all pictures from a Flickr album (nokaya -fal url)"
|
72
84
|
map "-fal" => :flickr_album
|
73
85
|
option :output, aliases: "-o", type: :string, desc: "Specify an output path"
|
74
86
|
def flickr_album *args
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
save_album img_links, nokaya
|
87
|
+
puts Status.wait
|
88
|
+
image = FlickrAlbum.new(args, options)
|
89
|
+
image.save
|
90
|
+
puts Status.saved_album(image)
|
80
91
|
end
|
81
92
|
|
82
|
-
desc "photonet", "Get all pictures from a Photo.net page (nokaya -pnet url)"
|
93
|
+
desc "photonet URL", "Get all pictures from a Photo.net page (nokaya -pnet url)"
|
83
94
|
map "-pnet" => :photonet
|
84
95
|
option :output, aliases: "-o", type: :string, desc: "Specify an output path"
|
85
96
|
def photonet *args
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
save_album img_links, nokaya
|
97
|
+
puts Status.wait
|
98
|
+
image = Photonet.new(args, options)
|
99
|
+
image.save
|
100
|
+
puts Status.saved_album(image)
|
91
101
|
end
|
92
102
|
|
93
|
-
desc "deviantart", "Get all pictures from a Deviantart gallery (nokaya -dart url)"
|
103
|
+
desc "deviantart URL", "Get all pictures from a Deviantart gallery (nokaya -dart url)"
|
94
104
|
map "-dart" => :deviantart
|
95
105
|
option :output, aliases: "-o", type: :string, desc: "Specify an output path"
|
96
106
|
def deviantart *args
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
save_album img_links, nokaya
|
107
|
+
puts Status.wait
|
108
|
+
image = Deviantart.new(args, options)
|
109
|
+
image.save
|
110
|
+
puts Status.saved_album(image)
|
102
111
|
end
|
103
112
|
|
104
|
-
desc "imageshack_user", "Get all pictures from an Imageshack user gallery (nokaya -ishu url)"
|
113
|
+
desc "imageshack_user URL", "Get all pictures from an Imageshack user gallery (nokaya -ishu url)"
|
105
114
|
map "-ishu" => :imageshack_user
|
106
115
|
option :output, aliases: "-o", type: :string, desc: "Specify an output path"
|
107
116
|
def imageshack_user *args
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
end
|
122
|
-
|
123
|
-
def check_args args
|
124
|
-
abort Status.no_url if args.empty?
|
125
|
-
end
|
126
|
-
|
127
|
-
def download_and_save img_link, nokaya
|
128
|
-
puts Status.downloading img_link
|
129
|
-
path = Image.photo_name nokaya
|
130
|
-
Image.save_image(path, img_link)
|
131
|
-
puts Status.saved path
|
132
|
-
end
|
133
|
-
|
134
|
-
def download_album img_links, nokaya
|
135
|
-
if nokaya.options[:name]
|
136
|
-
dir = "#{Dir.home}/Downloads/#{nokaya.type}-#{nokaya.options[:name]}"
|
137
|
-
else
|
138
|
-
dir = "#{Dir.home}/Downloads/#{nokaya.type}-#{Time.now.to_i}"
|
139
|
-
end
|
140
|
-
puts Status.downloading_album dir
|
141
|
-
Dir.mkdir dir
|
142
|
-
img_links.each do |link|
|
143
|
-
parsed = URI.parse link
|
144
|
-
file = "#{dir}/#{parsed.path.split("/").last}"
|
145
|
-
puts Status.saving file
|
146
|
-
Image.save_image(file, link)
|
147
|
-
end
|
148
|
-
puts Status.done
|
149
|
-
end
|
150
|
-
|
151
|
-
def save_pic img_link, nokaya
|
152
|
-
begin
|
153
|
-
download_and_save img_link, nokaya
|
154
|
-
rescue Interrupt
|
155
|
-
abort Status.canceled
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
def save_album img_links, nokaya
|
160
|
-
begin
|
161
|
-
abort Status.no_can_do if img_links.empty?
|
162
|
-
download_album img_links, nokaya
|
163
|
-
rescue Interrupt
|
164
|
-
abort Status.canceled
|
165
|
-
end
|
117
|
+
puts Status.wait
|
118
|
+
image = ImageshackUser.new(args, options)
|
119
|
+
image.save
|
120
|
+
puts Status.saved_album(image)
|
121
|
+
end
|
122
|
+
|
123
|
+
desc "version", "Displays version number and informations"
|
124
|
+
map "-v" => :version
|
125
|
+
def version
|
126
|
+
puts "\nNOKAYA\n\n"
|
127
|
+
puts "Version:\t#{VERSION}\n\n"
|
128
|
+
puts "Changelog:\thttps://github.com/ericdke/nokaya/blob/master/CHANGELOG.md\n"
|
129
|
+
puts "Help:\t\thttps://github.com/ericdke/nokaya/blob/master/README.md\n\n"
|
166
130
|
end
|
167
131
|
|
168
132
|
end
|