VinciGit00 / Scrapegraph-ai

Python scraper based on AI

Home Page:https://scrapegraphai.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gemini depends on timeout to reply.

wrench1997 opened this issue · comments

Describe the bug
I generated a free Gemini key and found that its use was restricted, but I could obtain the information using the example given on the official website.

example

from scrapegraphai.graphs import SmartScraperGraph
from scrapegraphai.nodes import FetchNode
# fetcher = FetchNode(
#     node_config={
#         "headless": False,
#         "endpoint": "http://192.168.166.8:7890",
#     }
# )
GOOGLE_APIKEY = "xxxxxxxxxxxxxxxxxxxxxxxxx"

# Define the configuration for the graph
graph_config = {
    "llm": {
        "api_key": GOOGLE_APIKEY,
        "model": "gemini-pro",
    },
}

# Create the SmartScraperGraph instance
smart_scraper_graph = SmartScraperGraph(
    prompt="提取并列出新闻标题,与简单概述一下内容",
    source="https://news.163.com/",
    config=graph_config
)

result = smart_scraper_graph.run()
print(result)

Screenshots
QQ截图20240519021049

Version 1.2.4