Skip to content

Commit 61300a7

Browse files
committed
Take browser user data dir from CLI arguments
1 parent e409d77 commit 61300a7

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ytm/ytm/__main__.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ def sync_playlist(client, playlist_id):
157157

158158
def main():
159159
arg_parser = argparse.ArgumentParser()
160+
arg_parser.add_argument(
161+
"browser_data_dir",
162+
help="Browser user data directory",
163+
type=Path,
164+
)
160165
subparsers = arg_parser.add_subparsers(dest="command", required=True)
161166
subparsers.add_parser(
162167
"download-library",
@@ -179,9 +184,7 @@ def main():
179184

180185
with sync_playwright() as p:
181186
browser = p.chromium.launch_persistent_context(
182-
# Must not be Default.
183-
# TODO: Load from CLI.
184-
user_data_dir="/home/lubo/.config/google-chrome/Profile 13",
187+
user_data_dir=args.browser_data_dir,
185188
executable_path=shutil.which("google-chrome-stable"),
186189
args=[
187190
# Required for Google authentication.
@@ -196,7 +199,7 @@ def main():
196199
with page.expect_response(
197200
lambda response: (
198201
response.request.method == "POST"
199-
and urlsplit(response.url)[0:3]
202+
and urlsplit(response.url)[:3]
200203
== ("https", "music.youtube.com", "/youtubei/v1/browse")
201204
),
202205
timeout=PLATWRIGHT_TIMEOUT,

0 commit comments

Comments
 (0)