nokaya 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +31 -1
- data/lib/nokaya/app.rb +46 -9
- data/lib/nokaya/getter.rb +29 -1
- data/lib/nokaya/status.rb +8 -2
- data/lib/nokaya/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c1c8545782a4967ed49ae24e36af26da579d3f2
|
4
|
+
data.tar.gz: b9e882f85dfa3d2d5a04c79473b7028e6241660b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7e0c47f94bd19ab9eed7a04e84b732ae4e8118bcf6e47ff385f68164efcd67549d0c17f2d874ad78338a84e5bd017073b116ba0cb3df80f6d7b2a8fe9464d61
|
7
|
+
data.tar.gz: d22521d67712ecc3e6d178f01662c9306a591e1ea4aea36d8836f409325e74b8954c14f178431fa4dd057487fe931bc2de57f2233f9750daa49f79e327e1f4c6
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Nokaya
|
2
2
|
|
3
|
-
CLI to download photos from several online services including Instagram, Imgur albums, Flickr albums, App.net, Tumblr
|
3
|
+
CLI to download photos from several online services including Instagram, Imgur albums, Flickr albums, App.net, Tumblr pages, Photo.net, Deviantart, etc.
|
4
4
|
|
5
5
|
Mac OS X only for the time being.
|
6
6
|
|
@@ -74,6 +74,36 @@ Example:
|
|
74
74
|
|
75
75
|
Downloads all images in the album.
|
76
76
|
|
77
|
+
### Photo.net page
|
78
|
+
|
79
|
+
`nokaya -pnet url`
|
80
|
+
|
81
|
+
Example:
|
82
|
+
|
83
|
+
`nokaya -pnet http://photo.net/gallery/photocritique/filter\?period\=365\&rank_by\=sum\&category\=Architecture\&store_prefs_p\=0`
|
84
|
+
|
85
|
+
Downloads all images in the page.
|
86
|
+
|
87
|
+
### Deviantart gallery
|
88
|
+
|
89
|
+
`nokaya -dart url`
|
90
|
+
|
91
|
+
Example:
|
92
|
+
|
93
|
+
`nokaya -dart http://www.deviantart.com/photography/nature/waterscapes/`
|
94
|
+
|
95
|
+
Downloads all images in the gallery.
|
96
|
+
|
97
|
+
### Imageshack user gallery
|
98
|
+
|
99
|
+
`nokaya -ishu url`
|
100
|
+
|
101
|
+
Example:
|
102
|
+
|
103
|
+
`nokaya -ishu https://imageshack.com/user/ToddGilbert`
|
104
|
+
|
105
|
+
Downloads all images in the user gallery.
|
106
|
+
|
77
107
|
### Favd
|
78
108
|
|
79
109
|
`nokaya favd url`
|
data/lib/nokaya/app.rb
CHANGED
@@ -6,7 +6,7 @@ module Nokaya
|
|
6
6
|
require_relative 'image'
|
7
7
|
require_relative 'status'
|
8
8
|
|
9
|
-
desc "instagram", "Get the
|
9
|
+
desc "instagram", "Get the original picture from an Instagram page (nokaya -i url)"
|
10
10
|
map "-i" => :instagram
|
11
11
|
option :name, aliases: "-n", type: :string, desc: "Specify a file name without extension"
|
12
12
|
def instagram *args
|
@@ -15,7 +15,7 @@ module Nokaya
|
|
15
15
|
basic nokaya
|
16
16
|
end
|
17
17
|
|
18
|
-
desc "favd", 'Get the
|
18
|
+
desc "favd", 'Get the picture from a Favd page (nokaya favd url)'
|
19
19
|
option :name, aliases: "-n", type: :string, desc: "Specify a file name without extension"
|
20
20
|
def favd *args
|
21
21
|
check_args args
|
@@ -25,7 +25,7 @@ module Nokaya
|
|
25
25
|
save_pic img_link, nokaya
|
26
26
|
end
|
27
27
|
|
28
|
-
desc "adn", "Get the
|
28
|
+
desc "adn", "Get the picture from a photos.app.net page (nokaya adn url)"
|
29
29
|
option :name, aliases: "-n", type: :string, desc: "Specify a file name without extension"
|
30
30
|
def adn *args
|
31
31
|
check_args args
|
@@ -33,7 +33,7 @@ module Nokaya
|
|
33
33
|
basic nokaya
|
34
34
|
end
|
35
35
|
|
36
|
-
desc "tumblr", "Get the
|
36
|
+
desc "tumblr", "Get the picture from a Tumblr post (nokaya -tu url)"
|
37
37
|
map "-tu" => :tumblr
|
38
38
|
option :name, aliases: "-n", type: :string, desc: "Specify a file name without extension"
|
39
39
|
def tumblr *args
|
@@ -42,7 +42,7 @@ module Nokaya
|
|
42
42
|
basic nokaya
|
43
43
|
end
|
44
44
|
|
45
|
-
desc "tumblr_album", "Get all
|
45
|
+
desc "tumblr_album", "Get all pictures from a Tumblr page (nokaya -tal url)"
|
46
46
|
map "-tal" => :tumblr_album
|
47
47
|
def tumblr_album *args
|
48
48
|
check_args args
|
@@ -52,7 +52,7 @@ module Nokaya
|
|
52
52
|
save_album img_links, nokaya
|
53
53
|
end
|
54
54
|
|
55
|
-
desc "imgur_album", "Get all
|
55
|
+
desc "imgur_album", "Get all pictures from an Imgur album (nokaya -ial url)"
|
56
56
|
map "-ial" => :imgur_album
|
57
57
|
def imgur_album *args
|
58
58
|
check_args args
|
@@ -62,7 +62,7 @@ module Nokaya
|
|
62
62
|
save_album img_links, nokaya
|
63
63
|
end
|
64
64
|
|
65
|
-
desc "flickr_album", "Get all
|
65
|
+
desc "flickr_album", "Get all pictures from a Flickr album (nokaya -fal url)"
|
66
66
|
map "-fal" => :flickr_album
|
67
67
|
def flickr_album *args
|
68
68
|
check_args args
|
@@ -72,6 +72,36 @@ module Nokaya
|
|
72
72
|
save_album img_links, nokaya
|
73
73
|
end
|
74
74
|
|
75
|
+
desc "photonet", "Get all pictures from a Photo.net page (nokaya -pnet url)"
|
76
|
+
map "-pnet" => :photonet
|
77
|
+
def photonet *args
|
78
|
+
check_args args
|
79
|
+
nokaya = Getter.new options, :photonet, args
|
80
|
+
page = nokaya.parse_page
|
81
|
+
img_links = nokaya.get_photonet_album page
|
82
|
+
save_album img_links, nokaya
|
83
|
+
end
|
84
|
+
|
85
|
+
desc "deviantart", "Get all pictures from a Deviantart gallery (nokaya -dart url)"
|
86
|
+
map "-dart" => :deviantart
|
87
|
+
def deviantart *args
|
88
|
+
check_args args
|
89
|
+
nokaya = Getter.new options, :deviantart, args
|
90
|
+
page = nokaya.parse_page
|
91
|
+
img_links = nokaya.get_deviantart page
|
92
|
+
save_album img_links, nokaya
|
93
|
+
end
|
94
|
+
|
95
|
+
desc "imageshack_user", "Get all pictures from an Imageshack user gallery (nokaya -ishu url)"
|
96
|
+
map "-ishu" => :imageshack_user
|
97
|
+
def imageshack_user *args
|
98
|
+
check_args args
|
99
|
+
nokaya = Getter.new({name: "#{args[0].split("/").last}"}, :imageshack_user, args)
|
100
|
+
page = nokaya.parse_page
|
101
|
+
img_links = nokaya.get_imageshack_user page
|
102
|
+
save_album img_links, nokaya
|
103
|
+
end
|
104
|
+
|
75
105
|
private
|
76
106
|
|
77
107
|
def basic nokaya
|
@@ -92,10 +122,16 @@ module Nokaya
|
|
92
122
|
end
|
93
123
|
|
94
124
|
def download_album img_links, nokaya
|
95
|
-
|
125
|
+
if nokaya.options[:name]
|
126
|
+
dir = "#{Dir.home}/Downloads/#{nokaya.type}-#{nokaya.options[:name]}"
|
127
|
+
else
|
128
|
+
dir = "#{Dir.home}/Downloads/#{nokaya.type}-#{Time.now.to_i}"
|
129
|
+
end
|
130
|
+
puts Status.downloading_album dir
|
131
|
+
Dir.mkdir dir
|
96
132
|
img_links.each do |link|
|
97
133
|
parsed = URI.parse link
|
98
|
-
file = "#{
|
134
|
+
file = "#{dir}/#{parsed.path.split("/").last}"
|
99
135
|
puts Status.saving file
|
100
136
|
Image.save_image(file, link)
|
101
137
|
end
|
@@ -112,6 +148,7 @@ module Nokaya
|
|
112
148
|
|
113
149
|
def save_album img_links, nokaya
|
114
150
|
begin
|
151
|
+
abort Status.no_can_do if img_links.empty?
|
115
152
|
download_album img_links, nokaya
|
116
153
|
rescue Interrupt
|
117
154
|
abort Status.canceled
|
data/lib/nokaya/getter.rb
CHANGED
@@ -22,6 +22,26 @@ module Nokaya
|
|
22
22
|
def get_favd page
|
23
23
|
page.css('#largeImage')[0]['src']
|
24
24
|
end
|
25
|
+
def get_deviantart page
|
26
|
+
refs = page.css('a.thumb')
|
27
|
+
links = []
|
28
|
+
refs.each {|li| links << li['data-super-img']}
|
29
|
+
links
|
30
|
+
end
|
31
|
+
def get_imageshack_user page
|
32
|
+
refs = page.css('a.hero-wrapper')
|
33
|
+
temp = []
|
34
|
+
links = []
|
35
|
+
refs.each {|li| temp << "https://imageshack.com#{li['href']}"}
|
36
|
+
puts Status.toresolve temp.length
|
37
|
+
temp.each do |p|
|
38
|
+
puts Status.resolving p
|
39
|
+
picpage = Nokogiri::HTML(open p)
|
40
|
+
ref = picpage.css('figure.image img')
|
41
|
+
links << "http:#{ref[0]['src']}"
|
42
|
+
end
|
43
|
+
links
|
44
|
+
end
|
25
45
|
def get_imgur_album page
|
26
46
|
refs = page.css('#imagelist .posts .post a')
|
27
47
|
links = []
|
@@ -29,7 +49,7 @@ module Nokaya
|
|
29
49
|
links
|
30
50
|
end
|
31
51
|
def get_tumblr_album page
|
32
|
-
queries = ['img.photo', '.post .photo a img', '.entry img', 'article img', '.image img', '.item_content img', 'img.post-image', '.box img', '#allposts img', '.media img', '.wide img', '.big img', '.large img', '.gallery img', '.photos img', 'img']
|
52
|
+
queries = ['img.photo', '.post .photo a img', '.entry img', 'article img', '.image img', '.item_content img', 'img.post-image', '.box img', '#allposts img', '.media img', '.wide img', '.big img', '.large img', '.gallery img', '.photos img', '.content img', 'img']
|
33
53
|
queries.each do |query|
|
34
54
|
@refs = page.css query
|
35
55
|
next if @refs.empty?
|
@@ -50,6 +70,14 @@ module Nokaya
|
|
50
70
|
refs.each {|l| links << l['data-defer-src']}
|
51
71
|
links
|
52
72
|
end
|
73
|
+
def get_photonet_album page
|
74
|
+
refs = page.css '.trp-top a'
|
75
|
+
links = []
|
76
|
+
refs.each do |lin|
|
77
|
+
links << "http://gallery.photo.net/photo/#{lin['href'].split("=").last}-lg.jpg"
|
78
|
+
end
|
79
|
+
links
|
80
|
+
end
|
53
81
|
def parse_page
|
54
82
|
Nokogiri::HTML(open @args.url)
|
55
83
|
end
|
data/lib/nokaya/status.rb
CHANGED
@@ -25,8 +25,14 @@ module Nokaya
|
|
25
25
|
def self.done
|
26
26
|
"\nDone.\n\n"
|
27
27
|
end
|
28
|
-
def self.downloading_album
|
29
|
-
"\nDownloading album at #{
|
28
|
+
def self.downloading_album dir
|
29
|
+
"\nDownloading album at #{dir}/...\n\n"
|
30
|
+
end
|
31
|
+
def self.toresolve number
|
32
|
+
"\n#{number} links to resolve.\n\n"
|
33
|
+
end
|
34
|
+
def self.resolving p
|
35
|
+
"Resolving #{p}...\n"
|
30
36
|
end
|
31
37
|
end
|
32
38
|
end
|
data/lib/nokaya/version.rb
CHANGED