repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
Scrapegraph-ai | scrapegraphai/models/deepseek.py | .py | """
DeepSeek Module
"""
from langchain_openai import ChatOpenAI
class DeepSeek(ChatOpenAI):
"""
A wrapper for the ChatOpenAI class (DeepSeek uses an OpenAI-like API) that
provides default configuration and could be extended with additional methods
if needed.
Args:
llm_config (dict): Conf... | 24 | 627 |
Scrapegraph-ai | scrapegraphai/models/minimax.py | .py | """
MiniMax Module
"""
from langchain_openai import ChatOpenAI
DEFAULT_MINIMAX_OPENAI_BASE_URL = "https://api.minimax.io/v1"
class MiniMax(ChatOpenAI):
"""
A wrapper for the ChatOpenAI class (MiniMax uses an OpenAI-compatible API) that
provides default configuration and could be extended with additiona... | 28 | 781 |
Scrapegraph-ai | scrapegraphai/nodes/generate_answer_node.py | .py | """
GenerateAnswerNode Module
"""
import json
import time
from typing import List, Optional
from langchain_core.prompts import PromptTemplate
from langchain_aws import ChatBedrock
from langchain_ollama import ChatOllama
from langchain_core.output_parsers import JsonOutputParser
from langchain_core.runnables import Ru... | 268 | 10,286 |
Scrapegraph-ai | scrapegraphai/nodes/generate_answer_csv_node.py | .py | """
Module for generating the answer node
"""
from typing import List, Optional
from langchain_core.prompts import PromptTemplate
from langchain_core.output_parsers import JsonOutputParser
from langchain_core.runnables import RunnableParallel
from langchain_mistralai import ChatMistralAI
from langchain_openai import ... | 171 | 6,457 |
Scrapegraph-ai | scrapegraphai/nodes/reasoning_node.py | .py | """
PromptRefinerNode Module
"""
from typing import List, Optional
from langchain_core.prompts import PromptTemplate
from langchain_ollama import ChatOllama
from langchain_core.output_parsers import StrOutputParser
from ..prompts import TEMPLATE_REASONING, TEMPLATE_REASONING_WITH_CONTEXT
from ..utils import transfor... | 104 | 3,670 |
Scrapegraph-ai | scrapegraphai/nodes/markdownify_node.py | .py | """
MarkdownifyNode Module
"""
from typing import List, Optional
from ..utils.convert_to_md import convert_to_md
from .base_node import BaseNode
class MarkdownifyNode(BaseNode):
"""
A node responsible for converting HTML content to Markdown format.
This node takes HTML content from the state and conver... | 68 | 2,209 |
Scrapegraph-ai | scrapegraphai/nodes/merge_answers_node.py | .py | """
MergeAnswersNode Module
"""
from typing import List, Optional
from langchain_core.prompts import PromptTemplate
from langchain_ollama import ChatOllama
from langchain_core.output_parsers import JsonOutputParser
from langchain_mistralai import ChatMistralAI
from langchain_openai import ChatOpenAI
from ..prompts i... | 128 | 4,519 |
Scrapegraph-ai | scrapegraphai/nodes/description_node.py | .py | """
DescriptionNode Module
"""
from typing import List, Optional
from langchain_core.prompts import PromptTemplate
from langchain_core.runnables import RunnableParallel
from tqdm import tqdm
from ..prompts.description_node_prompts import DESCRIPTION_NODE_PROMPT
from .base_node import BaseNode
class DescriptionNode... | 73 | 2,483 |
Scrapegraph-ai | scrapegraphai/nodes/generate_code_node.py | .py | """
GenerateCodeNode Module
"""
import ast
import json
import re
import sys
from io import StringIO
from typing import Any, Dict, List, Optional
from bs4 import BeautifulSoup
from jsonschema import ValidationError as JSONSchemaValidationError
from jsonschema import validate
from langchain_classic.output_parsers impor... | 490 | 17,689 |
Scrapegraph-ai | scrapegraphai/nodes/concat_answers_node.py | .py | """
ConcatAnswersNode Module
"""
from typing import List, Optional
from .base_node import BaseNode
class ConcatAnswersNode(BaseNode):
"""
A node responsible for concatenating the answers from multiple
graph instances into a single answer.
Attributes:
verbose (bool): A flag indicating whethe... | 74 | 2,279 |
Scrapegraph-ai | scrapegraphai/nodes/graph_iterator_node.py | .py | """
GraphIterator Module
"""
import asyncio
from typing import List, Optional, Type
from pydantic import BaseModel
from tqdm.asyncio import tqdm
from .base_node import BaseNode
DEFAULT_BATCHSIZE = 16
class GraphIteratorNode(BaseNode):
"""
A node responsible for instantiating and running multiple graph ins... | 148 | 4,714 |
Scrapegraph-ai | scrapegraphai/nodes/rag_node.py | .py | """
RAGNode Module
"""
from typing import List, Optional
from .base_node import BaseNode
class RAGNode(BaseNode):
"""
A node responsible for compressing the input tokens and storing the document
in a vector database for retrieval. Relevant chunks are stored in the state.
It allows scraping of big d... | 107 | 3,570 |
Scrapegraph-ai | scrapegraphai/nodes/parse_node.py | .py | """
ParseNode Module
"""
import re
from typing import List, Optional, Tuple
from urllib.parse import urljoin
from langchain_community.document_transformers import Html2TextTransformer
from langchain_core.documents import Document
from ..helpers import default_filters
from ..utils.split_text_into_chunks import split_... | 220 | 7,284 |
Scrapegraph-ai | scrapegraphai/nodes/generate_answer_from_image_node.py | .py | """
GenerateAnswerFromImageNode Module
"""
import asyncio
import base64
from typing import List, Optional
import aiohttp
from .base_node import BaseNode
class GenerateAnswerFromImageNode(BaseNode):
"""
GenerateAnswerFromImageNode analyzes images from the state dictionary using the OpenAI API
and update... | 128 | 3,921 |
Scrapegraph-ai | scrapegraphai/nodes/robots_node.py | .py | """
RobotsNode Module
"""
from typing import List, Optional
from urllib.parse import urlparse
from langchain_core.output_parsers import CommaSeparatedListOutputParser
from langchain_core.prompts import PromptTemplate
from ..helpers import robots_dictionary
from ..prompts import TEMPLATE_ROBOT
from .base_node import ... | 132 | 5,193 |
Scrapegraph-ai | scrapegraphai/nodes/fetch_screen_node.py | .py | """
fetch_screen_node module
"""
from typing import List, Optional
from playwright.sync_api import sync_playwright
from .base_node import BaseNode
class FetchScreenNode(BaseNode):
"""
FetchScreenNode captures screenshots from a given URL and stores the image data as bytes.
"""
def __init__(
... | 59 | 1,650 |
Scrapegraph-ai | scrapegraphai/nodes/base_node.py | .py | """
This module defines the base node class for the ScrapeGraphAI application.
"""
import re
from abc import ABC, abstractmethod
from typing import List, Optional
from ..utils import get_logger
class BaseNode(ABC):
"""
An abstract base class for nodes in a graph-based workflow,
designed to perform speci... | 236 | 8,188 |
Scrapegraph-ai | scrapegraphai/nodes/get_probable_tags_node.py | .py | """
GetProbableTagsNode Module
"""
from typing import List
from langchain_core.output_parsers import CommaSeparatedListOutputParser
from langchain_core.prompts import PromptTemplate
from ..prompts import TEMPLATE_GET_PROBABLE_TAGS
from .base_node import BaseNode
class GetProbableTagsNode(BaseNode):
"""
A n... | 91 | 3,171 |
Scrapegraph-ai | scrapegraphai/nodes/__init__.py | .py | """
__init__.py file for node folder module
"""
from .base_node import BaseNode
from .batch_generate_answer_node import BatchGenerateAnswerNode
from .concat_answers_node import ConcatAnswersNode
from .conditional_node import ConditionalNode
from .description_node import DescriptionNode
from .fetch_node import FetchNod... | 80 | 2,665 |
Scrapegraph-ai | scrapegraphai/nodes/html_analyzer_node.py | .py | """
HtmlAnalyzerNode Module
"""
from typing import List, Optional
from langchain_core.prompts import PromptTemplate
from langchain_ollama import ChatOllama
from langchain_core.output_parsers import StrOutputParser
from ..prompts import TEMPLATE_HTML_ANALYSIS, TEMPLATE_HTML_ANALYSIS_WITH_CONTEXT
from ..utils import r... | 108 | 3,898 |
Scrapegraph-ai | scrapegraphai/nodes/batch_generate_answer_node.py | .py | """
BatchGenerateAnswerNode Module
A node that collects LLM prompts from multiple scraped documents
and submits them as a single OpenAI Batch API request for 50% cost savings.
"""
import json
import logging
from typing import Any, Dict, List, Optional
from langchain_core.prompts import PromptTemplate
from langchain_... | 254 | 8,849 |
Scrapegraph-ai | scrapegraphai/nodes/text_to_speech_node.py | .py | """
TextToSpeechNode Module
"""
from typing import List, Optional
from .base_node import BaseNode
class TextToSpeechNode(BaseNode):
"""
Converts text to speech using the specified text-to-speech model.
Attributes:
tts_model: An instance of the text-to-speech model client.
verbose (bool)... | 68 | 2,151 |
Scrapegraph-ai | scrapegraphai/nodes/fetch_node_level_k.py | .py | """
fetch_node_level_k module
"""
from typing import List, Optional
from urllib.parse import urljoin
from bs4 import BeautifulSoup
from langchain_core.documents import Document
from ..docloaders import ChromiumLoader
from .base_node import BaseNode
class FetchNodeLevelK(BaseNode):
"""
A node responsible fo... | 312 | 11,654 |
Scrapegraph-ai | scrapegraphai/nodes/merge_generated_scripts_node.py | .py | """
MergeAnswersNode Module
"""
from typing import List, Optional
from langchain_core.prompts import PromptTemplate
from langchain_core.output_parsers import StrOutputParser
from ..prompts import TEMPLATE_MERGE_SCRIPTS_PROMPT
from .base_node import BaseNode
class MergeGeneratedScriptsNode(BaseNode):
"""
A ... | 84 | 2,967 |
Scrapegraph-ai | scrapegraphai/nodes/parse_node_depth_k_node.py | .py | """
ParseNodeDepthK Module
"""
from typing import List, Optional
from langchain_community.document_transformers import Html2TextTransformer
from .base_node import BaseNode
class ParseNodeDepthK(BaseNode):
"""
A node responsible for parsing HTML content from a series of documents.
This node enhances th... | 74 | 2,380 |
Scrapegraph-ai | scrapegraphai/nodes/generate_scraper_node.py | .py | """
GenerateScraperNode Module
"""
from typing import List, Optional
from langchain_core.prompts import PromptTemplate
from langchain_core.output_parsers import JsonOutputParser, StrOutputParser
from .base_node import BaseNode
class GenerateScraperNode(BaseNode):
"""
Generates a python script for scraping ... | 143 | 5,530 |
Scrapegraph-ai | scrapegraphai/nodes/fetch_node.py | .py | """
FetchNode Module
"""
import json
from typing import List, Optional
import concurrent.futures
import requests
from langchain_core.documents import Document
from langchain_openai import AzureChatOpenAI, ChatOpenAI
from ..docloaders import ChromiumLoader
from ..utils.cleanup_html import cleanup_html
from ..utils.co... | 410 | 15,691 |
Scrapegraph-ai | scrapegraphai/nodes/generate_answer_node_k_level.py | .py | """
GenerateAnswerNodeKLevel Module
"""
from typing import List, Optional
from langchain_aws import ChatBedrock
from langchain_ollama import ChatOllama
from langchain_core.output_parsers import JsonOutputParser
from langchain_core.prompts import PromptTemplate
from langchain_core.runnables import RunnableParallel
fro... | 178 | 6,599 |
Scrapegraph-ai | scrapegraphai/nodes/search_node_with_context.py | .py | """
SearchInternetNode Module
"""
from typing import List, Optional
from langchain_core.output_parsers import CommaSeparatedListOutputParser
from langchain_core.prompts import PromptTemplate
from tqdm import tqdm
from ..prompts import (
TEMPLATE_SEARCH_WITH_CONTEXT_CHUNKS,
TEMPLATE_SEARCH_WITH_CONTEXT_NO_CHU... | 107 | 3,880 |
Scrapegraph-ai | scrapegraphai/nodes/prompt_refiner_node.py | .py | """
PromptRefinerNode Module
"""
from typing import List, Optional
from langchain_core.prompts import PromptTemplate
from langchain_ollama import ChatOllama
from langchain_core.output_parsers import StrOutputParser
from ..prompts import TEMPLATE_REFINER, TEMPLATE_REFINER_WITH_CONTEXT
from ..utils import transform_sc... | 109 | 3,899 |
Scrapegraph-ai | scrapegraphai/nodes/search_internet_node.py | .py | """
SearchInternetNode Module
"""
from typing import List, Optional
from langchain_core.output_parsers import CommaSeparatedListOutputParser
from langchain_core.prompts import PromptTemplate
from langchain_ollama import ChatOllama
from ..prompts import TEMPLATE_SEARCH_INTERNET
from ..utils.research_web import search... | 118 | 4,254 |
Scrapegraph-ai | scrapegraphai/nodes/conditional_node.py | .py | """
Module for implementing the conditional node
"""
from typing import List, Optional
from simpleeval import EvalWithCompoundTypes, simple_eval
from .base_node import BaseNode
class ConditionalNode(BaseNode):
"""
A node that determines the next step in the graph's execution flow based on
the presence ... | 113 | 3,891 |
Scrapegraph-ai | scrapegraphai/nodes/search_link_node.py | .py | """
SearchLinkNode Module
"""
import re
from typing import List, Optional
from urllib.parse import parse_qs, urlparse
from langchain_core.prompts import PromptTemplate
from langchain_core.output_parsers import JsonOutputParser
from tqdm import tqdm
from ..helpers import default_filters
from ..prompts import TEMPLATE... | 159 | 5,832 |
Scrapegraph-ai | scrapegraphai/nodes/image_to_text_node.py | .py | """
ImageToTextNode Module
"""
from typing import List, Optional
from langchain_core.messages import HumanMessage
from .base_node import BaseNode
class ImageToTextNode(BaseNode):
"""
Retrieve images from a list of URLs and return a description of
the images using an image-to-text model.
Attributes... | 89 | 3,065 |
Scrapegraph-ai | scrapegraphai/nodes/generate_answer_omni_node.py | .py | """
GenerateAnswerNode Module
"""
from typing import List, Optional
from langchain_core.prompts import PromptTemplate
from langchain_ollama import ChatOllama
from langchain_core.output_parsers import JsonOutputParser
from langchain_core.runnables import RunnableParallel
from langchain_mistralai import ChatMistralAI
f... | 171 | 6,226 |
Scrapegraph-ai | scrapegraphai/helpers/__init__.py | .py | """
This module provides helper functions and utilities for the ScrapeGraphAI application.
"""
from .models_tokens import models_tokens
from .nodes_metadata import nodes_metadata
from .robots import robots_dictionary
from .schemas import graph_schema
__all__ = [
"models_tokens",
"nodes_metadata",
"robots_... | 16 | 355 |
Scrapegraph-ai | scrapegraphai/helpers/default_filters.py | .py | """
Module for filtering irrelevant links
"""
filter_dict = {
"diff_domain_filter": True,
"img_exts": [".jpg", ".jpeg", ".png", ".gif", ".bmp", ".svg", ".webp", ".ico"],
"lang_indicators": ["lang=", "/fr", "/pt", "/es", "/de", "/jp", "/it"],
"irrelevant_keywords": [
"/login",
"/signup",... | 22 | 498 |
Scrapegraph-ai | scrapegraphai/helpers/models_tokens.py | .py | """
List of model tokens
"""
models_tokens = {
"openai": {
"gpt-3.5-turbo-0125": 16385,
"gpt-3.5": 4096,
"gpt-3.5-turbo": 16385,
"gpt-3.5-turbo-1106": 16385,
"gpt-3.5-turbo-instruct": 4096,
"gpt-4-0125-preview": 128000,
"gpt-4-turbo-preview": 128000,
... | 420 | 14,307 |
Scrapegraph-ai | scrapegraphai/helpers/robots.py | .py | """
Module for mapping the models in ai agents
"""
robots_dictionary = {
"gpt-3.5-turbo": ["GPTBot", "ChatGPT-user"],
"gpt-4-turbo": ["GPTBot", "ChatGPT-user"],
"gpt-4o": ["GPTBot", "ChatGPT-user"],
"gpt-4o-mini": ["GPTBot", "ChatGPT-user"],
"claude": ["Claude-Web", "ClaudeBot"],
"perplexity": ... | 15 | 399 |
Scrapegraph-ai | scrapegraphai/helpers/schemas.py | .py | """
Schemas representing the configuration of a graph or node in the ScrapeGraphAI library
"""
graph_schema = {
"name": "ScrapeGraphAI Graph Configuration",
"description": "JSON schema for representing graphs in the ScrapeGraphAI library",
"type": "object",
"properties": {
"nodes": {
... | 63 | 2,320 |
Scrapegraph-ai | scrapegraphai/helpers/nodes_metadata.py | .py | """
Nodes metadata for the scrapegraphai package.
"""
nodes_metadata = {
"SearchInternetNode": {
"description": """Refactors the user's query into a search
query and fetches the search result URLs.""",
"type": "node",
"args": {"user_input": "User's query or question."},
"r... | 85 | 3,727 |
Scrapegraph-ai | scrapegraphai/integrations/__init__.py | .py | """
Init file for integrations module
"""
from .burr_bridge import BurrBridge
from .indexify_node import IndexifyNode
__all__ = [
"BurrBridge",
"IndexifyNode",
]
| 12 | 172 |
Scrapegraph-ai | scrapegraphai/integrations/burr_bridge.py | .py | """
Bridge class to integrate Burr into ScrapeGraphAI graphs
[Burr](https://github.com/DAGWorks-Inc/burr)
"""
import inspect
import re
import uuid
from typing import Any, Dict, List, Tuple
from ..utils.logging import get_logger
logger = get_logger(__name__)
try:
from burr import tracking
from burr.core impo... | 232 | 7,591 |
Scrapegraph-ai | scrapegraphai/integrations/indexify_node.py | .py | """
IndexifyNode Module
"""
from typing import List, Optional
from ..nodes.base_node import BaseNode
class IndexifyNode(BaseNode):
"""
A node responsible for indexing the content present in the state.
Attributes:
verbose (bool): A flag indicating whether to show print statements during executio... | 66 | 1,961 |
Scrapegraph-ai | scrapegraphai/integrations/scrapegraph_py_compat.py | .py | """
Compatibility layer for scrapegraph-py SDK.
Supports both the v2 `Client` API (PR #82) and the newer `ScrapeGraphAI`
API (PR #84) which uses Pydantic request models and an ApiResult wrapper.
"""
from __future__ import annotations
from typing import Any, Optional, Type
from pydantic import BaseModel
def _detec... | 110 | 3,280 |
Scrapegraph-ai | examples/depth_search_graph/openai/depth_search_graph_openai.py | .py | """
depth_search_graph_opeani example
"""
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import DepthSearchGraph
load_dotenv()
openai_key = os.getenv("OPENAI_API_KEY")
graph_config = {
"llm": {
"api_key": openai_key,
"model": "openai/gpt-4o-mini",
},
"verbose": True... | 34 | 601 |
Scrapegraph-ai | examples/depth_search_graph/ollama/depth_search_graph_ollama.py | .py | """
depth_search_graph_opeani example
"""
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import DepthSearchGraph
load_dotenv()
openai_key = os.getenv("OPENAI_APIKEY")
graph_config = {
"llm": {
"model": "ollama/llama3.1",
"temperature": 0,
"format": "json", # Ollama... | 36 | 749 |
Scrapegraph-ai | examples/script_generator_graph/openai/script_generator_multi_openai.py | .py | """
Basic example of scraping pipeline using ScriptCreatorGraph
"""
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import ScriptCreatorMultiGraph
from scrapegraphai.utils import prettify_exec_info
load_dotenv()
# ************************************************
# Define the configuration for th... | 58 | 1,499 |
Scrapegraph-ai | examples/script_generator_graph/openai/script_generator_openai.py | .py | """
Basic example of scraping pipeline using SmartScraper
"""
import json
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import ScriptCreatorGraph
from scrapegraphai.utils import prettify_exec_info
load_dotenv()
# ************************************************
# Define the configuration for t... | 50 | 1,282 |
Scrapegraph-ai | examples/script_generator_graph/openai/script_generator_schema_openai.py | .py | """
Basic example of scraping pipeline using ScriptCreatorGraph
"""
import os
from typing import List
from dotenv import load_dotenv
from pydantic import BaseModel, Field
from scrapegraphai.graphs import ScriptCreatorGraph
from scrapegraphai.utils import prettify_exec_info
load_dotenv()
# *************************... | 63 | 1,683 |
Scrapegraph-ai | examples/script_generator_graph/ollama/script_generator_ollama.py | .py | """
Basic example of scraping pipeline using ScriptCreatorGraph
"""
from scrapegraphai.graphs import ScriptCreatorGraph
from scrapegraphai.utils import prettify_exec_info
# ************************************************
# Define the configuration for the graph
# ************************************************
gra... | 43 | 1,298 |
Scrapegraph-ai | examples/script_generator_graph/ollama/script_multi_generator_ollama.py | .py | """
Basic example of scraping pipeline using ScriptCreatorGraph
"""
from dotenv import load_dotenv
from scrapegraphai.graphs import ScriptCreatorMultiGraph
from scrapegraphai.utils import prettify_exec_info
load_dotenv()
# ************************************************
# Define the configuration for the graph
# *... | 56 | 1,586 |
Scrapegraph-ai | examples/xml_scraper_graph/openai/xml_scraper_openai.py | .py | """
Basic example of scraping pipeline using XMLScraperGraph from XML documents
"""
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import XMLScraperGraph
from scrapegraphai.utils import prettify_exec_info
load_dotenv()
# ************************************************
# Read the XML file
# ***... | 58 | 1,524 |
Scrapegraph-ai | examples/xml_scraper_graph/openai/xml_scraper_graph_multi_openai.py | .py | """
Basic example of scraping pipeline using XMLScraperMultiGraph from XML documents
"""
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import XMLScraperMultiGraph
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
load_dotenv()
# *******************************... | 62 | 1,695 |
Scrapegraph-ai | examples/xml_scraper_graph/ollama/xml_scraper_ollama.py | .py | """
Basic example of scraping pipeline using XMLScraperGraph from XML documents
"""
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import XMLScraperGraph
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
load_dotenv()
# *****************************************... | 62 | 1,710 |
Scrapegraph-ai | examples/xml_scraper_graph/ollama/xml_scraper_graph_multi_ollama.py | .py | """
Basic example of scraping pipeline using XMLScraperMultiGraph from XML documents
"""
import os
from scrapegraphai.graphs import XMLScraperMultiGraph
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
# ************************************************
# Read the XML file
# *******... | 59 | 1,771 |
Scrapegraph-ai | examples/extras/scrape_do.py | .py | """
Basic example of scraping pipeline using SmartScraper
"""
import json
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import SmartScraperGraph
load_dotenv()
# ************************************************
# Define the configuration for the graph
# *****************************************... | 43 | 956 |
Scrapegraph-ai | examples/extras/custom_prompt.py | .py | """
Basic example of scraping pipeline using SmartScraper
"""
import json
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import SmartScraperGraph
from scrapegraphai.utils import prettify_exec_info
load_dotenv()
# ************************************************
# Define the configuration for t... | 54 | 1,341 |
Scrapegraph-ai | examples/extras/conditional_usage.py | .py | """
Basic example of scraping pipeline using SmartScraperMultiConcatGraph with Groq
"""
import json
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import SmartScraperMultiGraph
load_dotenv()
# ************************************************
# Define the configuration for the graph
# **********... | 40 | 980 |
Scrapegraph-ai | examples/extras/no_cut.py | .py | """
This example shows how to do not process the html code in the fetch phase
"""
import json
from scrapegraphai.graphs import SmartScraperGraph
from scrapegraphai.utils import prettify_exec_info
# ************************************************
# Define the configuration for the graph
# ***************************... | 44 | 1,151 |
Scrapegraph-ai | examples/extras/slow_mo.py | .py | """
Basic example of scraping pipeline using SmartScraper
"""
from scrapegraphai.graphs import SmartScraperGraph
from scrapegraphai.utils import prettify_exec_info
# ************************************************
# Define the configuration for the graph
# ************************************************
graph_conf... | 49 | 1,473 |
Scrapegraph-ai | examples/extras/browser_base_integration.py | .py | """
Basic example of scraping pipeline using SmartScraper
"""
import json
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import SmartScraperGraph
from scrapegraphai.utils import prettify_exec_info
load_dotenv()
# ************************************************
# Define the configuration for th... | 52 | 1,336 |
Scrapegraph-ai | examples/extras/force_mode.py | .py | """
Basic example of scraping pipeline using SmartScraper
"""
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import SmartScraperGraph
from scrapegraphai.utils import prettify_exec_info
load_dotenv()
# ************************************************
# Define the configuration for the graph
# *... | 57 | 1,569 |
Scrapegraph-ai | examples/extras/authenticated_playwright.py | .py | """
Example leveraging a state file containing session cookies which
might be leveraged to authenticate to a website and scrape protected
content.
"""
import os
import random
from dotenv import load_dotenv
# import playwright so we can use it to create the state file
from playwright.async_api import async_playwright... | 95 | 2,950 |
Scrapegraph-ai | examples/extras/screenshot_scaping.py | .py | """
example of scraping with screenshots
"""
import asyncio
from scrapegraphai.utils.screenshot_scraping import (
crop_image,
detect_text,
select_area_with_opencv,
take_screenshot,
)
# STEP 1: Take a screenshot
image = asyncio.run(
take_screenshot(
url="https://colab.google/",
sav... | 40 | 1,057 |
Scrapegraph-ai | examples/extras/cond_smartscraper_usage.py | .py | """
Basic example of scraping pipeline using SmartScraperMultiConcatGraph with Groq
"""
import json
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import SmartScraperGraph
load_dotenv()
# ************************************************
# Define the configuration for the graph
# ***************... | 41 | 1,024 |
Scrapegraph-ai | examples/extras/proxy_rotation.py | .py | """
Basic example of scraping pipeline using SmartScraper
"""
from scrapegraphai.graphs import SmartScraperGraph
from scrapegraphai.utils import prettify_exec_info
# ************************************************
# Define the configuration for the graph
# ************************************************
graph_conf... | 48 | 1,317 |
Scrapegraph-ai | examples/extras/html_mode.py | .py | """
Basic example of scraping pipeline using SmartScraper
By default smart scraper converts in md format the
code. If you want to just use the original code, you have
to specify in the confi
"""
import json
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import SmartScraperGraph
from scrapegraphai... | 52 | 1,349 |
Scrapegraph-ai | examples/extras/reasoning.py | .py | """
Basic example of scraping pipeline using SmartScraper
"""
import json
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import SmartScraperGraph
from scrapegraphai.utils import prettify_exec_info
load_dotenv()
# ************************************************
# Define the configuration for th... | 49 | 1,216 |
Scrapegraph-ai | examples/extras/undected_playwright.py | .py | """
Basic example of scraping pipeline using SmartScraper
"""
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import SmartScraperGraph
from scrapegraphai.utils import prettify_exec_info
load_dotenv()
# ************************************************
# Define the configuration for the graph
# **... | 46 | 1,255 |
Scrapegraph-ai | examples/extras/chromium_selenium.py | .py | import asyncio
import json
import os
from aiohttp import ClientError
from dotenv import load_dotenv
from scrapegraphai.docloaders.chromium import ( # Import your ChromiumLoader class
ChromiumLoader,
)
from scrapegraphai.graphs import SmartScraperGraph
# Load environment variables for API keys
load_dotenv()
# ... | 149 | 4,947 |
Scrapegraph-ai | examples/extras/rag_caching.py | .py | """
Basic example of scraping pipeline using SmartScraper
"""
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import SmartScraperGraph
from scrapegraphai.utils import prettify_exec_info
load_dotenv()
# ************************************************
# Define the configuration for the graph
# *... | 49 | 1,227 |
Scrapegraph-ai | examples/extras/serch_graph_scehma.py | .py | """
Example of Search Graph
"""
import os
from typing import List
from dotenv import load_dotenv
from pydantic import BaseModel, Field
from scrapegraphai.graphs import SearchGraph
load_dotenv()
# ************************************************
# Define the configuration for the graph
# **************************... | 50 | 985 |
Scrapegraph-ai | examples/extras/load_yml.py | .py | """
Basic example of scraping pipeline using SmartScraper
"""
import yaml
from scrapegraphai.graphs import SmartScraperGraph
from scrapegraphai.utils import prettify_exec_info
# ************************************************
# Define the configuration for the graph
# ***********************************************... | 35 | 990 |
Scrapegraph-ai | examples/markdownify/markdownify_scrapegraphai_v3.py | .py | """
Scrape a webpage as markdown using the scrapegraph-py v3 API (PR #84).
Uses ScrapeGraphAI client + ScrapeRequest model + ApiResult wrapper.
"""
import json
import os
from dotenv import load_dotenv
from scrapegraph_py import ScrapeGraphAI, ScrapeRequest
load_dotenv()
api_key = os.getenv("SGAI_API_KEY") or os.get... | 25 | 723 |
Scrapegraph-ai | examples/markdownify/markdownify_scrapegraphai.py | .py | """
Scrape a webpage as clean markdown using scrapegraph-py v2 API.
Replaces the old markdownify() call with scrape().
"""
import json
import os
from dotenv import load_dotenv
from scrapegraph_py import Client
load_dotenv()
api_key = os.getenv("SCRAPEGRAPH_API_KEY")
if not api_key:
raise ValueError("SCRAPEGRAPH... | 21 | 501 |
Scrapegraph-ai | examples/speech_graph/speech_graph_openai.py | .py | """
Basic example of scraping pipeline using SpeechSummaryGraph
"""
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import SpeechGraph
from scrapegraphai.utils import prettify_exec_info
load_dotenv()
# ************************************************
# Define audio output path
# ****************... | 57 | 1,504 |
Scrapegraph-ai | examples/csv_scraper_graph/openai/csv_scraper_graph_multi_openai.py | .py | """
Basic example of scraping pipeline using CSVScraperMultiGraph from CSV documents
"""
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import CSVScraperMultiGraph
from scrapegraphai.utils import prettify_exec_info
load_dotenv()
# ************************************************
# Read the CSV f... | 55 | 1,441 |
Scrapegraph-ai | examples/csv_scraper_graph/openai/csv_scraper_openai.py | .py | """
Basic example of scraping pipeline using CSVScraperGraph from CSV documents
"""
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import CSVScraperGraph
from scrapegraphai.utils import prettify_exec_info
load_dotenv()
# ************************************************
# Read the CSV file
# ***... | 57 | 1,463 |
Scrapegraph-ai | examples/csv_scraper_graph/ollama/csv_scraper_graph_multi_ollama.py | .py | """
Basic example of scraping pipeline using CSVScraperMultiGraph from CSV documents
"""
import os
from scrapegraphai.graphs import CSVScraperMultiGraph
from scrapegraphai.utils import prettify_exec_info
# ************************************************
# Read the CSV file
# ****************************************... | 60 | 1,705 |
Scrapegraph-ai | examples/csv_scraper_graph/ollama/csv_scraper_ollama.py | .py | """
Basic example of scraping pipeline using CSVScraperGraph from CSV documents
"""
import os
from scrapegraphai.graphs import CSVScraperGraph
from scrapegraphai.utils import prettify_exec_info
# ************************************************
# Read the CSV file
# ************************************************
... | 60 | 1,725 |
Scrapegraph-ai | examples/json_scraper_graph/openai/json_scraper_multi_openai.py | .py | """
Module for showing how PDFScraper multi works
"""
import json
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import JSONScraperMultiGraph
load_dotenv()
openai_key = os.getenv("OPENAI_APIKEY")
graph_config = {
"llm": {
"api_key": openai_key,
"model": "openai/gpt-4o",
... | 41 | 817 |
Scrapegraph-ai | examples/json_scraper_graph/openai/omni_scraper_openai.py | .py | """
Basic example of scraping pipeline using OmniScraper
"""
import json
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import OmniScraperGraph
from scrapegraphai.utils import prettify_exec_info
load_dotenv()
# ************************************************
# Define the configuration for the ... | 51 | 1,317 |
Scrapegraph-ai | examples/json_scraper_graph/openai/json_scraper_openai.py | .py | """
Basic example of scraping pipeline using JSONScraperGraph from JSON documents
"""
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import JSONScraperGraph
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
load_dotenv()
# **************************************... | 61 | 1,636 |
Scrapegraph-ai | examples/json_scraper_graph/openai/md_scraper_openai.py | .py | """
Basic example of scraping pipeline using DocumentScraperGraph from MD documents
"""
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import DocumentScraperGraph
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
load_dotenv()
# ********************************... | 61 | 1,619 |
Scrapegraph-ai | examples/json_scraper_graph/ollama/json_scraper_multi_ollama.py | .py | """
Module for showing how PDFScraper multi works
"""
import json
import os
from scrapegraphai.graphs import JSONScraperMultiGraph
graph_config = {
"llm": {
"model": "ollama/llama3",
"temperature": 0,
"format": "json", # Ollama needs the format to be specified explicitly
"model_t... | 39 | 879 |
Scrapegraph-ai | examples/json_scraper_graph/ollama/json_scraper_ollama.py | .py | """
Basic example of scraping pipeline using JSONScraperGraph from JSON documents
"""
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import JSONScraperGraph
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
load_dotenv()
# **************************************... | 63 | 1,803 |
Scrapegraph-ai | examples/search_graph/openai/search_link_graph_openai.py | .py | """
Basic example of scraping pipeline using SmartScraper
"""
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import SearchLinkGraph
from scrapegraphai.utils import prettify_exec_info
load_dotenv()
# ************************************************
# Define the configuration for the graph
# *****... | 45 | 1,097 |
Scrapegraph-ai | examples/search_graph/openai/search_graph_openai.py | .py | """
Example of Search Graph
"""
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import SearchGraph
load_dotenv()
# ************************************************
# Define the configuration for the graph
# ************************************************
openai_key = os.getenv("OPENAI_API_KEY"... | 38 | 759 |
Scrapegraph-ai | examples/search_graph/openai/search_graph_schema_openai.py | .py | """
Example of Search Graph
"""
import os
from typing import List
from dotenv import load_dotenv
from pydantic import BaseModel, Field
from scrapegraphai.graphs import SearchGraph
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
load_dotenv()
# ***********************************... | 63 | 1,563 |
Scrapegraph-ai | examples/search_graph/scrapegraphai/searchscraper_scrapegraphai.py | .py | """
Search the web and extract AI-structured results using scrapegraph-py v2 API.
Replaces the old searchscraper() call with search().
"""
import json
import os
from dotenv import load_dotenv
from scrapegraph_py import Client
load_dotenv()
api_key = os.getenv("SCRAPEGRAPH_API_KEY")
if not api_key:
raise ValueEr... | 21 | 531 |
Scrapegraph-ai | examples/search_graph/scrapegraphai/searchscraper_scrapegraphai_v3.py | .py | """
Search the web using the scrapegraph-py v3 API (PR #84).
Uses ScrapeGraphAI client + SearchRequest model + ApiResult wrapper.
"""
import json
import os
from dotenv import load_dotenv
from scrapegraph_py import ScrapeGraphAI, SearchRequest
load_dotenv()
api_key = os.getenv("SGAI_API_KEY") or os.getenv("SCRAPEGRA... | 25 | 719 |
Scrapegraph-ai | examples/search_graph/ollama/search_graph_schema_ollama.py | .py | """
Example of Search Graph
"""
from typing import List
from pydantic import BaseModel, Field
from scrapegraphai.graphs import SearchGraph
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
# ************************************************
# Define the output schema for the graph
#... | 62 | 1,643 |
Scrapegraph-ai | examples/search_graph/ollama/search_graph_ollama.py | .py | """
Example of Search Graph
"""
from scrapegraphai.graphs import SearchGraph
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
# ************************************************
# Define the configuration for the graph
# ************************************************
graph_config... | 45 | 1,223 |
Scrapegraph-ai | examples/omni_scraper_graph/omni_search_openai.py | .py | """
Example of OmniSearchGraph
"""
import json
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import OmniSearchGraph
from scrapegraphai.utils import prettify_exec_info
load_dotenv()
# ************************************************
# Define the configuration for the graph
# *******************... | 49 | 1,158 |
Scrapegraph-ai | examples/custom_graph/openai/custom_graph_openai.py | .py | """
Example of custom graph using existing nodes
"""
import os
from dotenv import load_dotenv
from langchain_openai import ChatOpenAI, OpenAIEmbeddings
from scrapegraphai.graphs import BaseGraph
from scrapegraphai.nodes import (
FetchNode,
GenerateAnswerNode,
ParseNode,
RAGNode,
RobotsNode,
)
lo... | 117 | 2,629 |
Scrapegraph-ai | examples/custom_graph/ollama/custom_graph_ollama.py | .py | """
Example of custom graph using existing nodes
"""
from langchain_openai import ChatOpenAI, OpenAIEmbeddings
from scrapegraphai.graphs import BaseGraph
from scrapegraphai.nodes import (
FetchNode,
GenerateAnswerNode,
ParseNode,
RobotsNode,
)
# ************************************************
# Defi... | 104 | 2,469 |
Scrapegraph-ai | examples/document_scraper_graph/openai/document_scraper_openai.py | .py | """
document_scraper example
"""
import json
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import DocumentScraperGraph
load_dotenv()
openai_key = os.getenv("OPENAI_APIKEY")
graph_config = {
"llm": {
"api_key": openai_key,
"model": "openai/gpt-4o",
}
}
source = """
... | 43 | 1,414 |
Scrapegraph-ai | examples/document_scraper_graph/ollama/document_scraper_ollama.py | .py | """
document_scraper example
"""
import json
from dotenv import load_dotenv
from scrapegraphai.graphs import DocumentScraperGraph
load_dotenv()
# ************************************************
# Define the configuration for the graph
# ************************************************
graph_config = {
"llm": ... | 46 | 1,655 |
Scrapegraph-ai | examples/code_generator_graph/openai/code_generator_graph_openai.py | .py | """
Basic example of scraping pipeline using Code Generator with schema
"""
import os
from typing import List
from dotenv import load_dotenv
from pydantic import BaseModel, Field
from scrapegraphai.graphs import CodeGeneratorGraph
load_dotenv()
# ************************************************
# Define the output... | 66 | 1,577 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.