deltago 0.0.2 → 0.0.5

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/deltago.rb +59 -29
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9fd7e74db326209118bb96cae2c1936dc71c1ac4b546cba7b2f085f4a006ac2
4
- data.tar.gz: 36a65dced5e352fee1871cb3d8feceb8a15335dd9b09859ee4600c6dd45b04a6
3
+ metadata.gz: b0e827feaaea9ff0947ffcf1021f2961b03f84dfb3c5eba652302672b9ae2cd4
4
+ data.tar.gz: 598cd247350a0a00669634b47c40b99be565775918e4a8ba49e0b85dbd6ab7e2
5
5
  SHA512:
6
- metadata.gz: bb1128f83b9b3cdbcb189fd9394c757af020458f1d9b9a9c827553d67074ca6d2d8bc7e6e9db261f3a371550eb6e0758a9f94d619aaabbfc7a7862e7bd88bbfd
7
- data.tar.gz: 9bf06f7cd2e9f560a091124ad9047e11373f32d8b748b4ee9585738993f57b29c6ffa93a6787f115daf3e879e9ffb1ddd1bde142d2ab68d89a8a7d95178e20e8
6
+ metadata.gz: 15d3db49a69eea0c29307f97dfb50be26ad851d28dc00af478dd5f4012b1d8c05fd332b21a902a33db9d2caf6cb7a8c3b5ab37c88e09fada907d9d663a8c70be
7
+ data.tar.gz: 9ca08c8ee10de3c1044ab60f633979ddfd1a247c273ee6bfc70df9333ec014dc527b973607549e901f778aff7511c3b3ecb6157926502ea7b97a7c0564cabe26
data/lib/deltago.rb CHANGED
@@ -44,12 +44,6 @@ class Soonje
44
44
  end
45
45
  if @update_type == 1
46
46
  rand_search_memory = Array.new
47
- if @update_keyword['랜덤'] == 1
48
- ['패션의류', '패션잡화', '화장품/미용', '디지털/가전', '출산/육아', '식품', '스포츠/레저', '역사/생활편의', '면세점', '도서'].each do |key|
49
- @update_keyword[key] = 1
50
- end
51
- end
52
- p @update_keyword
53
47
  @naver_keyword.each do |key,v|
54
48
  if @update_keyword[key] == 1
55
49
  v.each do |i|
@@ -58,19 +52,14 @@ class Soonje
58
52
  end
59
53
  end
60
54
  @search_text = rand_search_memory.shuffle
61
- p @search_text
62
55
  elsif @update_type == 2
63
- if @where_search == 'random'
64
- @search_text = ['goldbox', 'rocket-fresh', 'most-discounted', 'most-sold'].shuffle
65
- else
66
- @search_text = [@where_search]
67
- end
56
+ @search_text = [@where_search]
68
57
  elsif @update_type == 3
69
58
  @search_text = @user_keyword.shuffle
70
59
  end
71
60
 
72
61
  if @update_type == 2
73
- product_data = @coupang.get_product_data2(@search_text)
62
+ product_data = @coupang.get_product_data2(@where_search)
74
63
  product_data2 = product_data.sample(counter7)
75
64
  else
76
65
  puts '검색중 ==> '+@search_text[0]
@@ -94,7 +83,20 @@ class Soonje
94
83
  puts url_memory
95
84
 
96
85
  if @title_file.length == 0
97
- title = '제목없음'
86
+ title = ''
87
+ if @title_setting1 == true
88
+ title = product_data2[0]['title'] + ' ' +title
89
+ end
90
+
91
+ if @keyword_setting1 == true
92
+ title = @search_text[0] + ' ' + title
93
+ end
94
+
95
+ if @change_text_setting1 == true
96
+ @change_memory1.each do |key,v|
97
+ title = (title+'_').split(key).join(v.shuffle[0])
98
+ end
99
+ end
98
100
  else
99
101
  title = @title_file.shuffle[0]
100
102
 
@@ -149,6 +151,9 @@ class Soonje
149
151
 
150
152
  add_text = ''
151
153
  if @add_text_setting1
154
+ if search_text[0].to_s == ''
155
+ search_text = ['가방']
156
+ end
152
157
  add_text = naver_text(@search_text[0])
153
158
  end
154
159
 
@@ -212,9 +217,7 @@ class Soonje
212
217
  if url_change_check
213
218
  link_url = change_url(link_url)
214
219
  end
215
-
216
- vv = '<img style="text-align: center;" align="center" src="'+dd['image'].to_s.split('212x212').join('500x500')+'">'
217
- vv = vv+ '<p style="text-align: center;" align="center">'+dd['productId'].to_s+' => 파일사진위치</p>'
220
+ vv = '<p style="text-align: center;" align="center">'+dd['productId'].to_s+' => 파일사진위치</p>'
218
221
  vv = vv+ '<div style="text-align: center;" align="center"><span style="font-size: 18pt;">'+dd['title']+'</span></div>'
219
222
  vv = vv+ '<div style="text-align: center;" align="center"><span style="font-size: 18pt; color: #ff4b4b;">'+dd['salesPrice'].to_s+' 원</span></div>'
220
223
  vv = vv+ '<div style="text-align: center;" align="center"><span style="font-size: 10pt;">무료배송</span></div>'
@@ -239,8 +242,12 @@ class Soonje
239
242
  vv2 += '<div style="text-align: center;" align="center">'+add_text+'</div><br>'
240
243
  end
241
244
 
242
- Dir.mkdir('./data/'+title)
243
- File.open('./data/'+title+'/'+product[0]['productId'].to_s+'.html', 'w') do |f|
245
+ begin
246
+ Dir.mkdir('./data/'+product[0]['productId'].to_s)
247
+ rescue
248
+
249
+ end
250
+ File.open('./data/'+product[0]['productId'].to_s+'/'+product[0]['productId'].to_s+'.html', 'w') do |f|
244
251
  f.write(vv2)
245
252
  end
246
253
 
@@ -253,7 +260,7 @@ class Soonje
253
260
  sleep(10)
254
261
  retry
255
262
  end
256
- File.open('./data/'+title+'/'+dd['productId'].to_s+'.jpg', 'wb') do |f|
263
+ File.open('./data/'+product[0]['productId'].to_s+'/'+dd['productId'].to_s+'.jpg', 'wb') do |f|
257
264
  f.write(http_image.body)
258
265
  end
259
266
  end
@@ -359,7 +366,7 @@ class Soonje
359
366
  end
360
367
 
361
368
  for n in 0..100
362
- text3 += text1.shuffle[0..5].join(' ')+text2.shuffle[0]
369
+ text3 += text1.shuffle[0..5].join(' ')+text2.shuffle[0].to_s
363
370
  end
364
371
 
365
372
  max_text = rand(900)+600
@@ -373,6 +380,7 @@ class Soonje
373
380
  json['mb_id'] = user_id.to_s
374
381
  json['mb_password'] = user_pw.to_s
375
382
  http = HTTP.post('http://marketingduo.co.kr/bbs/login_check.php', :form => json)
383
+ puts http.to_s
376
384
  if http.to_s.length == 0
377
385
  http = HTTP.get('http://marketingduo.co.kr/bbs/buyListManager7.php')
378
386
  noko = Nokogiri::HTML(http.to_s)
@@ -675,7 +683,7 @@ class Soonje
675
683
  @add_text_setting2 = json['@add_text_setting2']
676
684
  @tt9.checked = @add_text_setting2
677
685
  @tag_setting = json['@tag_setting']
678
- #@tt10.checked = @tag_setting
686
+ @tt10.checked = @tag_setting
679
687
  rescue
680
688
 
681
689
  end
@@ -741,7 +749,7 @@ class Soonje
741
749
  end
742
750
  }
743
751
 
744
- label('생성 딜레이'){
752
+ label('포스팅 딜레이'){
745
753
  stretchy false
746
754
  }
747
755
 
@@ -749,7 +757,7 @@ class Soonje
749
757
  stretchy false
750
758
  }
751
759
 
752
- label('생성 수량'){
760
+ label('포스팅 수량'){
753
761
  stretchy false
754
762
  }
755
763
 
@@ -757,7 +765,7 @@ class Soonje
757
765
  stretchy false
758
766
  }
759
767
 
760
- button('자동 생성 시작'){
768
+ button('자동 홍보 시작'){
761
769
  stretchy false
762
770
  on_clicked do
763
771
  if @user_login_ok == 1
@@ -768,7 +776,7 @@ class Soonje
768
776
  end
769
777
  }
770
778
 
771
- button('자동 생성 정지'){
779
+ button('자동 홍보 정지'){
772
780
  stretchy false
773
781
  on_clicked do
774
782
  stop()
@@ -1364,7 +1372,30 @@ class Soonje
1364
1372
  stretchy false
1365
1373
  }
1366
1374
 
1367
-
1375
+ =begin
1376
+ horizontal_box{
1377
+ stretchy false
1378
+ label('★ 마무리 설정'){
1379
+ stretchy false
1380
+ }
1381
+
1382
+ @tt10 = checkbox('태그 자동 입력'){
1383
+ stretchy false
1384
+ on_toggled do |c|
1385
+ @tag_setting = c.checked?
1386
+ end
1387
+ }
1388
+
1389
+ #combobox{
1390
+ # stretchy false
1391
+ # items('전체공개', '이웃공개', '서로이웃공개' , '비공개')
1392
+ # selected(0)
1393
+ # on_selected do |c|
1394
+ # @open_option = c.selected
1395
+ # end
1396
+ #}
1397
+ }
1398
+ =end
1368
1399
  }
1369
1400
  }
1370
1401
  }
@@ -1439,8 +1470,7 @@ class Coupang
1439
1470
  end
1440
1471
 
1441
1472
  def get_product_data2(where)
1442
- http = HTTP.cookies(@cookie).get('https://partners.coupang.com/api/v1/discovery/'+where[0]+'?limit=20')
1443
- puts http.to_s
1473
+ http = HTTP.cookies(@cookie).get('https://partners.coupang.com/api/v1/discovery/'+where+'?limit=20')
1444
1474
  data = JSON.parse(http.to_s)['data']['products']
1445
1475
  puts data
1446
1476
  return data
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deltago
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - soonje