- commit
- 9419440c17f28c7b0643feae766fc95b8bf357f0
- parent
- 354acf2e787c09c2f402450bb9ed9ac14d7fcadc
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2026-03-07 06:28
add verbose flag
Diffstat
| M | dropin.py | 12 | +++++++++--- |
1 files changed, 9 insertions, 3 deletions
diff --git a/dropin.py b/dropin.py
@@ -20,6 +20,7 @@ from markupsafe import Markup 20 20 BASE_DIR = Path(__file__).parent 21 21 SITE_ID = 36348 22 22 CACHE_DURATION = 3600 -1 23 VERBOSE = False 23 24 FORMATS = [ 24 25 ('m3u8', 'application/vnd.apple.mpegurl', 'adaptive'), 25 26 ('mpd', 'application/dash+xml', 'adaptive'), @@ -140,7 +141,8 @@ class Auth: 140 141 raise ValueError(s) 141 142 142 143 async def auth(self):143 -1 print(f'fetch subscription token for {self.email}')-1 144 if VERBOSE: -1 145 print(f'fetch subscription token for {self.email}') 144 146 async with aiohttp.ClientSession() as session: 145 147 async with session.get('https://watch.dropout.tv/login') as response: 146 148 response.raise_for_status() @@ -157,7 +159,8 @@ class Auth: 157 159 return re.search(r'token: "([^"]+)', html).group(1) 158 160 159 161 async def unauth(self):160 -1 print('fetch non-subscription token')-1 162 if VERBOSE: -1 163 print('fetch non-subscription token') 161 164 async with aiohttp.ClientSession() as session: 162 165 async with session.get('https://watch.dropout.tv/browse') as response: 163 166 html = await response.text() @@ -206,7 +209,8 @@ def async_cache(func): 206 209 207 210 @async_cache 208 211 async def fetch(url, *, need_auth=False, **params):209 -1 print('fetch', url)-1 212 if VERBOSE: -1 213 print('fetch', url) 210 214 211 215 async with aiohttp.ClientSession() as session: 212 216 if need_auth: @@ -417,9 +421,11 @@ if __name__ == '__main__': 417 421 parser.add_argument('--port', type=int, default=8000) 418 422 parser.add_argument('--shutdown', type=int, default=600) 419 423 parser.add_argument('--origin') -1 424 parser.add_argument('-v', '--verbose', action='store_true') 420 425 args = parser.parse_args() 421 426 422 427 env.globals['ORIGIN'] = args.origin -1 428 VERBOSE = args.verbose 423 429 424 430 loop = asyncio.new_event_loop() 425 431