nokaya 0.0.3 → 0.0.4
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 +31 -3
- data/lib/nokaya/app.rb +32 -0
- data/lib/nokaya/getter.rb +6 -0
- 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: 7a8bc730be34c83aee0865c0e1c0fb269c0a15bf
|
4
|
+
data.tar.gz: a3fb50dab1917d381d01bb14b31a30ca0a39eab6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 340a8ff304170008a542177ae015ea2885ac6b86bc76affdc4b63dea96b794a0b42d9d8e78924cf9d3452caed08ca2d8400f81178794475f63391ba1c99990aa
|
7
|
+
data.tar.gz: f19a0c706273eeead12354c26a3ac58911911ed56809b24efdab5d55cf9a81b7adf746282973ee3ab2e61a1fa1de8a04615c67002d8b601c0692879311dd22bd
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -14,7 +14,11 @@ Mac OS X only for the time being.
|
|
14
14
|
|
15
15
|
`nokaya -i url`
|
16
16
|
|
17
|
-
`nokaya -i url -n file_name`
|
17
|
+
`nokaya -i url -n file_name`
|
18
|
+
|
19
|
+
`nokaya -i url -n 'file name'`
|
20
|
+
|
21
|
+
Also accepts the IFTTT format (like 'http://ift.tt/1m2Nvz8').
|
18
22
|
|
19
23
|
Example:
|
20
24
|
|
@@ -22,11 +26,35 @@ Example:
|
|
22
26
|
|
23
27
|
`nokaya -i http://instagram.com/p/noANAfjJ7B/ -n happydog`
|
24
28
|
|
29
|
+
`nokaya -i http://ift.tt/1m2Nvz8 -n pasta`
|
30
|
+
|
31
|
+
### Tumblr
|
32
|
+
|
33
|
+
`nokaya -t url`
|
34
|
+
|
35
|
+
`nokaya -t url -n file_name`
|
36
|
+
|
37
|
+
Example:
|
38
|
+
|
39
|
+
`nokaya -t http://spacequest.tumblr.com/post/83560738152/sexycomics-carlos-valenzuela`
|
40
|
+
|
41
|
+
`nokaya -t http://spacequest.tumblr.com/post/83560738152/sexycomics-carlos-valenzuela -n 'girl and monster'`
|
42
|
+
|
43
|
+
### Imgur album
|
44
|
+
|
45
|
+
`nokaya -ial url`
|
46
|
+
|
47
|
+
Example:
|
48
|
+
|
49
|
+
`nokaya -ial http://imgur.com/a/JNzjB\#0`
|
50
|
+
|
51
|
+
Downloads all images in the album.
|
52
|
+
|
25
53
|
### Favd
|
26
54
|
|
27
55
|
`nokaya favd url`
|
28
56
|
|
29
|
-
`nokaya favd url -n file_name`
|
57
|
+
`nokaya favd url -n file_name`
|
30
58
|
|
31
59
|
Example:
|
32
60
|
|
@@ -38,7 +66,7 @@ Example:
|
|
38
66
|
|
39
67
|
`nokaya adn url`
|
40
68
|
|
41
|
-
`nokaya adn url -n file_name`
|
69
|
+
`nokaya adn url -n file_name`
|
42
70
|
|
43
71
|
Example:
|
44
72
|
|
data/lib/nokaya/app.rb
CHANGED
@@ -37,6 +37,27 @@ module Nokaya
|
|
37
37
|
download_and_save img_link, nokaya
|
38
38
|
end
|
39
39
|
|
40
|
+
desc "tumblr", "Get the photo from a Tumblr photo page (nokaya -t url)"
|
41
|
+
map "-t" => :tumblr
|
42
|
+
option :name, aliases: "-n", type: :string, desc: "Specify a file name without extension"
|
43
|
+
def tumblr *args
|
44
|
+
abort Status.no_url if args.empty?
|
45
|
+
nokaya = Getter.new options, :tumblr, args
|
46
|
+
page = nokaya.parse_page
|
47
|
+
img_link = nokaya.get_basic page
|
48
|
+
download_and_save img_link, nokaya
|
49
|
+
end
|
50
|
+
|
51
|
+
desc "imgur_album", "Get all images from an Imgur album (nokaya -ial url)"
|
52
|
+
map "-ial" => :imgur_album
|
53
|
+
def imgur_album *args
|
54
|
+
abort Status.no_url if args.empty?
|
55
|
+
nokaya = Getter.new options, :imgur_album, args
|
56
|
+
page = nokaya.parse_page
|
57
|
+
img_links = nokaya.get_imgur_album page
|
58
|
+
download_album img_links, nokaya
|
59
|
+
end
|
60
|
+
|
40
61
|
private
|
41
62
|
|
42
63
|
def download_and_save img_link, nokaya
|
@@ -46,5 +67,16 @@ module Nokaya
|
|
46
67
|
puts Status.saved path
|
47
68
|
end
|
48
69
|
|
70
|
+
def download_album img_links, nokaya
|
71
|
+
puts "\nDownloading album at #{nokaya.url}...\n\n"
|
72
|
+
img_links.each do |link|
|
73
|
+
parsed = URI.parse link
|
74
|
+
file = "#{Dir.home}/Downloads#{parsed.path}"
|
75
|
+
puts "Saving #{file}\n"
|
76
|
+
Image.save_image(file, nokaya.get_image(link))
|
77
|
+
end
|
78
|
+
puts "\nDone.\n\n"
|
79
|
+
end
|
80
|
+
|
49
81
|
end
|
50
82
|
end
|
data/lib/nokaya/getter.rb
CHANGED
@@ -29,6 +29,12 @@ module Nokaya
|
|
29
29
|
def get_favd page
|
30
30
|
page.css('#largeImage')[0]['src']
|
31
31
|
end
|
32
|
+
def get_imgur_album page
|
33
|
+
refs = page.css('#imagelist .posts .post a')
|
34
|
+
links = []
|
35
|
+
refs.each {|l| links << "http:#{l['href']}"}
|
36
|
+
links
|
37
|
+
end
|
32
38
|
def parse_page
|
33
39
|
Nokogiri::HTML get_page_content
|
34
40
|
end
|
data/lib/nokaya/version.rb
CHANGED