Skip to content

Commit ecfc3d1

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

6 files changed

Lines changed: 45 additions & 24 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
run: cargo clippy -- -D warnings
2929

3030
- name: Run tests
31-
run: cargo test
31+
run: cargo test -- --skip integration_tests
3232

3333
- name: Check build
3434
run: cargo check --release

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: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,26 @@ impl CdpBrowser {
2323
headless: bool,
2424
debug: bool,
2525
) -> Result<Self> {
26-
let chrome_path = executable_path.unwrap_or_else(|| {
27-
#[cfg(target_os = "windows")]
28-
{
29-
PathBuf::from("C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe")
30-
}
31-
#[cfg(target_os = "macos")]
32-
{
33-
PathBuf::from("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome")
34-
}
35-
#[cfg(target_os = "linux")]
36-
{
37-
PathBuf::from("/usr/bin/google-chrome")
38-
}
39-
#[cfg(not(any(target_os = "windows", target_os = "macos", target_os = "linux")))]
40-
{
41-
PathBuf::from("chrome")
42-
}
43-
});
26+
let chrome_path = executable_path
27+
.or_else(|| std::env::var("CHROME_BIN").ok().map(PathBuf::from))
28+
.unwrap_or_else(|| {
29+
#[cfg(target_os = "windows")]
30+
{
31+
PathBuf::from("C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe")
32+
}
33+
#[cfg(target_os = "macos")]
34+
{
35+
PathBuf::from("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome")
36+
}
37+
#[cfg(target_os = "linux")]
38+
{
39+
PathBuf::from("/usr/bin/google-chrome")
40+
}
41+
#[cfg(not(any(target_os = "windows", target_os = "macos", target_os = "linux")))]
42+
{
43+
PathBuf::from("chrome")
44+
}
45+
});
4446

4547
// Create a temporary user data directory with a unique ID
4648
let unique_id = uuid::Uuid::new_v4();

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)