mirror of
https://github.com/barkeser2002/offline-db.git
synced 2026-09-25 06:39:51 +03:00
- Initialized 'aniscrap_core' project. - Implemented 'users', 'content', 'billing', 'scraper_module', 'core' apps. - Added models for Anime, Episode, VideoFile (HLS/Encrypted), User, Wallet, etc. - Implemented Celery tasks for Video Encoding (H.265/HLS) and Revenue Distribution. - Integrated Shopier mock payment flow. - Configured Unfold Admin Dashboard. - Refactored Jikan scraper client. - Added 'init_aniscrap' management command. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
from curl_cffi import requests
|
|
|
|
|
|
class CFBypassError(Exception):
|
|
pass
|
|
|
|
|
|
class CFSession:
|
|
def __init__(self, impersonate="chrome110", timeout=15, max_retries=3):
|
|
self.impersonate = impersonate
|
|
self.timeout = timeout
|
|
self.max_retries = max_retries
|
|
self.session = requests.Session()
|
|
|
|
def get(self, url, headers=None, **kwargs):
|
|
try:
|
|
response = self.session.get(
|
|
url,
|
|
headers=headers,
|
|
impersonate=self.impersonate,
|
|
timeout=self.timeout,
|
|
**kwargs,
|
|
)
|
|
return response
|
|
except Exception as e:
|
|
raise CFBypassError(f"Request failed: {e}")
|
|
|
|
def post(self, url, data=None, json=None, headers=None, **kwargs):
|
|
try:
|
|
response = self.session.post(
|
|
url,
|
|
data=data,
|
|
json=json,
|
|
headers=headers,
|
|
impersonate=self.impersonate,
|
|
timeout=self.timeout,
|
|
**kwargs,
|
|
)
|
|
return response
|
|
except Exception as e:
|
|
raise CFBypassError(f"Request failed: {e}")
|