https://github.com/biomathcode/link_preview_api_rust
https://github.com/biomathcode/link_preview_api_rust
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/biomathcode/link_preview_api_rust
- Owner: biomathcode
- License: other
- Created: 2023-09-23T21:27:07.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-09-23T22:16:33.000Z (almost 2 years ago)
- Last Synced: 2025-02-08T02:45:03.535Z (5 months ago)
- Language: Rust
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Link Preview API
The Link Preview API is a Rust-based web service that fetches and provides metadata about a website when given its URL. It can extract information such as the website's title, description, favicon, and Open Graph image.
## Table of Contents
- [Link Preview API](#link-preview-api)
- [Table of Contents](#table-of-contents)
- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Making API Requests](#making-api-requests)
- [Contributing](#contributing)
- [License](#license)## Getting Started
### Prerequisites
Before you can use the Link Preview API, make sure you have the following prerequisites installed on your system:
- [Rust](https://www.rust-lang.org/tools/install): The Rust programming language and build tools.
- [Cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html): The Rust package manager.### Installation
1. Clone the repository:
```bash
git clone https://github.com/biomathcode/link-preview-api.git## Usage
### Running the Service
To run the Link Preview API service, use the following command:```bash
cargo run --release
```The service will start and listen on http://localhost:3000.
### Making API Requests
You can make API requests to the Link Preview service by sending a GET request to the root URL with a url query parameter. For example:```bash
curl "http://localhost:3000/?url=https://example.com"
```The API will respond with JSON data containing information about the website.
Here's an example of the JSON response:
```json
{
"title": "Example Domain",
"description": "This is an example domain used for illustrative examples in documents.",
"favicon": "https://example.com/favicon.ico",
"og_image": "https://example.com/images/logo.png"
}
```## Contributing
Contributions are welcome! If you would like to contribute to the Link Preview API project, please follow these steps:Fork the repository.
Create a new branch for your feature or bug fix: git checkout -b feature-name.
Make your changes and commit them: git commit -m "Add feature-name".
Push your changes to your fork: git push origin feature-name.
Create a pull request to the main repository.## License
This project is licensed under the MIT License - see the LICENSE file for details.