Skip to content

Commit 30e5934

Browse files
committed
chore: bump version to 0.0.7
1 parent 61954ff commit 30e5934

5 files changed

Lines changed: 27 additions & 6 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "google-patent-cli"
3-
version = "0.0.6"
3+
version = "0.0.7"
44
edition = "2021"
55
rust-version = "1.81"
66

src/cdp/browser.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ impl CdpBrowser {
2323
headless: bool,
2424
debug: bool,
2525
) -> Result<Self> {
26-
let chrome_path = executable_path.unwrap_or_else(|| {
26+
let chrome_path = executable_path.or_else(|| {
27+
std::env::var("CHROME_BIN").ok().map(PathBuf::from)
28+
}).unwrap_or_else(|| {
2729
#[cfg(target_os = "windows")]
2830
{
2931
PathBuf::from("C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe")

src/models.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,21 @@ mod tests {
205205
country: Some("JP".to_string()),
206206
..Default::default()
207207
};
208-
assert_eq!(options.to_url().unwrap(), "https://patents.google.com/?q=foo&country=JP&language=JAPANESE");
208+
assert_eq!(
209+
options.to_url().unwrap(),
210+
"https://patents.google.com/?q=foo&country=JP&language=JAPANESE"
211+
);
209212

210213
// Test query with country (CN should add language=CHINESE)
211214
let options = SearchOptions {
212215
query: Some("foo".to_string()),
213216
country: Some("CN".to_string()),
214217
..Default::default()
215218
};
216-
assert_eq!(options.to_url().unwrap(), "https://patents.google.com/?q=foo&country=CN&language=CHINESE");
219+
assert_eq!(
220+
options.to_url().unwrap(),
221+
"https://patents.google.com/?q=foo&country=CN&language=CHINESE"
222+
);
217223

218224
// Test query with country (US should NOT add language)
219225
let options = SearchOptions {

src/patent_search.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,17 @@ impl PatentSearcher {
1313
headless: bool,
1414
debug: bool,
1515
) -> Result<Self> {
16-
let args = vec!["--disable-blink-features=AutomationControlled"];
16+
let mut args = vec!["--disable-blink-features=AutomationControlled"];
17+
18+
// Add stability flags for CI/Container environments
19+
if std::env::var("CI").is_ok() {
20+
args.extend_from_slice(&[
21+
"--no-sandbox",
22+
"--disable-setuid-sandbox",
23+
"--disable-gpu",
24+
"--disable-dev-shm-usage",
25+
]);
26+
}
1727
let browser = CdpBrowser::launch(browser_path, args, headless, debug).await?;
1828

1929
Ok(Self { browser })
@@ -71,6 +81,9 @@ impl PatentSearcher {
7181
)
7282
.await?;
7383

84+
// Give a little time for all dynamic content (like claims) to fully render
85+
tokio::time::sleep(std::time::Duration::from_millis(1000)).await;
86+
7487
// Single patent page - extract structured data
7588
let result = page.evaluate(include_str!("scripts/extract_patent.js")).await?;
7689

0 commit comments

Comments
 (0)