"""
Basic example of scraping pipeline using SmartScraper and OneAPI
"""
from typing import List
from pydantic import BaseModel, Field
from scrapegraphai.graphs import SmartScraperGraph
from scrapegraphai.utils import prettify_exec_info
class Project(BaseModel):
title: str = Field(description="The title of the project")
description: str = Field(description="The description of the project")
class Projects(BaseModel):
projects: List[Project]
graph_config = {
"llm": {
"api_key": "***************************",
"model": "oneapi/qwen-turbo",
"base_url": "http://127.0.0.1:3000/v1",
}
}
smart_scraper_graph = SmartScraperGraph(
prompt="List me all the projects with their description",
source="https://perinim.github.io/projects/",
config=graph_config,
schema=Projects
)
result = smart_scraper_graph.run()
print(result)
print(prettify_exec_info(result))