pointmd_comments 0.1.2 → 0.1.7
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14bdb214817ffa3446133a02ce63339577eefeb5d92b07ec706916d287401698
|
4
|
+
data.tar.gz: d56a2648b21a6a6b4c091fe050e6d16f20c20a2c0f4de9dc6a44f64c665ac328
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d1fa692ce179995acf29b6b3f4ea91021279919485c76a5a10c9219995dff0d5bbb015e31f87c2331b2c76dbeaada7b181e83c825273c29842e61b83c40d70a
|
7
|
+
data.tar.gz: f90df92a739a23ed10c72d257973f60a7bffcc67ce28d1a60dbfbe8be0bff0a2753741576e0059c2db9decb0a2427a50ec1bd887e9fcaafa324bb32d53a0949d
|
data/bin/pointmd_comments
CHANGED
data/lib/pointmd_comments.rb
CHANGED
@@ -13,12 +13,14 @@ require 'pointmd_comments/aggregators/comments'
|
|
13
13
|
require 'pointmd_comments/errors/not_implemented'
|
14
14
|
require 'pointmd_comments/errors/unknown_source'
|
15
15
|
|
16
|
-
require 'pry'
|
17
|
-
|
18
16
|
module PointmdComments
|
19
17
|
class Error < StandardError; end
|
20
18
|
|
21
|
-
def self.collect
|
19
|
+
def self.collect(options = {})
|
20
|
+
Aggregators::Main.new(options).call
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.collect_from_shell
|
22
24
|
args = ARGV.dup
|
23
25
|
options = OptParser.new.parse
|
24
26
|
Aggregators::Main.new(options).call
|
@@ -1,16 +1,23 @@
|
|
1
1
|
module PointmdComments
|
2
2
|
module Aggregators
|
3
3
|
class Main
|
4
|
+
CHROME_ARGS = %w[disable-dev-shm-usage disable-software-rasterizer no-sandbox].freeze
|
5
|
+
|
4
6
|
attr_reader :posts_aggregator, :browser, :comments_aggregator, :all_comments, :posts, :source, :output, :path
|
5
7
|
|
6
8
|
def initialize(options)
|
7
9
|
# Currently 'path' is not supported
|
8
10
|
@path = nil
|
9
|
-
@output = options[:output]
|
10
|
-
@source = options[:source]
|
11
|
+
@output = options[:output] || default_output_path
|
12
|
+
@source = options[:source] || Aggregators::Posts::DEFAULT_SOURCE
|
11
13
|
@posts_aggregator = Aggregators::Posts.new(source: source, path: path)
|
12
14
|
@comments_aggregator = Aggregators::Comments.new
|
13
|
-
|
15
|
+
|
16
|
+
client = Selenium::WebDriver::Remote::Http::Default.new
|
17
|
+
# NOTE: #timeout= is deprecated, use #read_timeout= and #open_timeout= instead
|
18
|
+
client.timeout = 600 # instead of the default 60 (seconds)
|
19
|
+
|
20
|
+
@browser = ::Watir::Browser.new :chrome, http_client: client, headless: true, args: CHROME_ARGS
|
14
21
|
@all_comments = []
|
15
22
|
end
|
16
23
|
|
@@ -46,7 +53,9 @@ module PointmdComments
|
|
46
53
|
end
|
47
54
|
|
48
55
|
def write_to_csv
|
49
|
-
|
56
|
+
# File#expand_path is needed to process paths like '~/test.txt' => '/Users/me/test.txt'
|
57
|
+
file_path = File.expand_path(output)
|
58
|
+
puts "File Path is #{file_path}"
|
50
59
|
|
51
60
|
CSV.open(file_path, 'w') do |csv|
|
52
61
|
all_comments.each { |c| csv << c }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pointmd_comments
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicolai Stoianov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|