Code Monkey home page Code Monkey logo

extractly-api's Introduction

Extractly

Extractly is a web scraping API built with Flask, BeautifulSoup, and html2text. It offers a straightforward service for scraping specific content from web pages.

Requirements

  • Python 3
  • pip

Setup and Installation

  1. Clone the repository:
git clone https://github.com/yourusername/extractly.git
cd extractly
  1. (Optional) Set up a virtual environment:
python3 -m venv venv
source venv/bin/activate
  1. Install required packages:
pip install -r requirements.txt
  1. Start the server:
python app.py

The server runs on port 5000 and is accessible from any network interface on your machine.

Usage

You can call Extractly's scraping service by sending a GET request to the /v1/api/webpage/ route with url and selector as parameters.

Using the Selector

  • Select by ID: Prefix the element's ID with a '#' symbol. For example, to select an element with the ID 'main', your selector would be '#main'.
  • Select by Class: Prefix the class name with a '.' symbol. If the class is 'content', your selector should be '.content'.
  • Select by HTML Tag: If you want to select elements by a specific HTML tag (like 'div', 'p', etc.), simply use the tag name as the selector.

Example Requests:

  • Request to scrape the first element with the ID 'main':
curl -X GET "http://localhost:5000/v1/api/webpage/?url=https://www.example.com&selector=#main"
  • Request to scrape the first element with the class 'content':
curl -X GET "http://localhost:5000/v1/api/webpage/?url=https://www.example.com&selector=.content"
  • Request to scrape the first 'article' element:
curl -X GET "http://localhost:5000/v1/api/webpage/?url=https://www.example.com&selector=article"

Note: This tool only returns the first matching element for the provided selector.

Contributing

All contributions are welcome. Please open a new Issue or submit a Pull Request for any bugs, improvements, or feature requests.

License

Extractly is licensed under the MIT License. See the LICENSE.txt file for details.

Contact

For any inquiries or support, please create a new Issue or contact me at [email protected].

extractly-api's People

Contributors

gabrielramirez 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.