Use this file to discover all available pages before exploring further.
Learn how to extract structured company information from websites using ScrapeGraphAIβs Extract service. This example demonstrates how to gather company details, contact information, and social media presence.
from pydantic import BaseModel, Fieldfrom typing import Listfrom scrapegraph_py import ScrapeGraphAI# Schema for founder informationclass FounderSchema(BaseModel): name: str = Field(description="Name of the founder") role: str = Field(description="Role of the founder in the company") linkedin: str = Field(description="LinkedIn profile of the founder")# Schema for pricing plansclass PricingPlanSchema(BaseModel): tier: str = Field(description="Name of the pricing tier") price: str = Field(description="Price of the plan") credits: int = Field(description="Number of credits included in the plan")# Schema for social linksclass SocialLinksSchema(BaseModel): linkedin: str = Field(description="LinkedIn page of the company") twitter: str = Field(description="Twitter page of the company") github: str = Field(description="GitHub page of the company")# Schema for company informationclass CompanyInfoSchema(BaseModel): company_name: str = Field(description="Name of the company") description: str = Field(description="Brief description of the company") founders: List[FounderSchema] = Field(description="List of company founders") logo: str = Field(description="Logo URL of the company") partners: List[str] = Field(description="List of company partners") pricing_plans: List[PricingPlanSchema] = Field(description="Details of pricing plans") contact_emails: List[str] = Field(description="Contact emails of the company") social_links: SocialLinksSchema = Field(description="Social links of the company") privacy_policy: str = Field(description="URL to the privacy policy") terms_of_service: str = Field(description="URL to the terms of service") api_status: str = Field(description="API status page URL")sgai = ScrapeGraphAI(api_key="your-api-key")res = sgai.extract( "Extract info about the company", url="https://scrapegraphai.com/", schema=CompanyInfoSchema.model_json_schema(),)if res.status == "success": print(res.data.json_data)else: print("Failed:", res.error)