coelacanth 0.6.1 → 0.7.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/CHANGELOG.md +3 -6
- data/README.md +6 -0
- data/lib/coelacanth/client/base.rb +4 -0
- data/lib/coelacanth/client/ferrum.rb +7 -0
- data/lib/coelacanth/version.rb +1 -1
- data/lib/coelacanth.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f1bc84d97135234e0e80586a789381ea2e10785c66fac0bebe21375205489ef3
|
|
4
|
+
data.tar.gz: fdbea80d5c55c1059aedc568ec593121517cf0cbcf55d145fbe123c121b66c2a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 37165c8087b6119d7cd9ce3517bfd12b1c5f52c8c27b7c4eab12351f47034d46b2e86c7fe72820e6b425e02e7f643494e74766995805d1052469fdfaec7f47f2
|
|
7
|
+
data.tar.gz: d45c1d607c7e35f938ca6fc3658ec082020fcdcfb6888c2a60a7e080e508c7430eedcf9f7eddcf78dad2320f3dfae2803de975d8de9f7cbfb66282944547c5f1
|
data/CHANGELOG.md
CHANGED
|
@@ -4,11 +4,8 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
-
## [v0.
|
|
8
|
-
### :bug: Bug Fixes
|
|
9
|
-
- [`f387ef9`](https://github.com/slidict/coelacanth/commit/f387ef997e0c383458a4fd0384f74883fcb63f37) - Update gem-push.yml *(commit by [@abechan1](https://github.com/abechan1))*
|
|
10
|
-
|
|
7
|
+
## [v0.7.0] - 2026-07-08
|
|
11
8
|
### :wrench: Chores
|
|
12
|
-
- [`
|
|
9
|
+
- [`ab6d634`](https://github.com/slidict/coelacanth/commit/ab6d634abbc5f954b4b9861e19e3420ee034fd77) - bump version to 0.7.0 *(commit by [@abechan1](https://github.com/abechan1))*
|
|
13
10
|
|
|
14
|
-
[v0.
|
|
11
|
+
[v0.7.0]: https://github.com/slidict/coelacanth/compare/v0.6.1...v0.7.0
|
data/README.md
CHANGED
|
@@ -32,6 +32,7 @@ it into contemporary ingestion stacks without bespoke glue code.
|
|
|
32
32
|
multi-byte sources.
|
|
33
33
|
- **Screenshot capture** – Fetches full-page PNGs via a configurable browser client so you can archive visual context alongside
|
|
34
34
|
the extracted text.
|
|
35
|
+
- **PDF generation** – Renders any URL to PDF through Ferrum so you can persist printer-friendly snapshots of source pages.
|
|
35
36
|
- **Redirect resolution** – Follows HTTP redirects and long redirect chains to guarantee the extractor works on the final
|
|
36
37
|
landing page.
|
|
37
38
|
- **Configurable HTTP headers** – Inject custom headers (user agent, authorization, etc.) into the remote browser session for
|
|
@@ -82,6 +83,9 @@ result[:extraction] # => article metadata and body markdown
|
|
|
82
83
|
result[:dom] # => Oga DOM representation for downstream processing
|
|
83
84
|
result[:screenshot] # => PNG screenshot as a binary string
|
|
84
85
|
result[:response] # => HTTP status, headers, and final URL
|
|
86
|
+
|
|
87
|
+
pdf = Coelacanth.pdf("https://example.com/article")
|
|
88
|
+
File.binwrite("article.pdf", pdf)
|
|
85
89
|
```
|
|
86
90
|
|
|
87
91
|
# Plain-text morphology
|
|
@@ -181,6 +185,8 @@ development:
|
|
|
181
185
|
- **Gotenberg client** – Set `client: "gotenberg"` to capture screenshots through Gotenberg's Chromium URL screenshot
|
|
182
186
|
endpoint. Configure `gotenberg.url`, request timeouts, an optional `wait_delay`, an optional screenshot `user_agent`,
|
|
183
187
|
and optional `extra_http_headers`.
|
|
188
|
+
- **PDF generation** – `Coelacanth.pdf(url)` renders the URL with the Ferrum client and returns the generated PDF as a binary
|
|
189
|
+
string. Configure `remote_client` with a Chrome-compatible WebSocket endpoint before using this helper.
|
|
184
190
|
- **Eyecatch image extraction** – Representative images are discovered automatically by checking Open Graph/Twitter metadata,
|
|
185
191
|
Schema.org JSON-LD payloads, and high-signal `<img>` elements (hero/cover images, large dimensions, etc.). No manual XPath
|
|
186
192
|
maintenance is required.
|
|
@@ -29,6 +29,13 @@ module Coelacanth::Client
|
|
|
29
29
|
raise sanitized_remote_client_error(e)
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
+
def get_pdf
|
|
33
|
+
wait_for_network_idle
|
|
34
|
+
remote_client.pdf
|
|
35
|
+
rescue => e
|
|
36
|
+
raise sanitized_remote_client_error(e)
|
|
37
|
+
end
|
|
38
|
+
|
|
32
39
|
private
|
|
33
40
|
|
|
34
41
|
def sanitized_remote_client_error(error)
|
data/lib/coelacanth/version.rb
CHANGED
data/lib/coelacanth.rb
CHANGED