#browser #cookies #chromium #firefox #chrome

bench_scraper

A library for grabbing browser cookies from a filesystem

6 releases (3 breaking)

0.4.1 Dec 3, 2022
0.4.0 Nov 27, 2022
0.3.0 Nov 26, 2022
0.2.0 Nov 23, 2022
0.1.1 Nov 19, 2022

#15 in #chromium

Download history 39/week @ 2024-03-16 30/week @ 2024-03-23 60/week @ 2024-03-30 40/week @ 2024-04-06 43/week @ 2024-04-13 28/week @ 2024-04-20 27/week @ 2024-04-27 17/week @ 2024-05-04 8/week @ 2024-05-11 11/week @ 2024-05-18 4/week @ 2024-05-25 11/week @ 2024-06-01 20/week @ 2024-06-08 25/week @ 2024-06-15 8/week @ 2024-06-22 1/week @ 2024-06-29

56 downloads per month
Used in dash-mpd-cli

MIT/Apache

59KB
1K SLoC

Bench Scraper

Bench Scraper is a library for grabbing browser cookies from a filesystem.

Different browsers store their cookies in different locations, with different encryption methods, in different ways across operating system. Bench scraper abstracts this complexity into a few easy-to-use functions.

use bench_scraper::find_cookies;

fn main() {
    let browser_cookies = find_cookies().unwrap();
    for browser_cookie in browser_cookies.iter() {
        println!("Cookies for '{:?}'", browser_cookie.browser);
        for cookie in browser_cookie.cookies.iter() {
            println!("    '{:?}'", cookie);
        }
    }
}

The reqwest feature on this crate allows you to turn an iterator of cookies into a reqwest cookie jar. This lets you make web requests using the same state as a browser.

let browser_cookie = bench_scraper::find_cookies().unwrap().into_iter().next().unwrap();
let jar: reqwest::cookie::Jar = browser_cookie.cookies.into_iter().collect();

Browser Support

This library maintains a list of known browsers that can be used with the wildcard find_cookies() function. If you are using a non-standard browser or installation, other functions are available which allow for custom browser settings.

If you use a common browser that isn't supported, please file an issue with details on the browser!

Operating System Support

This library attempts to support a wide range of operating systems and browsers. Different functionality is gated based on the target for which the project using the library is compiled.

Currently, the library supports Windows, MacOS ("Darwin"), and Linux. If you have another operating system you'd like supported, please file an issue with details on how the implementation might look.

Dependencies

~27–42MB
~727K SLoC