{"id":23864423,"url":"https://github.com/houseme/pexels","last_synced_at":"2025-07-19T15:04:23.608Z","repository":{"id":270451772,"uuid":"909683603","full_name":"houseme/pexels","owner":"houseme","description":"A Rust wrapper for Pexels API.","archived":false,"fork":false,"pushed_at":"2025-07-10T01:52:29.000Z","size":255,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-10T10:38:16.845Z","etag":null,"topics":["pexels","pexels-api","pexels-cli","rust"],"latest_commit_sha":null,"homepage":"https://houseme.github.io/pexels/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/houseme.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":"Roadmap.md","authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":"houseme","issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":["https://paypal.me/houseme"]}},"created_at":"2024-12-29T13:30:53.000Z","updated_at":"2025-07-10T01:52:31.000Z","dependencies_parsed_at":"2024-12-31T09:28:48.088Z","dependency_job_id":"ea2abc7e-eabd-4341-bea5-80936fd35b21","html_url":"https://github.com/houseme/pexels","commit_stats":null,"previous_names":["houseme/pexels"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/houseme/pexels","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/houseme%2Fpexels","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/houseme%2Fpexels/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/houseme%2Fpexels/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/houseme%2Fpexels/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/houseme","download_url":"https://codeload.github.com/houseme/pexels/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/houseme%2Fpexels/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265950417,"owners_count":23853755,"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":["pexels","pexels-api","pexels-cli","rust"],"created_at":"2025-01-03T08:26:10.267Z","updated_at":"2025-07-19T15:04:23.602Z","avatar_url":"https://github.com/houseme.png","language":"Rust","funding_links":["https://liberapay.com/houseme","https://paypal.me/houseme"],"categories":[],"sub_categories":[],"readme":"# Pexels Project\n\n[![Build](https://github.com/houseme/pexels/actions/workflows/build.yml/badge.svg)](https://github.com/houseme/pexels/actions/workflows/build.yml)\n[![crates.io](https://img.shields.io/crates/v/pexels-api.svg)](https://crates.io/crates/pexels-api)\n[![docs.rs](https://docs.rs/pexels-api/badge.svg)](https://docs.rs/pexels-api/)\n[![License](https://img.shields.io/crates/l/pexels-api)](../LICENSE-APACHE)\n[![Crates.io](https://img.shields.io/crates/d/pexels-api)](https://crates.io/crates/pexels-api)\n\nThis project consists of two main components: `pexels-api` and `pexels-cli`. The `pexels-api` is a Rust library for\ninteracting with the Pexels API, while the\n`pexels-cli` is a command-line interface for using the `pexels-api`.\n\n## Features\n\n- **pexels-api**:\n    - Search for photos and videos\n    - Retrieve individual photos and videos by ID\n    - Search for collections\n    - Retrieve featured collections\n    - Supports asynchronous operations\n\n- **pexels-cli**:\n    - Command-line interface for searching photos, videos, and collections\n    - Retrieve individual media items by their ID\n\n## Installation\n\n### pexels-api\n\nAdd the following to your `Cargo.toml`:\n\n```toml\n[dependencies]\ndotenvy = \"0.15.7\"\npexels-api = { version = \"0.0.5\" }\nreqwest = { version = \"0.12.11\", features = [\"json\"] }\nserde = { version = \"1.0.217\", features = [\"derive\"] }\nserde_json = \"1.0.135\"\nthiserror = \"2.0.9 \"\ntokio = { version = \"1\", features = [\"full\"] }\nurl = \"2.5.4\"\n```\n\n### pexels-cli\n\n1. Clone the repository:\n    ```sh\n    git clone https://github.com/houseme/pexels.git\n    ```\n\n2. Navigate to the project directory:\n    ```sh\n    cd pexels/pexels-cli\n    ```\n\n3. Build the project:\n    ```sh\n    cargo build\n    ```\n\n## Usage\n\nBefore using the library or CLI, make sure to set your Pexels API key in a `.env` file:\n\n```sh\nPEXELS_API_KEY=your_api_key_here\n```\n\n### Pexels-api Example\n\nHere is a basic example of how to use the `pexels-api` library:\n\n```rust\nuse dotenvy::dotenv;\nuse pexels_api::{Pexels, MediaType, MediaSort};\nuse std::env;\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    dotenv().ok();\n    let api_key = env::var(\"PEXELS_API_KEY\")?;\n    let client = Pexels::new(api_key);\n\n    // Search for photos\n    let photos = client.search_photos(\"nature\", 10, 1).await?;\n    for photo in photos.photos {\n        println!(\"{:?}\", photo);\n    }\n\n    // Get a photo by ID\n    let photo = client.get_photo(10967).await?;\n    println!(\"{:?}\", photo);\n\n    // Search for videos\n    let videos = client.search_videos(\"nature\", 10, 1).await?;\n    for video in videos.videos {\n        println!(\"{:?}\", video);\n    }\n\n    // Get a video by ID\n    let video = client.get_video(3401900).await?;\n    println!(\"{:?}\", video);\n\n    // Search for collections\n    let collections = client.search_collections(10, 1).await?;\n    for collection in collections.collections {\n        println!(\"{:?}\", collection);\n    }\n\n    // Search for media\n    let media_response = client.search_media(\"nature\", 10, 1, MediaType::Photo, MediaSort::Latest).await?;\n    for media in media_response.media {\n        println!(\"{:?}\", media);\n    }\n\n    Ok(())\n}\n```\n\n### Pexels-cli Commands\n\n- **Search Photos**:\n    ```sh\n    cargo run -- search-photos --query \"nature\" --per-page 10 --page 1\n    ```\n\n- **Search Videos**:\n    ```sh\n    cargo run -- search-videos --query \"nature\" --per-page 10 --page 1\n    ```\n\n- **Get Photo by ID**:\n    ```sh\n    cargo run -- get-photo --id 10967\n    ```\n\n- **Get Video by ID**:\n    ```sh\n    cargo run -- get-video --id 3401900\n    ```\n\n- **Search Collections**:\n    ```sh\n    cargo run -- search-collections --per-page 10 --page 1\n    ```\n\n- **Search Media**:\n    ```sh\n    cargo run -- search-media --query \"nature\" --per-page 10 --page 1 --type \"photo\" --sort \"latest\"\n    ```\n\n## Documentation\n\nFor detailed documentation, please refer to [pexels-api Documentation](https://docs.rs/pexels-api)\nand [pexels-cli Documentation](https://docs.rs/pexels-cli).\n\n## License\n\nLicensed under either of\n\n* Apache License, Version 2.0, [LICENSE-APACHE](./LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0\n* MIT license [LICENSE-MIT](./LICENSE-MIT) or http://opensource.org/licenses/MIT\n\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as\ndefined in the Apache-2.0 or MIT license, shall be dual licensed as above, without any additional terms or conditions.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhouseme%2Fpexels","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhouseme%2Fpexels","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhouseme%2Fpexels/lists"}