mirror of
https://github.com/fergalmoran/xtreamium.git
synced 2025-12-22 09:41:33 +00:00
20 lines
605 B
Python
20 lines
605 B
Python
from httpx import AsyncClient
|
|
import ffmpeg_streaming
|
|
|
|
|
|
class Streamer:
|
|
@staticmethod
|
|
async def receive_file(url):
|
|
async with AsyncClient(follow_redirects=True) as client:
|
|
response = await client.get(url)
|
|
|
|
async for dataBytes in response.aiter_bytes():
|
|
yield dataBytes
|
|
|
|
@staticmethod
|
|
async def receive_stream(url):
|
|
async with AsyncClient(follow_redirects=True) as client:
|
|
async with client.stream('GET', url) as response:
|
|
async for dataBytes in response.aiter_bytes():
|
|
yield dataBytes
|