zon_blog_comment 0.0.20 → 0.0.23
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.
- checksums.yaml +4 -4
- data/lib/zon_blog_comment.rb +43 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc2083b854e36d9f26fccbee64c6f4367dadea635b9679e9185fc0d239df9475
|
4
|
+
data.tar.gz: e1c4596daeec38773fba5ec80dca42ea64e67bb40a01babd891e9d5ecc913ce0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22206eb79d5b4d9ca5e40278b76b30af44ad2725d3ce8b4c7f77ac34c2a1d9e85b900b6785c6871e605f2453c4cfb26b5d9f65d76c915cf57fb640de60601bfa
|
7
|
+
data.tar.gz: f7310f5fcd2f57ef56e62ceedce0f00936d1367db3541d3c7e8b13c9a5510d398ed8985991bf88e650f05d57394b8f6a853919f6cce6c9c14727f5df001cf676
|
data/lib/zon_blog_comment.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'glimmer-dsl-libui'
|
2
2
|
require 'selenium-webdriver'
|
3
|
-
|
3
|
+
require 'webdrivers'
|
4
4
|
require 'iconv'
|
5
5
|
require 'nokogiri'
|
6
6
|
require 'http'
|
@@ -21,17 +21,43 @@ include AutoClickMethods
|
|
21
21
|
using Rainbow
|
22
22
|
include Glimmer
|
23
23
|
|
24
|
+
|
24
25
|
class Naver
|
25
26
|
def initialize
|
26
27
|
@seed = 1
|
28
|
+
|
29
|
+
begin
|
30
|
+
# webdrivers가 사용자의 Chrome 버전에 맞는 chromedriver 다운로드 시도
|
31
|
+
|
32
|
+
# Webdrivers가 드라이버를 다운로드할 경로를 설정
|
33
|
+
Webdrivers.cache_time = 86_400 # 하루로 설정 (기본값: 86_400초)
|
34
|
+
Webdrivers.install_dir = "./" # 크롬드라이버를 수동으로 설치할 경로를 설정
|
35
|
+
# 크롬드라이버 자동 업데이트 시도
|
36
|
+
Webdrivers::Chromedriver.update
|
37
|
+
puts "chromedriver 자동 다운로드 성공"
|
38
|
+
rescue => e
|
39
|
+
puts "chromedriver 자동 다운로드 실패: #{e.message}"
|
40
|
+
puts "폴더내 크롬드라이버를 사용합니다."
|
41
|
+
puts "크롬드라이버가 오래된 경우 오류 발생될 수 있으며, 만일 오류 발생시 아래 지침을 따라주세요."
|
42
|
+
puts "1.크롬 업데이트 2.프로그램 폴더 내부에 ★tip★-시작시-크롬창이....파일을 열어 드라이버를 교체하세요."
|
43
|
+
chromedriver_path = './chromedriver.exe' # 수동 경로를 인스턴스 변수로 설정
|
44
|
+
Selenium::WebDriver::Chrome::Service.driver_path = chromedriver_path
|
45
|
+
end
|
46
|
+
|
27
47
|
end
|
48
|
+
|
49
|
+
|
28
50
|
def chrome_setup(user_id, proxy)
|
29
51
|
naver_cookie_dir = "C:/naver_cookie"
|
30
52
|
FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
|
31
53
|
if proxy == ''
|
32
|
-
|
54
|
+
|
55
|
+
system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" https://naver.com/ --remote-debugging-port=9222 --user-data-dir=C:/naver_cookie/#{user_id} --no-first-run --no-default-browser-check --disable-sync})
|
56
|
+
|
33
57
|
else
|
34
|
-
|
58
|
+
|
59
|
+
system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" https://naver.com/ --remote-debugging-port=9222 --user-data-dir=C:/naver_cookie/#{user_id} --proxy-server=#{proxy.to_s.force_encoding('utf-8').to_s} --no-first-run --no-default-browser-check --disable-sync})
|
60
|
+
|
35
61
|
end
|
36
62
|
end
|
37
63
|
def chrome_start(proxy, user_id)
|
@@ -39,10 +65,12 @@ class Naver
|
|
39
65
|
FileUtils.mkdir_p(naver_cookie_dir) unless File.exist?(naver_cookie_dir)
|
40
66
|
if proxy == ''
|
41
67
|
begin
|
42
|
-
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
43
68
|
options = Selenium::WebDriver::Chrome::Options.new
|
44
69
|
options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
|
45
|
-
options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
|
70
|
+
#options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
|
71
|
+
options.add_argument('--disable-sync') # Chrome 동기화 비활성화
|
72
|
+
options.add_argument('--disable-popup-blocking') # 팝업 방지 (로그인 창이 뜨는 경우 대비)
|
73
|
+
options.add_argument('--no-default-browser-check')
|
46
74
|
options.page_load_strategy = :normal
|
47
75
|
options.timeouts = {page_load: 20_000}
|
48
76
|
options.page_load_strategy = 'none'
|
@@ -64,10 +92,13 @@ class Naver
|
|
64
92
|
end
|
65
93
|
else
|
66
94
|
begin
|
67
|
-
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
95
|
+
#Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
68
96
|
options = Selenium::WebDriver::Chrome::Options.new
|
69
97
|
options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
|
70
98
|
options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
|
99
|
+
options.add_argument('--disable-sync') # Chrome 동기화 비활성화
|
100
|
+
options.add_argument('--disable-popup-blocking') # 팝업 방지 (로그인 창이 뜨는 경우 대비)
|
101
|
+
options.add_argument('--no-default-browser-check')
|
71
102
|
options.add_argument '--proxy-server='+proxy.to_s.force_encoding('utf-8').to_s
|
72
103
|
options.page_load_strategy = :normal
|
73
104
|
options.timeouts = {page_load: 20_000}
|
@@ -88,10 +119,13 @@ class Naver
|
|
88
119
|
puts e
|
89
120
|
puts 'proxy error...'
|
90
121
|
begin
|
91
|
-
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
122
|
+
#Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
92
123
|
options = Selenium::WebDriver::Chrome::Options.new
|
93
124
|
options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
|
94
125
|
options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
|
126
|
+
options.add_argument('--disable-sync') # Chrome 동기화 비활성화
|
127
|
+
options.add_argument('--disable-popup-blocking') # 팝업 방지 (로그인 창이 뜨는 경우 대비)
|
128
|
+
options.add_argument('--no-default-browser-check')
|
95
129
|
options.page_load_strategy = :normal
|
96
130
|
options.timeouts = {page_load: 20_000}
|
97
131
|
options.page_load_strategy = 'none'
|
@@ -242,7 +276,7 @@ class Naver
|
|
242
276
|
|
243
277
|
|
244
278
|
|
245
|
-
if option['
|
279
|
+
if option['블로그키워드검색인기순'] == 'true'
|
246
280
|
# 수집된 post-url들을 저장할 배열
|
247
281
|
collected_urls = []
|
248
282
|
# 페이지 번호 초기화
|
@@ -293,7 +327,7 @@ class Naver
|
|
293
327
|
page_no += 1
|
294
328
|
end
|
295
329
|
|
296
|
-
elsif option['
|
330
|
+
elsif option['블로그키워드검색최신순'] == 'true'
|
297
331
|
# 수집된 post-url들을 저장할 배열
|
298
332
|
collected_urls = []
|
299
333
|
# 페이지 번호 초기화
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zon_blog_comment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: File to Clipboard gem
|
14
14
|
email: mymin26@naver.com
|