Skip to content

add optional proxy support for stripchat.py [geo-restrictions bypass]#1

Open
medi0x1 wants to merge 4 commits into
masterfrom
stripchat-proxy-support
Open

add optional proxy support for stripchat.py [geo-restrictions bypass]#1
medi0x1 wants to merge 4 commits into
masterfrom
stripchat-proxy-support

Conversation

@medi0x1
Copy link
Copy Markdown
Owner

@medi0x1 medi0x1 commented Nov 26, 2025

Adds proxy support via HTTP_PROXY/HTTPS_PROXY environment variables. Supports HTTP, HTTPS, and SOCKS5 proxies.

Motivation

No built-in proxy configuration exists. Users need this for geo-restrictions, corporate networks, or privacy. Currently requires system-wide proxy settings or forking the repo.

Implementation

  • Added get_proxies() class method to read HTTP_PROXY and HTTPS_PROXY from environment
  • Updated all 4 requests.get() calls in stripchat.py to use proxies=cls.get_proxies()
  • Integrated python-dotenv for .env file support
  • Added .env.example template

Code:

@classmethod
def get_proxies(cls):
    http = os.getenv("HTTP_PROXY")
    https = os.getenv("HTTPS_PROXY")
    return {"http": http, "https": https} if (http or https) else None

Files Changed

  • streamonitor/sites/stripchat.py - proxy support implementation
  • .env.example - configuration template (new file)
  • .gitignore - added .env exclusion

Setup

pip install requests python-dotenv
pip install pysocks  # optional, for SOCKS5
cp .env.example .env
# edit .env with your proxy settings

Usage

Via environment variables:

export HTTP_PROXY="socks5://user:pass@proxy.example.com:1080"
export HTTPS_PROXY="socks5://user:pass@proxy.example.com:1080"
python downloader.py

Via .env file:

# .env
HTTP_PROXY=socks5://user:pass@proxy.example.com:1080
HTTPS_PROXY=socks5://user:pass@proxy.example.com:1080

.env.example

# StreaMonitor Proxy Configuration
# Copy to .env and configure as needed

# HTTP/HTTPS Proxy
# HTTP_PROXY=http://proxy.example.com:8080
# HTTPS_PROXY=https://proxy.example.com:8080

# SOCKS5 Proxy (requires: pip install pysocks)
# HTTP_PROXY=socks5://user:pass@proxy.example.com:1080
# HTTPS_PROXY=socks5://user:pass@proxy.example.com:1080

# Authenticated proxy
# HTTP_PROXY=http://username:password@proxy.example.com:8080
# HTTPS_PROXY=https://username:password@proxy.example.com:8080

# Exclude domains from proxying
# NO_PROXY=localhost,127.0.0.1,.local

Dependencies

Required:

  • requests (already in requirements)
  • python-dotenv

Optional:

  • pysocks (for SOCKS5 support)

Testing

Verified with:

  • HTTP/HTTPS proxies
  • SOCKS5 proxies (authenticated and anonymous)
  • No proxy configuration (default behavior)
  • All StripChat methods: getStatus(), getVideoUrl(), getPlaylistVariants(), getInitialData()

Backward Compatibility

Fully backward compatible. No breaking changes. Proxy support only activates when environment variables are set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants