Giter VIP home page Giter VIP logo

freeproxy's Introduction

freeproxy

Get http proxies from some free proxy sites.

Site Accessibility
pachong.org China Only
cn-proxy.com Exclude China
txt.proxyspy.net Exclude China
free-proxy-list Exclude China
www.gatherproxy.com Exclude China
www.hide-my-ip.com Exclude China
www.getproxy.jp Exclude China
Account Required
www.xicidaili.com World Wide
www.cybersyndrome.net World Wide

Installing

$ pip install freeproxy

Requirements

Usage

Collect proxies

Run freeproxy from Terminal:

usage: freeproxy [-h] [-l] [-t] URL

Get http proxies from some free proxy sites

positional arguments:
  URL         The url for testing proxies. Like "https://www.google.com"

optional arguments:
  -h, --help  show this help message and exit
  -l          Logging debug messages to a file
  -t          Test availability of proxies stored in db

Fetch latest proxies from above sites and test them using URL.

$ freeproxy "https://www.google.com"

Testing results are stored in ~/.freeproxy/proxy.db (sqlite). Below is the peewee model:

class Proxy(Model):
    """
    Database Model
    """
    proxy = CharField(primary_key=True)  # "ip:port"
    check_time = DateTimeField(null=True)  # time of testing
    response_time = FloatField(null=True)  # response time(seconds)
    status_code = IntegerField(null=True)  # status code

If the testing URL was unreachable:

  • status_code would be None
  • response_time would be None

Test proxies

You can use the default testing method(Test all the proxies stored in database) or define your own strategy.

freeproxy -t URL uses the default one.

Read proxies

The default method freeproxy.read_proxies() reads all the proxies from database whose status_code is 200.

You can implement your own one.

Customize

See peewee doc for querying, or write your own SQL.

from freeproxy import from_pachong_org, from_xici_daili, from_cyber_syndrome
from freeproxy import Proxy, test_proxies, init_db


def your_fetching():
    proxies = from_pachong_org() + from_xici_daili() + from_cyber_syndrome()
    test_proxies(proxies, timeout=8, single_url='http://www.baidu.com')


def your_reading():
    query = Proxy.select().where(~(Proxy.status_code >> None))
    return [p.proxy for p in query]


def your_testing():
    test_proxies(your_reading(), single_url="http://www.baidu.com")


if __name__ == '__main__':
    init_db()  # If you have never successfully run `freeproxy` on Terminal
    your_fetching()
    your_testing()

ScreenShot

screenshot.png

freeproxy's People

Contributors

iancarv avatar yieldnull avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.