- commit
- 98a27d49c5fef62a9f47f95490445856745c6a31
- parent
- 73c88ab7bec8aab2648925d06f87be347453cd17
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2026-04-25 10:30
use argparse
Diffstat
| M | quickstream/__init__.py | 14 | +++++++++++--- |
1 files changed, 11 insertions, 3 deletions
diff --git a/quickstream/__init__.py b/quickstream/__init__.py
@@ -1,6 +1,6 @@ -1 1 import argparse 1 2 import asyncio 2 3 import json3 -1 import sys4 4 5 5 import aiohttp 6 6 from bs4 import BeautifulSoup @@ -10,6 +10,10 @@ from .providers import bandcamp # noqa 10 10 from .providers import mixcloud # noqa 11 11 from .providers import soundcloud # noqa 12 12 -1 13 parser = argparse.ArgumentParser() -1 14 parser.add_argument('url') -1 15 parser.add_argument('--verbose', action='store_true') -1 16 13 17 14 18 class Client: 15 19 def __init__(self, session): @@ -45,5 +49,9 @@ async def extract(url): 45 49 46 50 47 51 def main():48 -1 data = asyncio.run(extract(sys.argv[1]))49 -1 print(json.dumps(data, indent=2))-1 52 args = parser.parse_args() -1 53 data = asyncio.run(extract(args.url)) -1 54 if args.verbose: -1 55 print(json.dumps(data, indent=2)) -1 56 else: -1 57 print(data['stream'])