ZMediumToMarkdown 3.2.0 → 3.3.0
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/CLI.rb +35 -0
- 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: 1e19605bba5d079fa1086c14dfb33c7d33f36da86b46c6c6c97affc960521d26
|
|
4
|
+
data.tar.gz: 96e13a36f2573d2dae057ee7a318ad66d9d09dc69990deff5bf5033a72032f8c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 81e76d2686c7f06976ea9fdcb09243b75e5f628669e3c405b27a636705d6a54862f264c569bc4e33bcf571d3ba6696ed578b20a45350ea81fb993b605d76e860
|
|
7
|
+
data.tar.gz: 34d756095ba13548c551da107d9e4903b51d094087ce8ac71ed140f52adf0e3a852afbe35bae15b27c09ed08cafb4df91fc121bdf7e262b123e989b3053af8bb
|
data/lib/CLI.rb
CHANGED
|
@@ -110,6 +110,10 @@ module CLI
|
|
|
110
110
|
ENV['MEDIUM_NO_AUTO_BROWSER'] = '1'
|
|
111
111
|
end
|
|
112
112
|
|
|
113
|
+
opts.on('--auth', 'Open Chrome to sign in, capture sid / uid / cf_clearance / _cfuvid into the encrypted cookie cache, and exit. Run once before bulk / scheduled jobs to seed the cache.') do
|
|
114
|
+
options[:auth] = true
|
|
115
|
+
end
|
|
116
|
+
|
|
113
117
|
opts.on('-h', '--help', 'Show this help message') do
|
|
114
118
|
options[:help] = opts.to_s
|
|
115
119
|
end
|
|
@@ -231,6 +235,11 @@ module CLI
|
|
|
231
235
|
return
|
|
232
236
|
end
|
|
233
237
|
|
|
238
|
+
if options[:auth]
|
|
239
|
+
runAuth(errput: errput)
|
|
240
|
+
return
|
|
241
|
+
end
|
|
242
|
+
|
|
234
243
|
# --stdout / --list path: render to the given output stream, skip
|
|
235
244
|
# all filesystem writes and asset downloads. Progress goes to errput
|
|
236
245
|
# so stdout stays pure markdown / NDJSON for embedding callers.
|
|
@@ -275,6 +284,32 @@ module CLI
|
|
|
275
284
|
Helper.printNewVersionMessageIfExists()
|
|
276
285
|
end
|
|
277
286
|
|
|
287
|
+
# `--auth` entry point: drive the Chrome login flow on demand so users
|
|
288
|
+
# can seed the cookie cache before kicking off a bulk / CI job. Errors
|
|
289
|
+
# are surfaced to errput; we never raise — `--auth` is best-effort
|
|
290
|
+
# setup, not a critical path.
|
|
291
|
+
def runAuth(errput: $stderr)
|
|
292
|
+
unless ChromeAuth.available?
|
|
293
|
+
errput.puts <<~MSG
|
|
294
|
+
⚠ Chrome was not detected, so --auth can't run the auto-login flow.
|
|
295
|
+
Install Google Chrome (or any Chromium-based browser ferrum can
|
|
296
|
+
detect), or extract sid / uid manually — see:
|
|
297
|
+
#{COOKIE_SETUP_URL}
|
|
298
|
+
MSG
|
|
299
|
+
return
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
cookies = ChromeAuth.login!(errput: errput)
|
|
303
|
+
if cookies.empty?
|
|
304
|
+
errput.puts '⚠ No cookies were captured. Make sure you finished signing in on a medium.com page before pressing Enter.'
|
|
305
|
+
return
|
|
306
|
+
end
|
|
307
|
+
cookies.each { |k, v| $cookies[k] = v unless v.to_s.empty? }
|
|
308
|
+
errput.puts "✅ Captured #{cookies.keys.join(' / ')} → #{CookieCache.path}"
|
|
309
|
+
rescue StandardError => e
|
|
310
|
+
errput.puts "(Auto-login failed: #{e.class}: #{e.message})"
|
|
311
|
+
end
|
|
312
|
+
|
|
278
313
|
# Jekyll mode writes into the cwd (so files land in `_posts/...` and
|
|
279
314
|
# `assets/...` of an existing Jekyll site). Plain mode nests under
|
|
280
315
|
# `Output/` to keep the user's cwd tidy.
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ZMediumToMarkdown
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ZhgChgLi
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-05-
|
|
10
|
+
date: 2026-05-06 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: nokogiri
|