Skip to content

Commit

Permalink
feat(screenshot): [closes #34], Take full page screenshots of urls
Browse files Browse the repository at this point in the history
  • Loading branch information
pwnwriter committed Nov 3, 2023
1 parent abfaca6 commit b43753f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions src/cli/screenshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ use super::args::{Cli, Input};
use super::ascii::{BAR, RESET};
use crate::log;
use anyhow::Context;
use chromiumoxide::page::ScreenshotParams;
use chromiumoxide::{
browser::{Browser, BrowserConfig},
cdp::browser_protocol::page::{CaptureScreenshotFormat, CaptureScreenshotParams},
cdp::browser_protocol::page::CaptureScreenshotFormat,
handler::viewport::Viewport,
};
use colored::{Color, Colorize};
Expand Down Expand Up @@ -146,8 +147,10 @@ async fn take_screenshot(
let filename = format!("{}.png", url.replace("://", "-").replace('/', "_"));
let page = browser.new_page(parsed_url.clone()).await?;
page.save_screenshot(
CaptureScreenshotParams::builder()
ScreenshotParams::builder()
.format(CaptureScreenshotFormat::Png)
.full_page(true)
.omit_background(true)
.build(),
filename,
)
Expand Down

0 comments on commit b43753f

Please sign in to comment.