{"id":21130381,"url":"https://github.com/serpapi/serpapi-search-rust","last_synced_at":"2025-07-09T01:33:22.157Z","repository":{"id":57666832,"uuid":"439431459","full_name":"serpapi/serpapi-search-rust","owner":"serpapi","description":"Search results in Rust powered by SerpApi.com","archived":false,"fork":false,"pushed_at":"2023-05-01T07:05:38.000Z","size":25,"stargazers_count":5,"open_issues_count":1,"forks_count":2,"subscribers_count":7,"default_branch":"dev","last_synced_at":"2025-06-30T09:15:16.844Z","etag":null,"topics":["bing","google","seo","serpapi","web-scraping","webscraping"],"latest_commit_sha":null,"homepage":"https://serpapi.com/integrations/rust","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/serpapi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null}},"created_at":"2021-12-17T18:51:12.000Z","updated_at":"2025-05-21T17:50:11.000Z","dependencies_parsed_at":"2022-09-26T20:31:51.900Z","dependency_job_id":null,"html_url":"https://github.com/serpapi/serpapi-search-rust","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/serpapi/serpapi-search-rust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serpapi%2Fserpapi-search-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serpapi%2Fserpapi-search-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serpapi%2Fserpapi-search-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serpapi%2Fserpapi-search-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serpapi","download_url":"https://codeload.github.com/serpapi/serpapi-search-rust/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serpapi%2Fserpapi-search-rust/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264375546,"owners_count":23598396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bing","google","seo","serpapi","web-scraping","webscraping"],"created_at":"2024-11-20T05:32:45.877Z","updated_at":"2025-07-09T01:33:21.863Z","avatar_url":"https://github.com/serpapi.png","language":"Rust","readme":"# SerpApi Search in Rust\n[![CI](https://github.com/serpapi/serpapi-search-rust/actions/workflows/ci.yml/badge.svg)](https://github.com/serpapi/serpapi-search-rust/actions/workflows/ci.yml) [![serpapi-search-rust](https://img.shields.io/crates/v/serpapi-search-rust.svg)](https://crates.io/crates/serpapi-search-rust)\n\n\nThis Rust package enables to scrape and parse search results from Google, Bing, Baidu, Yandex, Yahoo, Ebay, Apple, Youtube, Naver, Home depot and more. It's powered by [SerpApi](https://serpapi.com) which delivered a consistent JSON format accross search engines.\nSerpApi.com enables to do localized search, leverage advanced search engine features and a lot more...\nA completed documentation is available at [SerpApi](https://serpapi.com).\n\nTo install in your rust application, update Cargo.toml\n```sh\nserpapi-search-rust=\"0.1.0\"\n```\n\nBasic application.\n```rust\nuse serpapi_search_rust::serp_api_search::SerpApiSearch;\nuse std::collections::HashMap;\nuse std::env;\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    // read secret api key from environment variable\n    // To get the key simply copy/paste from https://serpapi.com/dashboard.\n    let api_key = match env::var_os(\"API_KEY\") {\n        Some(v) =\u003e v.into_string().unwrap(),\n        None =\u003e panic!(\"$API_KEY is not set\"),\n    };\n\n    println!(\"let's search about coffee on google\");\n    let mut params = HashMap::\u003cString, String\u003e::new();\n    params.insert(\"q\".to_string(), \"coffee\".to_string());\n    params.insert(\"location\".to_string(), \"Austin, TX, Texas, United States\".to_string());\n\n    // initialize the search engine\n    let search = SerpApiSearch::google(params, api_key);\n\n    // search returns a JSON as serde_json::Value which can be accessed like a HashMap.\n    println!(\"waiting...\");\n    let results = search.json().await?;\n    let organic_results = results[\"organic_results\"].as_array().unwrap();\n    println!(\"results received\");\n    println!(\"--- JSON ---\");\n    println!(\" - number of organic results: {}\", organic_results.len());\n    println!(\" - organic_results first result description: {}\", results[\"organic_results\"][0][\"about_this_result\"][\"source\"][\"description\"]);\n    let places = results[\"local_results\"][\"places\"].as_array().unwrap();\n    println!(\"number of local_results: {}\", places.len());\n    println!(\" - local_results first address: {}\", places[0][\"address\"]);\n\n    // search returns text\n    println!(\"--- HTML search ---\");\n    let raw = search.html().await?;\n    print!(\" - raw HTML size {} bytes\\n\", raw.len());\n    print!(\" - async search completed with {}\\n\", results[\"search_parameters\"][\"engine\"]);\n\n    // // edit the location in the search\n    // println!(\"--- JSON search with a different location ---\");\n    // params = HashMap::\u003cString, String\u003e::new();\n    // params.insert(\"location\".to_string(), \"Destin, Florida, United States\".to_string());\n    // search = SerpApiSearch::google(params, api_key);\n    // let results = search.json().await?;\n    // println!(\"\u003e\u003e search_parameters: {}\", results[\"search_parameters\"]);\n    // let places = results[\"local_results\"][\"places\"].as_array().unwrap();\n    // println!(\"number of local_results: {}\\n\", places.len());\n    // println!(\"local_results first address: {}\\n\", places[0][\"address\"]);\n\n    print!(\"ok\");\n    Ok(())\n}\n```\n\nTo run an example:\n```sh\ncargo build --example google_search_example\n```\nfile: (examples/google_search_example.rs)\n\nThe keyword google can be replaced by any supported search engine:\n- google\n- baidu\n- bing\n- duckduckgo\n- yahoo\n- yandex\n- ebay\n- youtube\n- walmart\n- home_depot\n- apple_app_store\n- naver\n\nTo run test.\n```sh\ncargo test\n```\n\nFor more information how to build a paramaters HashMap see [serpapi.com documentation](https://serpapi.com/search-api)\n\n### Technical features\n- Dynamic JSON decoding using Serde JSON\n- Asyncronous HTTP request handle method using tokio and reqwest\n- Async tests using Tokio\n\n### TODO\n - [ ] more test to close code coverage (each search engine)\n - [ ] add more examples\n - [ ] better documentation","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserpapi%2Fserpapi-search-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserpapi%2Fserpapi-search-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserpapi%2Fserpapi-search-rust/lists"}