GithubHelp home page GithubHelp logo

ainzl / singlefetch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from miladrahimi/singet

0.0 0.0 0.0 35 KB

A simple web proxy that can fetch (download or stream) a single URL.

Go 89.43% Dockerfile 10.57%

singlefetch's Introduction

SingleFetch

A simple web proxy that can fetch (download or stream) a single URL. It is written in Go programming language.

How to use

After running, you can fetch a single URL this way:

[host]:[port]/?url=[url]

For example:

https://domain.com/?url=https://target.com/video.mp4

The proxy passes the request body and headers (HTTP method, referrer, auth, etc.) to the requested URL.

Base64 Encoding

If you want to use this proxy on censored internet, you might need to encode URLs. To do so, you can use the base64 parameter instead of url like this example:

// Using "url" parameter:
https://domain.com/?url=https://miladrahimi.com

// Using "base64" parameter:
https://domain.com/?base64=aHR0cHM6Ly9taWxhZHJhaGltaS5jb20=

Redirection

The requested URL might return an HTTP redirection response. In this case, the proxy behaves based on the redirection parameter or its default behavior when the parameter is not present. You can pass this parameter to the app this way:

[host]:[port]/?url=[url]&redirection=[value]

Default

The default behavior is returning the response with no manipulation. For example, if the request was http://proxy.com/?url=https://google.com the response would be a standard redirection to https://www.google.com.

follow

When redirection is follow, It will be redirected through the proxy. For example, if the request was http://proxy.com/?url=https://google.com&redirection=follow the response would be a redirection to http://proxy.com/?url=https://www.google.com&redirection=follow.

stop

When redirection is stop, It returns a JSON response contains the target location. For example, if the request was http://proxy.com/?url=https://google.com&redirection=stop the response would be:

HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Length: ...
Content-Type: application/json
Date: ...

{"location":"https://www.google.com/"}

HTTP Header Manipulation

In default, SingleFetch passes the request headers without any change, but you may want to manipulate some headers like referer or any other HTTP header. In this case, you can pass the related header in the query string with the prefix h__ like this example:

https://proxy.com/?url=https://www.google.com&h__referer=https://images.google.com

License

SingleFetch is initially created by Milad Rahimi and released under the MIT License.

singlefetch's People

Contributors

miladrahimi 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.