Free Proxy Scraper avatar

Free Proxy Scraper

Try for free

Pay $5.00 for 1,000 results

Go to Store
Free Proxy Scraper

Free Proxy Scraper

codepoetry/free-proxy-fetcher
Try for free

Pay $5.00 for 1,000 results

Scrape and filter 100% working free proxies with our tool. Filter by country codes and protocols (HTTP, SSL, SOCKS4, SOCKS5), then sort by speed. Ideal for web scraping, SEO, or bypassing restrictions. Get a ready-to-use list in seconds with automated validation and sorting.

Developer
Maintained by Community

Actor Metrics

  • 1 Monthly user

  • No reviews yet

  • No bookmarks yet

  • >99% runs succeeded

  • Created in Mar 2025

  • Modified 3 days ago

.dockerignore

1.git
2.mise.toml
3.nvim.lua
4storage
5
6# The rest is copied from https://github.com/github/gitignore/blob/main/Python.gitignore
7
8# Byte-compiled / optimized / DLL files
9__pycache__/
10*.py[cod]
11*$py.class
12
13# C extensions
14*.so
15
16# Distribution / packaging
17.Python
18build/
19develop-eggs/
20dist/
21downloads/
22eggs/
23.eggs/
24lib/
25lib64/
26parts/
27sdist/
28var/
29wheels/
30share/python-wheels/
31*.egg-info/
32.installed.cfg
33*.egg
34MANIFEST
35
36# PyInstaller
37#  Usually these files are written by a python script from a template
38#  before PyInstaller builds the exe, so as to inject date/other infos into it.
39*.manifest
40*.spec
41
42# Installer logs
43pip-log.txt
44pip-delete-this-directory.txt
45
46# Unit test / coverage reports
47htmlcov/
48.tox/
49.nox/
50.coverage
51.coverage.*
52.cache
53nosetests.xml
54coverage.xml
55*.cover
56*.py,cover
57.hypothesis/
58.pytest_cache/
59cover/
60
61# Translations
62*.mo
63*.pot
64
65# Django stuff:
66*.log
67local_settings.py
68db.sqlite3
69db.sqlite3-journal
70
71# Flask stuff:
72instance/
73.webassets-cache
74
75# Scrapy stuff:
76.scrapy
77
78# Sphinx documentation
79docs/_build/
80
81# PyBuilder
82.pybuilder/
83target/
84
85# Jupyter Notebook
86.ipynb_checkpoints
87
88# IPython
89profile_default/
90ipython_config.py
91
92# pyenv
93#   For a library or package, you might want to ignore these files since the code is
94#   intended to run in multiple environments; otherwise, check them in:
95.python-version
96
97# pdm
98#   Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
99#pdm.lock
100#   pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
101#   in version control.
102#   https://pdm.fming.dev/latest/usage/project/#working-with-version-control
103.pdm.toml
104.pdm-python
105.pdm-build/
106
107# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
108__pypackages__/
109
110# Celery stuff
111celerybeat-schedule
112celerybeat.pid
113
114# SageMath parsed files
115*.sage.py
116
117# Environments
118.env
119.venv
120env/
121venv/
122ENV/
123env.bak/
124venv.bak/
125
126# Spyder project settings
127.spyderproject
128.spyproject
129
130# Rope project settings
131.ropeproject
132
133# mkdocs documentation
134/site
135
136# mypy
137.mypy_cache/
138.dmypy.json
139dmypy.json
140
141# Pyre type checker
142.pyre/
143
144# pytype static type analyzer
145.pytype/
146
147# Cython debug symbols
148cython_debug/
149
150# PyCharm
151#  JetBrains specific template is maintained in a separate JetBrains.gitignore that can
152#  be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
153#  and can be added to the global gitignore or merged into this file.  For a more nuclear
154#  option (not recommended) you can uncomment the following to ignore the entire idea folder.
155.idea/

.gitignore

1.mise.toml
2.nvim.lua
3storage
4
5# The rest is copied from https://github.com/github/gitignore/blob/main/Python.gitignore
6
7# Byte-compiled / optimized / DLL files
8__pycache__/
9*.py[cod]
10*$py.class
11
12# C extensions
13*.so
14
15# Distribution / packaging
16.Python
17build/
18develop-eggs/
19dist/
20downloads/
21eggs/
22.eggs/
23lib/
24lib64/
25parts/
26sdist/
27var/
28wheels/
29share/python-wheels/
30*.egg-info/
31.installed.cfg
32*.egg
33MANIFEST
34
35# PyInstaller
36#  Usually these files are written by a python script from a template
37#  before PyInstaller builds the exe, so as to inject date/other infos into it.
38*.manifest
39*.spec
40
41# Installer logs
42pip-log.txt
43pip-delete-this-directory.txt
44
45# Unit test / coverage reports
46htmlcov/
47.tox/
48.nox/
49.coverage
50.coverage.*
51.cache
52nosetests.xml
53coverage.xml
54*.cover
55*.py,cover
56.hypothesis/
57.pytest_cache/
58cover/
59
60# Translations
61*.mo
62*.pot
63
64# Django stuff:
65*.log
66local_settings.py
67db.sqlite3
68db.sqlite3-journal
69
70# Flask stuff:
71instance/
72.webassets-cache
73
74# Scrapy stuff:
75.scrapy
76
77# Sphinx documentation
78docs/_build/
79
80# PyBuilder
81.pybuilder/
82target/
83
84# Jupyter Notebook
85.ipynb_checkpoints
86
87# IPython
88profile_default/
89ipython_config.py
90
91# pyenv
92#   For a library or package, you might want to ignore these files since the code is
93#   intended to run in multiple environments; otherwise, check them in:
94.python-version
95
96# pdm
97#   Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
98#pdm.lock
99#   pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
100#   in version control.
101#   https://pdm.fming.dev/latest/usage/project/#working-with-version-control
102.pdm.toml
103.pdm-python
104.pdm-build/
105
106# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
107__pypackages__/
108
109# Celery stuff
110celerybeat-schedule
111celerybeat.pid
112
113# SageMath parsed files
114*.sage.py
115
116# Environments
117.env
118.venv
119env/
120venv/
121ENV/
122env.bak/
123venv.bak/
124
125# Spyder project settings
126.spyderproject
127.spyproject
128
129# Rope project settings
130.ropeproject
131
132# mkdocs documentation
133/site
134
135# mypy
136.mypy_cache/
137.dmypy.json
138dmypy.json
139
140# Pyre type checker
141.pyre/
142
143# pytype static type analyzer
144.pytype/
145
146# Cython debug symbols
147cython_debug/
148
149# PyCharm
150#  JetBrains specific template is maintained in a separate JetBrains.gitignore that can
151#  be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
152#  and can be added to the global gitignore or merged into this file.  For a more nuclear
153#  option (not recommended) you can uncomment the following to ignore the entire idea folder.
154.idea/
155
156# Added by Apify CLI
157node_modules

requirements.txt

1annotated-types==0.7.0
2anyio==4.8.0
3apify==2.4.0
4apify_client==1.9.2
5apify_shared==1.3.1
6Brotli==1.1.0
7browserforge==1.2.3
8cachetools==5.5.2
9certifi==2025.1.31
10cffi==1.17.1
11charset-normalizer==3.4.1
12click==8.1.8
13colorama==0.4.6
14crawlee==0.6.3
15cryptography==44.0.2
16docutils==0.21.2
17eval_type_backport==0.2.2
18filelock==3.17.0
19h11==0.14.0
20h2==4.2.0
21hpack==4.1.0
22httpcore==1.0.7
23httpx==0.28.1
24hyperframe==6.1.0
25idna==3.10
26lazy-object-proxy==1.10.0
27markdown-it-py==3.0.0
28mdurl==0.1.2
29more-itertools==10.6.0
30multidict==6.1.0
31numpy==2.2.3
32pandas==2.2.3
33propcache==0.3.0
34psutil==7.0.0
35pycountry==24.6.1
36pycparser==2.22
37pydantic==2.10.6
38pydantic-settings==2.6.1
39pydantic_core==2.27.2
40pyee==12.1.1
41Pygments==2.19.1
42python-dateutil==2.9.0.post0
43python-dotenv==1.0.1
44pytz==2025.1
45requests==2.32.3
46requests-file==2.1.0
47rich==13.9.4
48setuptools==75.8.2
49six==1.17.0
50sniffio==1.3.1
51sortedcollections==2.1.0
52sortedcontainers==2.4.0
53tldextract==5.1.3
54typing_extensions==4.12.2
55tzdata==2025.1
56urllib3==2.3.0
57websockets==15.0.1
58wheel==0.45.1
59yarl==1.18.3
60zstandard==0.23.0

.actor/Dockerfile

1# First, specify the base Docker image.
2# You can see the Docker images from Apify at https://hub.docker.com/r/apify/.
3# You can also use any other image from Docker Hub.
4FROM apify/actor-python:3.12
5
6# Second, copy just requirements.txt into the Actor image,
7# since it should be the only file that affects the dependency install in the next step,
8# in order to speed up the build
9COPY requirements.txt ./
10
11# Install the packages specified in requirements.txt,
12# Print the installed Python version, pip version
13# and all installed packages with their versions for debugging
14RUN echo "Python version:" \
15    && python --version \
16    && echo "Pip version:" \
17    && pip --version \
18    && echo "Installing dependencies:" \
19    && pip install -r requirements.txt \
20    && echo "All installed Python packages:" \
21    && pip freeze
22
23# Next, copy the remaining files and directories with the source code.
24# Since we do this after installing the dependencies, quick build will be really fast
25# for most source file changes.
26COPY . ./
27
28# Use compileall to ensure the runnability of the Actor Python code.
29RUN python3 -m compileall -q .
30
31# Create and run as a non-root user.
32RUN useradd --create-home apify && \
33    chown -R apify:apify ./  && \
34    chown -R apify:apify /usr/local/lib/python*
35USER apify
36
37
38# Specify how to launch the source code of your Actor.
39# By default, the "python3 -m ." command is run
40CMD ["python3", "-m", "src"]

.actor/INPUT_SCHEMA.json

1{
2  "title": "Proxy Fetcher",
3  "description": "Fetches free proxies with optional filtering by country codes, protocol support, and sorting options.",
4  "type": "object",
5  "schemaVersion": 1,
6  "properties": {
7    "country_codes": {
8      "title": "Country Codes",
9      "type": "array",
10      "description": "List of country codes to filter proxies (e.g., ['US', 'UK'])",
11      "editor": "stringList"
12    },
13    "http": {
14      "title": "HTTP",
15      "type": "string",
16      "enum": ["true", "false", "unset"],
17      "default": "unset",
18      "editor": "select",
19      "description": "Filter proxies based on HTTP support: 'true' includes only proxies that support HTTP, 'false' includes only those that do not, 'unset' applies no filter."
20    },
21    "ssl": {
22      "title": "SSL",
23      "type": "string",
24      "enum": ["true", "false", "unset"],
25      "default": "unset",
26      "editor": "select",
27      "description": "Filter proxies based on SSL support: 'true' includes only proxies that support SSL, 'false' includes only those that do not, 'unset' applies no filter."
28    },
29    "socks4": {
30      "title": "SOCKS4",
31      "type": "string",
32      "enum": ["true", "false", "unset"],
33      "default": "unset",
34      "editor": "select",
35      "description": "Filter proxies based on SOCKS4 support: 'true' includes only proxies that support SOCKS4, 'false' includes only those that do not, 'unset' applies no filter."
36    },
37    "socks5": {
38      "title": "SOCKS5",
39      "type": "string",
40      "enum": ["true", "false", "unset"],
41      "default": "unset",
42      "editor": "select",
43      "description": "Filter proxies based on SOCKS5 support: 'true' includes only proxies that support SOCKS5, 'false' includes only those that do not, 'unset' applies no filter."
44    },
45    "sort_by": {
46      "title": "Sort By",
47      "type": "string",
48      "description": "The field name to sort results by (e.g., 'delay', 'lastseen', 'checks_up', 'checks_down').",
49      "enum": ["delay", "lastseen", "checks_up", "checks_down"],
50      "default": "delay",
51      "editor": "select"
52    },
53    "sort_order": {
54      "title": "Sort Order",
55      "type": "string",
56      "description": "Sorting order: 'asc' for ascending, 'desc' for descending. Defaults to 'asc' if not provided.",
57      "enum": ["asc", "desc"],
58      "default": "asc",
59      "editor": "select"
60    }
61  }
62}

.actor/actor.json

1{
2  "actorSpecification": 1,
3  "name": "free-proxy-fetcher",
4  "title": "Free Proxy Scraper",
5  "description": "Scrapes and filters free proxy servers with protocol support mapping, country filtering, and sorting capabilities",
6  "version": "1.0",
7  "buildTag": "latest",
8  "environmentVariables": {
9    "PROXIES_SOURCE_URL": "https://vakhov.github.io/fresh-proxy-list/proxylist.json"
10  },
11  "dockerfile": "./Dockerfile",
12  "storages": {
13    "dataset": {
14      "actorSpecification": 1,
15      "fields": {
16        "type": "object",
17        "properties": {
18          "proxies": {
19            "type": "array",
20            "items": {
21              "type": "object",
22              "description": "Processed proxy data"
23            }
24          },
25          "error": {
26            "type": "string",
27            "description": "Error details"
28          }
29        },
30        "required": ["proxies"]
31      },
32      "views": {
33        "overview": {
34          "title": "Overview",
35          "transformation": {
36            "fields": ["proxies", "error"]
37          },
38          "display": {
39            "component": "table",
40            "properties": {
41              "proxies": {
42                "label": "Proxies",
43                "format": "json"
44              },
45              "error": {
46                "label": "Error",
47                "format": "text"
48              }
49            }
50          }
51        }
52      }
53    }
54  }
55}

src/__init__.py

src/__main__.py

1import asyncio
2
3from .main import main
4
5# Execute the Actor entry point.
6asyncio.run(main())

src/main.py

1from apify import Actor
2from os import getenv
3import requests
4from .models import ProtocolFilter, ProxyFetcherInput, ProxyFetcherOutput
5from .utils import map_anonymity_level
6
7
8async def main():
9    async with Actor:
10        try:
11            input_data = await Actor.get_input()
12            params = (
13                ProxyFetcherInput(**input_data) if input_data else ProxyFetcherInput()
14            )
15
16            url = getenv("PROXIES_SOURCE_URL")
17            Actor.log.info(f"Fetching proxies")
18            response = requests.get(url, timeout=10)
19            response.raise_for_status()
20            raw_proxies = response.json()
21
22            # Process proxy data
23            processed = []
24            for proxy in raw_proxies:
25                if not proxy.get("country_code"):
26                    proxy["country_code"] = "Unknown"
27                try:
28                    processed_proxy = {
29                        "ip": proxy["ip"],
30                        "port": int(proxy["port"]),
31                        "http": proxy["http"] == "1",
32                        "ssl": proxy["ssl"] == "1",
33                        "socks4": proxy["socks4"] == "1",
34                        "socks5": proxy["socks5"] == "1",
35                        "anon": map_anonymity_level(proxy["anon"]),
36                        "country_code": proxy.get("country_code").upper(),
37                        "delay": float(proxy.get("delay", 0)),
38                        "lastseen": proxy.get("lastseen"),
39                        "checks_up": proxy.get("checks_up"),
40                        "checks_down": proxy.get("checks_down"),
41                    }
42                    processed.append(processed_proxy)
43                except (KeyError, ValueError) as e:
44                    Actor.log.warning(
45                        f"Skipping invalid proxy entry: {proxy}. Error: {str(e)}"
46                    )
47
48            # Apply filters with None safety
49            filtered = [
50                p
51                for p in processed
52                if (
53                    params.country_codes is None
54                    or (
55                        isinstance(p.get("country_code"), str)
56                        and p["country_code"] in params.country_codes
57                    )
58                )
59                and (
60                    params.http == ProtocolFilter.UNSET
61                    or p["http"] == (params.http == ProtocolFilter.TRUE)
62                )
63                and (
64                    params.ssl == ProtocolFilter.UNSET
65                    or p["ssl"] == (params.ssl == ProtocolFilter.TRUE)
66                )
67                and (
68                    params.socks4 == ProtocolFilter.UNSET
69                    or p["socks4"] == (params.socks4 == ProtocolFilter.TRUE)
70                )
71                and (
72                    params.socks5 == ProtocolFilter.UNSET
73                    or p["socks5"] == (params.socks5 == ProtocolFilter.TRUE)
74                )
75            ]
76
77            # Safe sorting implementation
78            if params.sort_by:
79                reverse = params.sort_order.lower() == "desc"
80                try:
81                    filtered.sort(
82                        key=lambda x: x.get(params.sort_by, 0), reverse=reverse
83                    )
84                except Exception as e:
85                    Actor.log.error(f"Sorting failed: {str(e)}")
86
87            await Actor.push_data(
88                ProxyFetcherOutput(proxies=filtered).model_dump(
89                    exclude_none=True, exclude_unset=True
90                )
91            )
92
93        except Exception as e:
94            error_msg = f"Actor failed: {str(e)}"
95            Actor.log.error(error_msg)
96            await Actor.fail(exception=e, status_message=error_msg)

src/models.py

1from pydantic import BaseModel, Field, field_validator
2from typing import List, Optional
3from enum import Enum
4import pycountry
5
6
7class ProtocolFilter(str, Enum):
8    TRUE = "true"
9    FALSE = "false"
10    UNSET = "unset"
11
12
13class ProxyFetcherInput(BaseModel):
14    country_codes: Optional[List[str]] = Field(
15        None, description="List of ISO country codes (e.g., ['US', 'DE'])"
16    )
17    http: ProtocolFilter = ProtocolFilter.UNSET
18    ssl: ProtocolFilter = ProtocolFilter.UNSET
19    socks4: ProtocolFilter = ProtocolFilter.UNSET
20    socks5: ProtocolFilter = ProtocolFilter.UNSET
21    sort_by: str = "lastseen"
22    sort_order: str = "asc"
23
24    @field_validator("country_codes")
25    @classmethod
26    def validate_country_codes(cls, v: Optional[List[str]]) -> Optional[List[str]]:
27        if v is None:
28            return v
29
30        valid_alpha2 = {country.alpha_2.upper() for country in pycountry.countries}
31        valid_alpha3 = {country.alpha_3.upper() for country in pycountry.countries}
32
33        valid = []
34        invalid = []
35        for code in v:
36            if not isinstance(code, str):
37                invalid.append(str(code))
38                continue
39            normalized = code.strip().upper()
40            if normalized in valid_alpha2 or normalized in valid_alpha3:
41                valid.append(code)
42            else:
43                invalid.append(code)
44
45        if invalid:
46            raise ValueError(f"Invalid country codes: {', '.join(invalid)}")
47        return valid
48
49
50class ProxyFetcherOutput(BaseModel):
51    proxies: List[dict] = Field(..., description="Processed proxy data")
52    error: Optional[str] = Field(None, description="Error details")

src/py.typed

1

src/utils.py

1def map_anonymity_level(level: str) -> str:
2    level_map = {
3        "1": "No anonymity",
4        "2": "Low anonymity",
5        "3": "Average anonymity",
6        "4": "High anonymity",
7    }
8    return level_map.get(level, "Unknown")