|
|
@ -12,7 +12,7 @@ from yt_dlp_stream_to_s3.errors import YtDlpStreamToS3Error
|
|
|
|
def yt_dlp_stream_to_s3(
|
|
|
|
def yt_dlp_stream_to_s3(
|
|
|
|
url: str,
|
|
|
|
url: str,
|
|
|
|
expiration=86400 * 7, # 7 days
|
|
|
|
expiration=86400 * 7, # 7 days
|
|
|
|
s3_extra_args: dict = (),
|
|
|
|
s3_extra_args=dict(),
|
|
|
|
) -> Dict[str, str]:
|
|
|
|
) -> Dict[str, str]:
|
|
|
|
media_url = remove_queries_from_url(url)
|
|
|
|
media_url = remove_queries_from_url(url)
|
|
|
|
|
|
|
|
|
|
|
@ -53,12 +53,14 @@ def yt_dlp_stream_to_s3(
|
|
|
|
|
|
|
|
|
|
|
|
yt_dlp_process.wait()
|
|
|
|
yt_dlp_process.wait()
|
|
|
|
|
|
|
|
|
|
|
|
return dict(
|
|
|
|
response = dict(
|
|
|
|
presigned_url=create_presigned_url(
|
|
|
|
presigned_url=create_presigned_url(
|
|
|
|
AWS_S3_BUCKET_NAME, filename, expiration
|
|
|
|
AWS_S3_BUCKET_NAME, filename, expiration
|
|
|
|
),
|
|
|
|
),
|
|
|
|
filesize=get_file_size(AWS_S3_BUCKET_NAME, filename),
|
|
|
|
filesize=get_file_size(AWS_S3_BUCKET_NAME, filename),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return response
|
|
|
|
except HTTPError:
|
|
|
|
except HTTPError:
|
|
|
|
raise YtDlpStreamToS3Error("Could not connect to the media resource.")
|
|
|
|
raise YtDlpStreamToS3Error("Could not connect to the media resource.")
|
|
|
|
|
|
|
|
|
|
|
|