Skip to content

Commit

Permalink
fix: torrentio cloudflare bypass
Browse files Browse the repository at this point in the history
  • Loading branch information
g0ldyy committed Jul 21, 2024
1 parent f711230 commit d9c98a7
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 8 deletions.
2 changes: 1 addition & 1 deletion comet/api/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ async def stream(request: Request, b64config: str, type: str, id: str):
tasks.append(get_zilean(session, name, log_name, season, episode))

if settings.SCRAPE_TORRENTIO:
tasks.append(get_torrentio(session, log_name, type, full_id))
tasks.append(get_torrentio(log_name, type, full_id))

search_response = await asyncio.gather(*tasks)
for results in search_response:
Expand Down
9 changes: 3 additions & 6 deletions comet/utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import bencodepy

from RTN import parse, title_match
from curl_cffi import requests

from comet.utils.logger import logger
from comet.utils.models import settings, ConfigModel
Expand Down Expand Up @@ -317,15 +318,11 @@ async def get_zilean(
return results


async def get_torrentio(
session: aiohttp.ClientSession, log_name: str, type: str, full_id: str
async def get_torrentio(log_name: str, type: str, full_id: str
):
results = []
try:
get_torrentio = await session.get(
f"https://torrentio.strem.fun/stream/{type}/{full_id}.json"
)
get_torrentio = await get_torrentio.json()
get_torrentio = requests.get(f"https://torrentio.strem.fun/stream/{type}/{full_id}.json").json()

for torrent in get_torrentio["streams"]:
title = torrent["title"]
Expand Down
105 changes: 104 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ aiosqlite = "*"
pydantic-settings = "*"
bencode-py = "*"
httpx = "*"
curl-cffi = "*"

[tool.poetry.group.dev.dependencies]
isort = "*"
Expand Down

0 comments on commit d9c98a7

Please sign in to comment.