GithubHelp home page GithubHelp logo

maksimkorzh / http-requests-spoofer Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 1.0 9 KB

Freely available & most common web scraping techniques intended to bypass simple anti-scraping measures

Python 100.00%

http-requests-spoofer's Introduction

HTTP requests spoofer

Freely available & most common web scraping techniques intended to bypass simple anti-scraping measures.

What is this?

It's a library with a dead simple interface that
allows making HTTP GET & POST requests via random
free proxy meanwhile spoofing the user agent header.

How it works?

1. It first tries to download a list of free proxies from
   https://free-proxy-list.net/ retrying a user defined number
   of times on fail and then choosing only elite proxies with
   HTTPS support.

2. Then it tests newly scraped proxies with a 1 sec timeout
   and if the proxy is alive it gets appended to a list.

3. Finally it randomly picks up a proxy from a list and
   uses it to make a request to the target URL.
   If proxy fails for some reason original IP is used instead.

How to use it

# import library & dependencies
from scraper import *

# default params are: (use_proxy=True, spoof_agent=True, tries=5, delay=0)
scraper = Scraper()

# if you want to use custom headers
scraper.headers = {
    'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
    'accept-encoding': 'gzip, deflate, br',
    'accept-language': 'en-US,en;q=0.9',
    'cache-control': 'no-cache',
    'pragma': 'no-cache',
    'sec-fetch-mode': 'navigate',
    'sec-fetch-site': 'same-origin',
    'sec-fetch-user': '?1',
    'upgrade-insecure-requests': '1',
    'your-custom-header': 'custom-value',
    'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36'
}

# make GET request
response_get = scraper.GET('https://enckllaec924.x.pipedream.net/')
print(response_get, response_get.text)

# make POST request
response_post = scraper.POST('https://enckllaec924.x.pipedream.net/', {'param1': 'val1', 'param2': 'val2'})
print(response_post, response_post.text)

# check out at
print('visit: https://requestbin.com/r/enckllaec924 to inspect it\n')

# test proxies
print('Testing proxies:')
for i in range(10):
    try: print(scraper.GET('https://api.ipify.org?format=json').text)
    except: print('Failed')

http-requests-spoofer's People

Contributors

maksimkorzh avatar

Stargazers

Abdalrahman Saqr avatar Ravuthz avatar Wahdan Amarulloh avatar LcferShell avatar Patrick Fang avatar  avatar  avatar Red and Green avatar Radia EL HAMDOUNI avatar

Watchers

James Cloos avatar  avatar

Forkers

ditoo2003

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.