Skip to content

Commit f2765dc

Browse files
committed
fix to chrome opening window
1 parent cc55bef commit f2765dc

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
[package]
33
name = "webgrep"
4-
version = "0.4.2"
4+
version = "0.4.3"
55
edition = "2021"
66
license = "MIT"
77
description = "grep the web: a full-browser-spec search-focused ultra-simple way to read the web without having to leave the terminal"

src/utils/request_handler.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ use headless_chrome::{Browser, LaunchOptions};
22
use lazy_static::lazy_static;
33
use pdf_extract;
44
use scraper::{Html, Selector};
5-
use std::path::PathBuf;
5+
use std::ffi::OsStr;
6+
67
use url::Url;
78
lazy_static! {
89
static ref CLIENT : reqwest::Client = reqwest::Client::builder().user_agent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36").build().unwrap();
@@ -42,10 +43,12 @@ pub async fn get_html_from_url(url: &str) -> Html {
4243
return Html::parse_document(&resp.unwrap());
4344
}
4445
pub async fn browse_for_html_from_url(url: String) -> Html {
45-
let mut path = PathBuf::new();
46-
path.push("~/.cargo");
46+
let mut a: Vec<&OsStr> = Vec::new();
47+
a.push(OsStr::new("--headless"));
4748
let options = LaunchOptions::default_builder()
4849
.headless(true)
50+
.enable_gpu(false)
51+
.args(a)
4952
.build()
5053
.unwrap();
5154
let browser =

0 commit comments

Comments
 (0)