From 863c545f9aaf1e6856cc1b3653024040dc2b1d95 Mon Sep 17 00:00:00 2001 From: zhisenyang Date: Sun, 24 Apr 2022 16:58:01 +0800 Subject: [PATCH] add proxy --- src/edge_tts/communicate.py | 2 ++ src/edge_tts/util.py | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/edge_tts/communicate.py b/src/edge_tts/communicate.py index f0e80d7..a383ec8 100644 --- a/src/edge_tts/communicate.py +++ b/src/edge_tts/communicate.py @@ -214,6 +214,7 @@ class Communicate: # pylint: disable=too-few-public-methods rate="+0%", volume="+0%", customspeak=False, + proxy=None, ): # pylint: disable=too-many-arguments, too-many-locals """ Runs the Communicate class. @@ -273,6 +274,7 @@ class Communicate: # pylint: disable=too-few-public-methods compress=15, autoclose=True, autoping=True, + proxy=proxy, headers={ "Pragma": "no-cache", "Cache-Control": "no-cache", diff --git a/src/edge_tts/util.py b/src/edge_tts/util.py index 2c68eae..d0181bd 100644 --- a/src/edge_tts/util.py +++ b/src/edge_tts/util.py @@ -39,6 +39,7 @@ async def _tts(args): args.rate, args.volume, customspeak=args.custom_ssml, + proxy=args.proxy, ): if i[2] is not None: if not args.write_media: @@ -128,6 +129,10 @@ async def _main(): "--write-subtitles", help="instead of stderr, send subtitle output to provided file", ) + parser.add_argument( + "--proxy", + help="proxy", + ) args = parser.parse_args() if args.list_voices: