Python scraper based on AI
Python ai-crawlerai-scrapingai-searchcrawlerdata-extractionfirecrawl-alternativelarge-language-modelllmmarkdownragscrapingscraping-pythonweb-crawlerweb-crawlersweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
fix: changed proxy function
VinciGit00b754dd909cd2
diff --git a/scrapegraphai/nodes/fetch_node.py b/scrapegraphai/nodes/fetch_node.pyindex bdbabfb1..2564d44d 100644--- a/scrapegraphai/nodes/fetch_node.py+++ b/scrapegraphai/nodes/fetch_node.py@@ -7,7 +7,7 @@ from langchain_community.document_loaders import AsyncHtmlLoaderfrom langchain_core.documents import Documentfrom .base_node import BaseNodefrom ..utils.remover import remover-from ..utils.proxy_rotation import proxy_rotation+from ..utils.proxy_generator import proxy_generatorclass FetchNode(BaseNode):@@ -84,7 +84,7 @@ class FetchNode(BaseNode):else:if self.num_prox > 1:loader = AsyncHtmlLoader(- source, proxies=proxy_rotation(self.num_prox))+ source, proxies=proxy_generator(self.num_prox))else:loader = AsyncHtmlLoader(source)document = loader.load()diff --git a/scrapegraphai/utils/__init__.py b/scrapegraphai/utils/__init__.pyindex 4d339ed4..3fd1d884 100644--- a/scrapegraphai/utils/__init__.py+++ b/scrapegraphai/utils/__init__.py@@ -5,4 +5,4 @@ from .save_audio_from_bytes import save_audio_from_bytesfrom .convert_to_csv import convert_to_csvfrom .convert_to_json import convert_to_jsonfrom .prettify_exec_info import prettify_exec_info-from .proxy_rotation import proxy_rotation+from .proxy_generator import proxy_generatordiff --git a/scrapegraphai/utils/proxy_rotation.py b/scrapegraphai/utils/proxy_rotation.pyindex 62f9f1de..0019b421 100644--- a/scrapegraphai/utils/proxy_rotation.py+++ b/scrapegraphai/utils/proxy_rotation.py@@ -4,7 +4,7 @@ Module for rotating proxiesfrom fp.fp import FreeProxy-def proxy_rotation(num_ips: int):+def proxy_generator(num_ips: int):"""Rotates through a specified number of proxy IPs using the FreeProxy library.@@ -15,7 +15,7 @@ def proxy_rotation(num_ips: int):dict: A dictionary containing the rotated proxy IPs, indexed by their position in rotation.Example:- >>> proxy_rotation(5)+ >>> proxy_generator(5){0: '192.168.1.1:8080',1: '103.10.63.135:8080',@@ -24,9 +24,8 @@ def proxy_rotation(num_ips: int):4: '113.20.31.250:8080'}"""- res = {}+ res = []for i in range(0, num_ips):- res[i] = FreeProxy().get()-+ res.append(FreeProxy().get())return res