Class: Soonje
Instance Attribute Summary collapse
-
#user_id ⇒ Object
Returns the value of attribute user_id.
-
#user_password ⇒ Object
Returns the value of attribute user_password.
Instance Method Summary collapse
- #change_url(url) ⇒ Object
- #html_maker(title, text_top, text_bottom, product, add_text, add_text_check, url_memory, url_change_check) ⇒ Object
- #launch ⇒ Object
- #login_check(user_id, user_pw) ⇒ Object
- #mac_check(userid) ⇒ Object
- #naver_get_item ⇒ Object
- #naver_text(t) ⇒ Object
- #robot ⇒ Object
- #stop ⇒ Object
Instance Attribute Details
#user_id ⇒ Object
Returns the value of attribute user_id.
468 469 470 |
# File 'lib/deltago.rb', line 468 def user_id @user_id end |
#user_password ⇒ Object
Returns the value of attribute user_password.
468 469 470 |
# File 'lib/deltago.rb', line 468 def user_password @user_password end |
Instance Method Details
#change_url(url) ⇒ Object
191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/deltago.rb', line 191 def change_url(url) begin http = HTTP.post('https://linkchanger-vfllz.run.goorm.io/action', :json => {'url' => url}) rescue puts '링크체인저 http 일시적 error 10 초후 재시도' sleep(10) retry end json = JSON.parse(http.to_s) return json['result'] end |
#html_maker(title, text_top, text_bottom, product, add_text, add_text_check, url_memory, url_change_check) ⇒ Object
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/deltago.rb', line 204 def html_maker(title, text_top, text_bottom, product, add_text, add_text_check, url_memory, url_change_check) vv2 = '<div style="text-align: center;" align="center"><span style="font-size: 23pt;">'+title+'</span></div><br>' vv2 += '<div style="text-align: center;" align="center"> </div><br>' vv2 += '<div style="text-align: center;" align="center"> </div><br>' vv2 += '<div style="text-align: center;" align="center"> </div><br>' vv2 += '<div style="text-align: center;" align="center"> </div><br>' vv2 += '<div style="text-align: center;" align="center">'+text_top+'</div><br>' vv2 += '<div style="text-align: center;" align="center"> </div><br>' vv2 += '<div style="text-align: center;" align="center"> </div><br>' vv2 += '<div style="text-align: center;" align="center"> </div><br>' product.each do |dd| link_url = url_memory[dd['productId']] if url_change_check link_url = change_url(link_url) end vv = '<p style="text-align: center;" align="center">'+dd['productId'].to_s+' => 파일사진위치</p>' vv = vv+ '<div style="text-align: center;" align="center"><span style="font-size: 18pt;">'+dd['title']+'</span></div>' vv = vv+ '<div style="text-align: center;" align="center"><span style="font-size: 18pt; color: #ff4b4b;">'+dd['salesPrice'].to_s+' 원</span></div>' vv = vv+ '<div style="text-align: center;" align="center"><span style="font-size: 10pt;">무료배송</span></div>' vv = vv+ '<p style="font-size: 13pt; text-align: center;" align="center"><a style="text-align: center;" href="'+link_url+'"><span style="font-size: 18pt;">상품보기</span></a></p>' vv2 += vv vv2 += '<div style="text-align: center;" align="center"> </div><br>' vv2 += '<div style="text-align: center;" align="center"> </div><br>' vv2 += '<div style="text-align: center;" align="center"> </div><br>' end vv2 += '<div style="text-align: center;" align="center"> </div><br>' vv2 += '<div style="text-align: center;" align="center"> </div><br>' vv2 += '<div style="text-align: center;" align="center"> </div><br>' vv2 += '<div style="text-align: center;" align="center">'+text_bottom+'</div><br>' hidden_text = '<canvas width="0" height="0"><table width="165" style="width: 124pt; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0"><tbody><tr height="22" style="height: 16.5pt;"><td width="165" height="22" style="width: 124pt; text-align: center; font-size: 8pt; vertical-align: bottom; white-space: nowrap;"> ' hidden_text2 = '<div id="ssp-bottom"></div></td></tr></tbody></table></canvas>' if add_text_check vv2 += '<div style="text-align: center;" align="center">'+hidden_text+add_text+hidden_text2+'</div><br>' else vv2 += '<div style="text-align: center;" align="center">'+add_text+'</div><br>' end begin Dir.mkdir('./data/'+product[0]['productId'].to_s) rescue end File.open('./data/'+product[0]['productId'].to_s+'/'+product[0]['productId'].to_s+'.html', 'w') do |f| f.write(vv2) end product.each do |dd| begin http_image = HTTP.get(dd['image'].to_s.split('212x212').join('500x500')) rescue puts '쿠팡 이미지 가저오는중 http error 10초후 재시도' sleep(10) retry end File.open('./data/'+product[0]['productId'].to_s+'/'+dd['productId'].to_s+'.jpg', 'wb') do |f| f.write(http_image.body) end end end |
#launch ⇒ Object
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 |
# File 'lib/deltago.rb', line 469 def launch @proxy_check = false @tedering_check = false @update_type = 1 @update_keyword = Hash.new @blog_data = [[false, '0', '0', '0', '0', '0']] @keyword_setting1 = false @title_file = [] @title_setting1 = false @change_text_setting1 = false @change_text_setting2 = false @change_memory1 = Hash.new @change_memory2 = Hash.new @change_memory3 = Hash.new @text_top = '' @point_change_text1 = false @point_change_text2 = false @point_product_name1 = false @point_product_name2 = false @text_bottom = '' @add_text_setting1 = false @add_text_setting2 = false @user_keyword = Array.new @where_search = 'goldbox' @proxy_list = Array.new @change_text_setting3 = false @user_login_ok = 0 @code_text = Array.new window('Contacts', 1000, 450) { margined true vertical_box { horizontal_box { stretchy false form { @user_id = entry{ label 'ID' text } @user_password = password_entry{ label 'PW' text } } ('로그인') { on_clicked { @user_login_ok = login_check(@user_id.text.to_s, @user_password.text.to_s) if @user_login_ok == 1 msg_box('로그인 성공') elsif @user_login_ok == 33 msg_box('로그인 실패') elsif @user_login_ok == 22 msg_box('권한 없음') elsif @user_login_ok == 44 msg_box('등록 기기 초과') else msg_box('실패') end } } ('세팅저장') { on_clicked { begin dd = Hash.new dd['프록시'] = @proxy_check2.checked? dd['프록시아이피'] = @proxy_list dd['테더링'] = @tedering.checked? @blog_data.each_with_index do |i,index1| i.each_with_index do |j,index2| if j.class == String begin @blog_data[index1][index2] = j.to_s.force_encoding('utf-8') rescue puts j end end end end dd['쿠팡아이디'] = @coupang_id.text.to_s dd['쿠팡비번'] = @coupang_password.text.to_s dd['포스팅딜레이'] = @post_delay.text.to_s dd['포스팅수량'] = @post_counter.text.to_s dd['포스팅갯수1'] = @counter_start.text.to_s dd['포스닝갯수2'] = @counter_end.text.to_s dd['포스팅타입1'] = @update_type dd['포스팅키워드1'] = @update_keyword dd['포스팅추천상품'] = @where_search dd['원하는상품키워드'] = @user_keyword dd['제목파일'] = @title_file dd['제목사용한키워드'] = @keyword_setting1 dd['사용한상품명'] = @title_setting1 dd['제목치환단어사용'] = @change_text_setting1 dd['제목치환파일'] = @change_memory1 dd['내용상단'] = @text_top dd['내용친환단어사용'] = @change_text_setting2 dd['내용치환파일'] = @change_memory2 dd['내용특정단어키워드'] = @point_change_text1 dd['내용특정단어키워드값'] = @point_keyword1.text.to_s dd['내용특정단어상품명'] = @point_product_name1 dd['내용특정단어상품명값'] = @point_keyword2.text.to_s dd['링크우회'] = @url_change_setting dd['@text_bottom'] = @text_bottom dd['@change_text_setting3'] = @change_text_setting3 dd['@change_memory3'] = @change_memory3 dd['@point_change_text2'] = @point_change_text2 dd['@point_keyword11'] = @point_keyword11.text.to_s dd['@point_product_name2'] = @point_product_name2 dd['@point_keyword22'] = @point_keyword22.text.to_s dd['@add_text_setting1'] = @add_text_setting1 dd['@add_text_setting2'] = @add_text_setting2 dd['@tag_setting'] = @tag_setting f = save_file dd.each do |key,v| if v.class == String dd[key] = v.force_encoding('utf-8') end end puts dd File.open(f, 'w') do |ff| ff.write(dd.to_json) end rescue end } } ('세팅로드') { on_clicked { begin f = open_file ff = File.open(f,'r').read json = JSON.parse(ff) @proxy_check2.checked = json['프록시'] @proxy_check = json['프록시'] @proxy_list = json['프록시아이피'] @tedering.checked = json['테더링'] @coupang_id.text = json['쿠팡아이디'] @coupang_password.text = json['쿠팡비번'] @post_delay.text = json['포스팅딜레이'] @post_counter.text = json['포스팅수량'] @counter_start.text = json['포스팅갯수1'] @counter_end.text = json['포스닝갯수2'] @update_type = json['포스팅타입1'] @update_keyword = json['포스팅키워드1'] @update_keyword.each do |key,v| @kk1.checked = true if key == '패션의류' @kk2.checked = true if key == '패션잡화' @kk3.checked = true if key == '화장품/미용' @kk4.checked = true if key == '디지털/가전' @kk5.checked = true if key == '출산/육아' @kk6.checked = true if key == '식품' @kk7.checked = true if key == '스포츠/레저' @kk8.checked = true if key == '역사/생활편의' @kk9.checked = true if key == '면세점' @kk10.checked = true if key == '도서' @kk11.checked = true if key == '랜덤' end if @update_type == 1 @update1.checked = true elsif @update_type == 2 @update2.checked = true elsif @update_type == 3 @update3.checked = true end @where_search = json['포스팅추천상품'] if @update_type == 2 i22 = @where_search @ss1.checked = true if i22 == 'goldbox' @ss2.checked = true if i22 == 'rocket-fresh' @ss3.checked = true if i22 == 'most-discounted' @ss4.checked = true if i22 == 'most-sold' @ss5.checked = true if i22 == 'random' end @user_keyword = json['원하는상품키워드'] @title_file = json['제목파일'] @keyword_setting1 = json['제목사용한키워드'] @title_keyword.checked = true if @keyword_setting1 @title_setting1 = json['사용한상품명'] @title_product_name.checked = true if @title_setting1 @change_text_setting1 = json['제목치환단어사용'] @title_change_text.checked = true if @change_text_setting1 @change_memory1 = json['제목치환파일'] @text_top = json['내용상단'] @change_text_setting2 = json['내용친환단어사용'] @tt1.checked = @change_text_setting2 @change_memory2 = json['내용치환파일'] @point_change_text1 = json['내용특정단어키워드'] @tt2.checked = true if @point_change_text1 @point_keyword1.text = json['내용특정단어키워드값'] @point_product_name1 = json['내용특정단어상품명'] @tt3.checked = @point_product_name1 @point_keyword2.text = json['내용특정단어상품명값'] @url_change_setting = json['링크우회'] @tt4.checked = @url_change_setting @text_bottom = json['@text_bottom'] @change_text_setting3 = json['@change_text_setting3'] @tt5.checked = @change_text_setting3 @change_memory3 = json['@change_memory3'] @point_change_text2 = json['@point_change_text2'] @tt6.checked = @point_change_text2 @point_keyword11.text = json['@point_keyword11'] @point_product_name2 = json['@point_product_name2'] @tt7.checked = json['@point_product_name2'] @point_keyword22.text = json['@point_keyword22'] @add_text_setting1 = json['@add_text_setting1'] @tt8.checked = @add_text_setting1 @add_text_setting2 = json['@add_text_setting2'] @tt9.checked = @add_text_setting2 @tag_setting = json['@tag_setting'] @tt10.checked = @tag_setting rescue end } } } tab { tab_item('실행설정'){ vertical_box { grid{ stretchy false @coupang_id = entry{ top 0 left 0 text '쿠팡 파트너스 ID(이메일) 입력' } @coupang_password = entry{ top 0 left 1 text 'PW 입력' } } #grid @code_entry = non_wrapping_multiline_entry{ text 'init' } @blog_data.shift horizontal_box { stretchy false @proxy_check2 = checkbox('프록시 사용'){ stretchy false on_toggled do |c| @proxy_check = c.checked? end } ('IP 불러오기'){ stretchy false on_clicked { begin file = open_file if file != nil file_data = File.open(file, 'r').read file_data.split("\n").each do |i| @proxy_list << i end end rescue end } } @tedering = checkbox('테더링 사용'){ stretchy false on_toggled do |c| end } label('포스팅 딜레이'){ stretchy false } @post_delay = entry{ stretchy false } label('포스팅 수량'){ stretchy false } @post_counter = entry{ stretchy false } ('자동 홍보 시작'){ stretchy false on_clicked do if @user_login_ok == 1 @thread = Thread.new do robot() end end end } ('자동 홍보 정지'){ stretchy false on_clicked do stop() end } } } } tab_item('상품설정'){ vertical_box{ horizontal_box{ stretchy false label('★ 한 포스팅에 등록할 상품 갯수'){ stretchy false } @counter_start = entry{ stretchy false } label(' ~ '){ stretchy false } @counter_end = entry{ stretchy false } label('※ 1~1 입력시 1개/ 2~2 입력시 2개/ 1~3 입력시 3개 이하 랜덤 적용'){ stretchy false } } vertical_separator { stretchy false } horizontal_box{ stretchy false @update1 = checkbox(' 쇼핑 인기 검색어 사용 (복수 체크 가능)'){ stretchy false on_toggled do |c| check = c.checked? if check == true @update_type = 1 end end } } grid { stretchy false @kk1 = checkbox('패션의류'){ top 0 left 0 on_toggled do |c| check = c.checked? if check == true @update_keyword['패션의류'] = 1 else @update_keyword['패션의류'] = nil end end } @kk2 = checkbox('패션잡화'){ top 0 left 1 on_toggled do |c| check = c.checked? if check == true @update_keyword['패션잡화'] = 1 else @update_keyword['패션잡화'] = nil end end } @kk3 = checkbox('화장품/미용'){ top 0 left 2 on_toggled do |c| check = c.checked? if check == true @update_keyword['화장품/미용'] = 1 else @update_keyword['화장품/미용'] = nil end end } @kk4 = checkbox('디지털/가전'){ top 0 left 3 on_toggled do |c| check = c.checked? if check == true @update_keyword['디지털/가전'] = 1 else @update_keyword['디지털/가전'] = nil end end } @kk5 = checkbox('출산/육아'){ top 0 left 4 on_toggled do |c| check = c.checked? if check == true @update_keyword['출산/육아'] = 1 else @update_keyword['출산/육아'] = nil end end } @kk6 = checkbox('식품'){ top 0 left 5 on_toggled do |c| check = c.checked? if check == true @update_keyword['식품'] = 1 else @update_keyword['식품'] = nil end end } @kk7 = checkbox('스포츠/레저'){ top 0 left 6 on_toggled do |c| check = c.checked? if check == true @update_keyword['스포츠/레저'] = 1 else @update_keyword['스포츠/레저'] = nil end end } @kk8 = checkbox('역사/생활편의'){ top 1 left 0 on_toggled do |c| check = c.checked? if check == true @update_keyword['역사/생활편의'] = 1 else @update_keyword['역사/생활편의'] = nil end end } @kk9 = checkbox('면세점'){ top 1 left 1 on_toggled do |c| check = c.checked? if check == true @update_keyword['면세점'] = 1 else @update_keyword['면세점'] = nil end end } @kk10 = checkbox('도서'){ top 1 left 2 on_toggled do |c| check = c.checked? if check == true @update_keyword['도서'] = 1 else @update_keyword['도서'] = nil end end } @kk11 = checkbox('랜덤'){ top 1 left 3 on_toggled do |c| check = c.checked? if check == true @update_keyword['랜덤'] = 1 else @update_keyword['랜덤'] = nil end end } } vertical_separator { stretchy false } horizontal_box{ stretchy false @update2 = checkbox(' 추천 상품 (복수 체크 가능)'){ stretchy false on_toggled do |c| check = c.checked? if check == true @update_type = 2 end end } } grid{ stretchy false @ss1 = checkbox('골드박스'){ top 0 left 0 on_toggled do |c| if c.checked? @where_search = 'goldbox' end end } @ss2 = checkbox('로켓프레시'){ top 0 left 1 on_toggled do |c| if c.checked? @where_search = 'rocket-fresh' end end } @ss3 = checkbox('할인율 높은 상품'){ top 0 left 2 on_toggled do |c| if c.checked? @where_search = 'most-discounted' end end } @ss4 = checkbox('최근 많이 팔린 상품'){ top 0 left 3 on_toggled do |c| if c.checked? @where_search = 'most-sold' end end } @ss5 = checkbox('랜덤'){ top 0 left 4 on_toggled do |c| if c.checked? @where_search = 'random' end end } } vertical_separator { stretchy false } horizontal_box{ stretchy false @update3 = checkbox(' 원하는 상품 키워드 삽입'){ stretchy false on_toggled do |c| check = c.checked? if check == true @update_type = 3 end end } ('파일 불러오기'){ stretchy false on_clicked do begin f2 = open_file if f2 != nil if @user_keyword == nil @user_keyword = Array.new end file_data = File.open(f2, 'r').read file_data.split("\n").each do |i| @user_keyword << i end end rescue end end } } vertical_separator { stretchy false } horizontal_box{ stretchy false #checkbox('이미지 형식'){ # stretchy false #} #checkbox('링크 이미지 형식'){ # stretchy false #} } } } tab_item('내용설정'){ vertical_box{ horizontal_box{ stretchy false label('★ 제목에 설정'){ stretchy false } ('제목 파일 불러오기'){ stretchy false on_clicked do begin f2 = open_file if f2 != nil file_data = File.open(f2, 'r').read @title_file = file_data.split("\n") puts @title_file end rescue end end } @title_keyword = checkbox('사용한 키워드 넣기'){ stretchy false on_toggled do |c| @keyword_setting1 = c.checked? end } @title_product_name = checkbox('사용한 상품명 넣기'){ stretchy false on_toggled do |c| @title_setting1 = c.checked? end } @title_change_text = checkbox('치환 단어 사용'){ stretchy false on_toggled do |c| @change_text_setting1 = c.checked? end } ('치환 파일 불러오기'){ stretchy false on_clicked do begin f2 = open_file if f2 != nil file_data = File.open(f2, 'r').read file_data.split("\n").each do |i| @change_memory1[i.split('>')[0]] = i.split('>')[1].split(',') puts @change_memory1 end end rescue end end } } vertical_separator { stretchy false } grid{ stretchy false label('★ 내용 상단 설정'){ top 0 left 0 } ('내용 파일 불러오기'){ top 0 left 1 on_clicked do f2 = open_file if f2 != nil file_data = File.open(f2, 'r').read @text_top = file_data.to_s end end } @tt1 = checkbox('치환(변경)단어 적용'){ top 0 left 2 on_toggled do |c| @change_text_setting2 = c.checked? end } ('치환 파일 불러오기'){ top 0 left 3 on_clicked do begin f2 = open_file if f2 != nil @change_memory2 = Hash.new file_data = File.open(f2, 'r').read file_data.split("\n").each do |i| @change_memory2[i.split('>')[0]] = i.split('>')[1].split(',') puts @change_memory2 end end rescue end end } @tt2 = checkbox('특정단어에 사용한 키워드로 변경'){ top 1 left 0 on_toggled do |c| @point_change_text1 = c.checked? end } @point_keyword1 = entry{ top 1 left 1 } @tt3 = checkbox('특정단어에 사용한 상품명으로 변경'){ top 1 left 2 on_toggled do |c| @point_product_name1 = c.checked? end } @point_keyword2 = entry{ top 1 left 3 } } vertical_separator { stretchy false } horizontal_box{ stretchy false label('★ 내용 중앙 쿠팡 광고 삽입 부분'){ stretchy false } @tt4 = checkbox(' 쿠팡파트너스 링크우회/단축도메인 사용'){ stretchy false on_toggled do |c| @url_change_setting = c.checked? end } } vertical_separator { stretchy false } grid{ stretchy false label('★ 내용 하단 설정'){ top 0 left 0 } ('내용 파일 불러오기'){ top 0 left 1 on_clicked do begin f2 = open_file if f2 != nil file_data = File.open(f2, 'r').read @text_bottom = file_data.to_s end rescue end end } @tt5 = checkbox('치환(변경)단어 적용'){ top 0 left 2 on_toggled do |c| @change_text_setting3 = c.checked? end } ('치환 파일 불러오기'){ top 0 left 3 on_clicked do begin f2 = open_file if f2 != nil @chnage_memory3 = Hash.new file_data = File.open(f2, 'r').read file_data.split("\n").each do |i| @change_memory3[i.split('>')[0]] = i.split('>')[1].split(',') end end puts @change_memory3 rescue end end } @tt6 = checkbox('특정단어에 사용한 키워드로 변경'){ top 1 left 0 on_toggled do |c| @point_change_text2 = c.checked? end } @point_keyword11 = entry{ top 1 left 1 } @tt7 = checkbox('특정단어에 사용한 상품명으로 변경'){ top 1 left 2 on_toggled do |c| @point_product_name2 = c.checked? end } @point_keyword22 = entry{ top 1 left 3 } } vertical_separator { stretchy false } horizontal_box{ stretchy false label('★ 내용 하단 추가 설정'){ stretchy false } @tt8 = checkbox('자동원고 덧붙임 ('){ stretchy false on_toggled do |c| @add_text_setting1 = c.checked? end } @tt9 = checkbox('자동원고 안보이게 히든 적용)'){ stretchy false on_toggled do |c| @add_text_setting2 = c.checked? end } } vertical_separator { stretchy false } =begin horizontal_box{ stretchy false label('★ 마무리 설정'){ stretchy false } @tt10 = checkbox('태그 자동 입력'){ stretchy false on_toggled do |c| @tag_setting = c.checked? end } #combobox{ # stretchy false # items('전체공개', '이웃공개', '서로이웃공개' , '비공개') # selected(0) # on_selected do |c| # @open_option = c.selected # end #} } =end } } } } }.show end |
#login_check(user_id, user_pw) ⇒ Object
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
# File 'lib/deltago.rb', line 377 def login_check(user_id, user_pw) json = Hash.new json['url'] = '%2Fbbs%2FbuyListManager7.php' json['mb_id'] = user_id.to_s json['mb_password'] = user_pw.to_s http = HTTP.post('http://marketingduo.co.kr/bbs/login_check.php', :form => json) puts http.to_s if http.to_s.length == 0 http = HTTP.get('http://marketingduo.co.kr/bbs/buyListManager7.php') noko = Nokogiri::HTML(http.to_s) c = noko.xpath('//*[@id="at-main"]/div/table/tbody').to_s.split('<tr>').length-1 for n in 1..c tt = noko.xpath('//*[@id="at-main"]/div/table/tbody/tr['+n.to_s+']').to_s if tt.include?(user_id.to_s) and tt.include?('오토팡 [워드프레스 자동 등록기]') if noko.xpath('//*[@id="at-main"]/div/table/tbody/tr['+n.to_s+']/td[7]/label[1]/input').to_s.include?('checked') if mac_check(user_id) == 1 return 1 else return 44 end else return 22 end end end else return 33 end end |
#mac_check(userid) ⇒ Object
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 |
# File 'lib/deltago.rb', line 407 def mac_check(userid) json = Hash.new json['mb_id'] = 'marketingduo' json['mb_password'] = 'mhhs0201' http = HTTP.post('http://marketingduo.co.kr/bbs/login_check.php', :form => json) = Hash.new http..each do |i| [i.to_s.split('=')[0]] = i.to_s.split('=')[1] end http = HTTP.().get('http://marketingduo.co.kr/bbs/board.php?bo_table=product&sca=&sfl=wr_subject&sop=and&stx='+userid) noko = Nokogiri::HTML(http.to_s) mac_history = Array.new mac_url = Array.new for n in 1..5 begin url = noko.css('#fboardlist > div.list-board > ul > li:nth-child('+n.to_s+') > div.wr-subject > a').to_s.split('href="')[1].split('"')[0] url = url.split('amp;').join('') mac_url << url rescue break end end mac_url.each do |i| http = HTTP.().get(i) noko = Nokogiri::HTML(http.to_s) title = noko.css('#at-main > div > section:nth-child(1) > article > div:nth-child(3) > div.view-content').to_s title = title.split('>')[1].split('<')[0].split("\t").join('').split("\n").join('').split(' ').join('') p title mac_history << title end mac_address, stderr, status = Open3.capture3('getmac /v') mac_address = mac_address.force_encoding('cp949').encode('utf-8').split('이더넷')[1] mac_address = mac_address.split("\n").join('').split(' ').join puts mac_address if mac_history.length >= 5 puts '최대 5대 기기 사용가능 로그인실패' return 3 else if mac_history.include?(mac_address) puts '등록 맥주소 확인 완료' return 1 else puts '신규 기기 등록' http = HTTP.().post('http://marketingduo.co.kr/bbs/write_token.php', :form => {'bo_table' => 'product'}) token = http.to_s.split('token":"')[1].split('"')[0] year = Time.now.to_s.split(' ')[0].split('-').join('') year2 = Time.now.to_s.split(' ')[1].split(':').join('') uid = year+year2 puts uid json = {'token' => token, 'uid' => uid, 'bo_table' => 'product', 'wr_id' => '0', 'wr_subject' => userid, 'wr_content' => mac_address} http = HTTP.().post('http://marketingduo.co.kr/bbs/write_update.php', :form => json) return 1 end end end |
#naver_get_item ⇒ Object
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
# File 'lib/deltago.rb', line 271 def naver_get_item answer = Hash.new mem = Hash.new mem['패션의류'] = '50000000' mem['패션잡화'] = '50000001' mem['화장품/미용'] = '50000002' mem['디지털/가전'] = '50000003' mem['가구/인테리어'] = '50000004' mem['출산/육아'] = '50000005' mem['식품'] = '50000006' mem['스포츠/레저'] = '50000007' mem['생활/건강'] = '50000008' mem['여가/생활편의'] = '50000009' mem['면세점'] = '50000010' mem['도서'] = '50005542' mem.each do |key,code| sleep(1) head = Hash.new head[:authority] = 'datalab.naver.com' head[:method] = 'POST' head[:path] = '/shoppingInsight/getKeywordRank.naver?timeUnit=date&cid='+code.to_s head[:scheme] = 'https' head['accept'] = '*/*' head['accept-encoding'] = 'gzip, deflate, br' head['accept-language'] = 'ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7' head['content-length'] = 0 head['origin'] = 'https://datalab.naver.com' head['referer'] = 'https://datalab.naver.com/' head['sec-ch-ua'] = '" Not A;Brand";v="99", "Chromium";v="101", "Google Chrome";v="101"' head['sec-ch-ua-mobile'] = '?0' head['sec-ch-ua-platform'] = '"Windows"' head['sec-fetch-dest'] = 'empty' head['sec-fetch-mode'] = 'cors' head['sec-fetch-site'] = 'same-origin' head['user-agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36' head['x-requested-with'] = 'XMLHttpRequest' begin http = HTTP.headers(head).post('https://datalab.naver.com/shoppingInsight/getKeywordRank.naver?timeUnit=date&cid='+code.to_s) rescue => exception puts exception puts 'http error 10초후 재시도' sleep(10) retry end data = JSON.parse(http.to_s) keyword = Array.new data[-1]['ranks'].each do |i| keyword << i['keyword'] end p keyword answer[key] = keyword end puts answer return answer end |
#naver_text(t) ⇒ Object
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
# File 'lib/deltago.rb', line 327 def naver_text(t) text1 = Array.new text2 = Array.new text3 = '' for page in 2..3 error = 0 counter = 0 begin http = HTTP.get('https://search.naver.com/search.naver?display=15&f=&filetype=0&page='+page.to_s+'&query='+t.to_s+'&research_url=&sm=tab_pge&start='+(1+(page-2)*15).to_s+'&where=web') rescue puts '네이버 문자열 수집중 http error 10초후 재시도 -> ('+counter.to_s+')' sleep(10) counter += 1 if counter > 3 retry else error = 1 puts '네이버 문자열 수집 http pass' end end if error == 0 noko = Nokogiri::HTML(http.to_s) for y in 1..15 begin t = noko.xpath('//*[@id="web_'+y.to_s+'"]/div/div[3]/div/a/div').to_s.split('">')[1].split('</div>')[0].to_s rescue t = '' end if t != '' t.split(' ').each do |i| if i[-2..-1] == '요.' or i[-2..-1] == '다.' text2 << i else text1 << i end end end end end end for n in 0..100 text3 += text1.shuffle[0..5].join(' ')+text2.shuffle[0].to_s end max_text = rand(900)+600 text3 = text3[0..max_text] return text3 end |
#robot ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/deltago.rb', line 10 def robot if @post_counter.text.to_i == 0 msg_box('수량을 적어주세요') else @word = Hash.new @coupang = Coupang.new @coupang.login(@coupang_id.text, @coupang_password.text) @naver_keyword = naver_get_item() for counter100 in 1..@post_counter.text.to_i if @tedering.checked? puts 'tedering ip change...' stdout, stderr, status = Open3.capture3('adb devices') if status.success? device_id = stdout.split("\n")[1].split("\t")[0] puts device_id puts 'adb -s '+device_id+' shell svc data disable' stdout2, stderr2, status2 = Open3.capture3('adb -s '+device_id+' shell svc data disable') sleep(3) puts 'adb -s '+device_id+' shell svc data enable' Open3.capture3('adb -s '+device_id+' shell svc data enable') sleep(3) puts 'adb ok' else puts 'adb error pass' end end @search_text = '' s2 = @counter_start.text.to_i e2 = @counter_end.text.to_i if s2 == e2 counter7 = s2 else counter7 = rand(s2..e2) end if @update_type == 1 rand_search_memory = Array.new @naver_keyword.each do |key,v| if @update_keyword[key] == 1 v.each do |i| rand_search_memory << i end end end @search_text = rand_search_memory.shuffle elsif @update_type == 2 @search_text = [@where_search] elsif @update_type == 3 @search_text = @user_keyword.shuffle end if @update_type == 2 product_data = @coupang.get_product_data2(@where_search) product_data2 = product_data.sample(counter7) else puts '검색중 ==> '+@search_text[0] product_data = @coupang.get_product_data(@search_text[0]) if product_data.length == 0 puts '쿠팡 검색 갯수 = 0 다시검색' product_data = @coupang.get_product_data(@search_text[1]) end product_data2 = product_data.sample(counter7) end url_memory = Hash.new puts '쿠팡 파트너스 상품 url 얻는중 ...' product_data2.each do |data3| url_memory[data3['productId']] = @coupang.get_product_url(data3) end puts product_data2 puts url_memory if @title_file.length == 0 title = '' if @title_setting1 == true title = product_data2[0]['title'] + ' ' +title end if @keyword_setting1 == true title = @search_text[0] + ' ' + title end if @change_text_setting1 == true @change_memory1.each do |key,v| title = (title+'_').split(key).join(v.shuffle[0]) end end else title = @title_file.shuffle[0] if @title_setting1 == true title = product_data2[0]['title'] + ' ' +title end if @keyword_setting1 == true title = @search_text[0] + ' ' + title end if @change_text_setting1 == true @change_memory1.each do |key,v| title = (title+'_').split(key).join(v.shuffle[0]) end end end text_top = @text_top.to_s.force_encoding('utf-8')+'_' if text_top != '' if @tt1.checked? @change_memory2.each do |key,v| text_top = text_top.split(key).join(v.shuffle[0]) end end if @point_change_text1 text_top = text_top.split(@point_keyword1.text.force_encoding('utf-8')).join(@search_text[0].force_encoding('utf-8')) end if @point_product_name1 text_top = text_top.split(@point_keyword2.text.force_encoding('utf-8')).join(product_data2[0]['title'].force_encoding('utf-8')) end end text_bottom = '_'+@text_bottom.to_s.force_encoding('utf-8')+'_' if text_bottom != '' if @change_text_setting3 @change_memory3.each do |key,v| text_bottom = text_bottom.split(key).join(v.shuffle[0]) end end if @point_change_text2 text_bottom = text_bottom.split(@point_keyword11.text.force_encoding('utf-8')).join(@search_text[0].force_encoding('utf-8')) end if @point_product_name2 text_bottom = text_bottom.sub(@point_keyword22.text.force_encoding('utf-8'), product_data2[0]['title'].force_encoding('utf-8')) end end add_text = '' if @add_text_setting1 if search_text[0].to_s == '' search_text = ['가방'] end add_text = naver_text(@search_text[0]) end add_text_check = @add_text_setting2 if @tag_setting search_text = @search_text[0] else search_text = '' end title = title.to_s.split('_').join('') text_top = text_top.to_s.split('_').join('') text_bottom = text_bottom.to_s.split('_').join('') #@word[blog[1]].update(product_data2, url_memory, title, text_top, text_bottom, add_text, add_text_check, category, @tag_setting ,@search_text[0], @url_change_setting, @proxy_check2.checked?, @proxy_list.shuffle[0]) html_maker(title, text_top, text_bottom, product_data2, add_text, add_text_check, url_memory, @url_change_setting) @code_text << Time.now.to_s+ ' => ' + product_data2[0]['productId'].to_s+'.html 생성완료' @code_entry.text = @code_text.join("\n") #blog[5] = (blog[5].to_i+1).to_s #puts blog[1].to_s.force_encoding('utf-8')+' => 상품등록완료 누적 등록 수 ('+blog[5].to_s.force_encoding('utf-8')+')' sleep(@post_delay.text.to_s.to_i) end end end |
#stop ⇒ Object
183 184 185 186 187 188 189 |
# File 'lib/deltago.rb', line 183 def stop begin @thread.kill rescue end end |