|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "# ScraperAPI\n", |
| 8 | + "\n", |
| 9 | + "[ScraperAPI](https://www.scraperapi.com/) enables data collection from any public website with its web scraping API, without worrying about proxies, browsers, or CAPTCHA handling. [langchain-scraperapi](https://github.com/scraperapi/langchain-scraperapi) wraps this service, making it easy for AI agents to browse the web and scrape data from it.\n", |
| 10 | + "\n", |
| 11 | + "## Installation and Setup\n", |
| 12 | + "\n", |
| 13 | + "- Install the Python package with `pip install langchain-scraperapi`.\n", |
| 14 | + "- Obtain an API key from [ScraperAPI](https://www.scraperapi.com/) and set the environment variable `SCRAPERAPI_API_KEY`.\n", |
| 15 | + "\n", |
| 16 | + "### Tools\n", |
| 17 | + "\n", |
| 18 | + "The package offers 3 tools to scrape any website, get structured Google search results, and get structured Amazon search results respectively.\n", |
| 19 | + "\n", |
| 20 | + "To import them:" |
| 21 | + ] |
| 22 | + }, |
| 23 | + { |
| 24 | + "cell_type": "code", |
| 25 | + "execution_count": null, |
| 26 | + "metadata": {}, |
| 27 | + "outputs": [], |
| 28 | + "source": [ |
| 29 | + "%pip install langchain_scraperapi\n", |
| 30 | + "\n", |
| 31 | + "from langchain_scraperapi.tools import (\n", |
| 32 | + " ScraperAPIAmazonSearchTool,\n", |
| 33 | + " ScraperAPIGoogleSearchTool,\n", |
| 34 | + " ScraperAPITool,\n", |
| 35 | + ")" |
| 36 | + ] |
| 37 | + }, |
| 38 | + { |
| 39 | + "cell_type": "markdown", |
| 40 | + "metadata": {}, |
| 41 | + "source": [ |
| 42 | + "Example use:" |
| 43 | + ] |
| 44 | + }, |
| 45 | + { |
| 46 | + "cell_type": "code", |
| 47 | + "execution_count": null, |
| 48 | + "metadata": {}, |
| 49 | + "outputs": [], |
| 50 | + "source": [ |
| 51 | + "tool = ScraperAPITool()\n", |
| 52 | + "\n", |
| 53 | + "result = tool.invoke({\"url\": \"https://example.com\", \"output_format\": \"markdown\"})\n", |
| 54 | + "print(result)" |
| 55 | + ] |
| 56 | + }, |
| 57 | + { |
| 58 | + "cell_type": "markdown", |
| 59 | + "metadata": {}, |
| 60 | + "source": [ |
| 61 | + "For a more detailed walkthrough of how to use these tools, visit the [official repository](https://github.com/scraperapi/langchain-scraperapi)." |
| 62 | + ] |
| 63 | + } |
| 64 | + ], |
| 65 | + "metadata": { |
| 66 | + "language_info": { |
| 67 | + "name": "python" |
| 68 | + } |
| 69 | + }, |
| 70 | + "nbformat": 4, |
| 71 | + "nbformat_minor": 2 |
| 72 | +} |
0 commit comments