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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bfaaca59bb32617d0aaa5baaf5719bce56af6540
4
- data.tar.gz: e3113b039ae77a8b2264de0fa4c6db5e984f736e
3
+ metadata.gz: 7a8bc730be34c83aee0865c0e1c0fb269c0a15bf
4
+ data.tar.gz: a3fb50dab1917d381d01bb14b31a30ca0a39eab6
5
5
  SHA512:
6
- metadata.gz: 9531657d52de1ccac200303bad7b04ea4e12ee4a67560695076437e9f3b6e38e776aa5cca3221412e0e517a3d6ad00b3bce90a7514e10892820752ef081f1026
7
- data.tar.gz: 08eba800eb512b34ee36048207d27de4d99e60e84d73369c5b136e37819d275583b0dab763f7bff9831e69f6a7914190e4cf67fd2e7abf139cb9c0a8f095a9ee
6
+ metadata.gz: 340a8ff304170008a542177ae015ea2885ac6b86bc76affdc4b63dea96b794a0b42d9d8e78924cf9d3452caed08ca2d8400f81178794475f63391ba1c99990aa
7
+ data.tar.gz: f19a0c706273eeead12354c26a3ac58911911ed56809b24efdab5d55cf9a81b7adf746282973ee3ab2e61a1fa1de8a04615c67002d8b601c0692879311dd22bd
@@ -1,3 +1,8 @@
1
+ # 0.0.4
2
+
3
+ - Tumblr
4
+ - Imgur album
5
+
1
6
  # 0.0.3
2
7
 
3
8
  - Favd
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
 
@@ -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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Nokaya
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nokaya
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Dejonckheere