deltago4 0.0.1 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/deltago4.rb +39 -21
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ac9615382974b272b128b0aedd7b47931a4278974f9dc5e04add49b91ae4dd6
4
- data.tar.gz: 8a18a10f98479fad7778798dbf53cc1b1dcf284e01499eb88653daa95bb686ce
3
+ metadata.gz: c1e24fc3f24e34fb59aef872873e52961a64907ad31fcf17b824091219c42daf
4
+ data.tar.gz: 959139b0284aa162ebec0a8799d976590b63a78993aac6d88df8b7ab7593daa7
5
5
  SHA512:
6
- metadata.gz: 65648b78c964c843ea7d2f25042e78fe9177561823ef3348d330ef8ed3a8c5b0b36fb4399fbfb92506b4ed7693c27745e033cbbd934661306190c253fd2af1d2
7
- data.tar.gz: 3fe98e759531436c6ce3ede5281c6328be7a1345d3779a2d9eaa2db8d2e4283ffd2190b4a17df4e6254de002512b57ff9411aea6e0119dbf51eca2501868f24d
6
+ metadata.gz: f9715cea2723c56e9156887f40df041a91946455b8b80f8ff9c2bdf84a75fd8d1296d63e24558e09b180ce3addae9b4a4f6d94c8be41cb2d75639356bfb5a376
7
+ data.tar.gz: 3363864cab1f2b5c21175bb7b7fc2e31537a10d49b48d4288cd5f1019a1a9328efd1ae8744fd9f5734421338e16b4da6bc06ec4d6f1d91eef6ce255d4364539a
data/lib/deltago4.rb CHANGED
@@ -93,24 +93,33 @@ class Soonje
93
93
  puts product_data2
94
94
  puts url_memory
95
95
 
96
- if @title_file.length == 0
97
- title = ''
98
-
99
- if @title_setting1 == true
100
- title = product_data2[0]['title'] + ' ' +title
101
- end
96
+ if false
97
+ title = ' '
98
+ begin
99
+ if @title_setting1 == true
100
+ title = product_data2[0]['title'] + ' ' +title
101
+ end
102
102
 
103
- if @keyword_setting1 == true
104
- title = @search_text[0] + ' ' + title
105
- end
103
+ if @keyword_setting1 == true
104
+ title = @search_text[0] + ' ' + title
105
+ end
106
106
 
107
- if @change_text_setting1 == true
108
- @change_memory1.each do |key,v|
109
- title = (title+'_').split(key).join(v.shuffle[0])
107
+ if @change_text_setting1 == true
108
+ @change_memory1.each do |key,v|
109
+ title = (title+'_').split(key).join(v.shuffle[0])
110
+ end
110
111
  end
112
+ rescue
113
+
111
114
  end
112
115
  else
113
- title = @title_file.shuffle[0]
116
+ begin
117
+ title = @title_file.shuffle[0]
118
+ rescue
119
+ title = ''
120
+ end
121
+
122
+ title = title.to_s
114
123
 
115
124
  if @title_setting1 == true
116
125
  title = product_data2[0]['title'] + ' ' +title
@@ -258,6 +267,8 @@ class Soonje
258
267
  rescue
259
268
 
260
269
  end
270
+ sleep(2)
271
+
261
272
  File.open('./data/'+title+'/'+product[0]['productId'].to_s+'.html', 'w') do |f|
262
273
  f.write(vv2)
263
274
  end
@@ -319,14 +330,20 @@ class Soonje
319
330
  http = HTTP.headers(head).post('https://datalab.naver.com/shoppingInsight/getKeywordRank.naver?timeUnit=date&cid='+code.to_s)
320
331
  rescue => exception
321
332
  puts exception
322
- puts 'http error 10초후 재시도'
323
- sleep(10)
324
- retry
325
333
  end
326
- data = JSON.parse(http.to_s)
327
- keyword = Array.new
328
- data[-1]['ranks'].each do |i|
329
- keyword << i['keyword']
334
+ begin
335
+ data = JSON.parse(http.to_s)
336
+ keyword = Array.new
337
+ puts data
338
+ begin
339
+ data[-1]['ranks'].each do |i|
340
+ keyword << i['keyword']
341
+ end
342
+ rescue
343
+
344
+ end
345
+ rescue
346
+
330
347
  end
331
348
  p keyword
332
349
  answer[key] = keyword
@@ -359,7 +376,8 @@ class Soonje
359
376
  noko = Nokogiri::HTML(http.to_s)
360
377
  for y in 1..15
361
378
  begin
362
- t = noko.xpath('//*[@id="web_'+y.to_s+'"]/div/div[3]/div/a/div').to_s.split('">')[1].split('</div>')[0].to_s
379
+ t = noko.xpath('//*[@id="main_pack"]/section[1]/div/ul/li['+y.to_s+']/div/div[3]/div/a[2]/div').text.to_s
380
+
363
381
  rescue
364
382
  t = ''
365
383
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deltago4
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
- - rnjstnswp123
7
+ - soonje
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2018-04-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: File to Clipboard gem
14
- email: rnjstnswp123@naver.com
14
+ email: rnjsalwl123@gmail.com
15
15
  executables: []
16
16
  extensions: []
17
17
  extra_rdoc_files: []
@@ -36,7 +36,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
36
36
  - !ruby/object:Gem::Version
37
37
  version: '0'
38
38
  requirements: []
39
- rubygems_version: 3.3.7
39
+ rubygems_version: 3.4.10
40
40
  signing_key:
41
41
  specification_version: 4
42
42
  summary: file to clipboard