GithubHelp home page GithubHelp logo

metadata-extract-api's Introduction

Metadata Extractor API

This project provides an API for extracting metadata from a given URL using Node.js, Express, Axios, and Cheerio.

Table of Contents

Installation

Clone the repository:

git clone https://github.com/yourusername/metadata-extractor-api.git
cd metadata-extractor-api

Install dependencies:

npm install

Create a .env file in the root directory and add the following:

PORT=8080

Start the server:

npm start

The server will start running on http://localhost:8080.

Usage

Example Request with curl

curl -X POST http://localhost:8080/get-metadata \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com"}'

API Endpoints

GET /

  • URL: /
  • Method: GET
  • Description: Returns a "Hello World!" message to ensure the server is running.

Response 200 OK

Hello World!
  • POST /get-metadata
  • Description: Fetches and returns metadata from a given URL.

POST /get-metadata

  • URL: /get-metadata
  • Method: POST
  • Headers: Content-Type: application/json
  • Body:
{
  "url": "https://example.com"
}

Response 200 OK

{
  "title": "Example Domain",
  "metaDescription": "Example Description",
  "ogImage": "https://example.com/og-image.jpg",
  "ogUrl": "https://example.com",
  "url": "https://example.com"
}

400 Bad Request

{
  "error": "URL is required"
}

500 Internal Server Error

{
  "error": "Failed to fetch URL"
}

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any bugs, improvements, or new features.

  • Fork the repository.
  • Create a new branch (git checkout -b feature-branch).
  • Commit your changes (git commit -m 'Add some feature').
  • Push to the branch (git push origin feature-branch).
  • Open a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

metadata-extract-api's People

Contributors

bkanhu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.