diff --git a/requirements.txt b/requirements.txt index c118984bf..19e7c5038 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,3 +18,4 @@ beautifulsoup4 pyoxipng rich Jinja2 +pyotp \ No newline at end of file diff --git a/src/trackers/MTV.py b/src/trackers/MTV.py index 255f4890f..d4de506d1 100644 --- a/src/trackers/MTV.py +++ b/src/trackers/MTV.py @@ -12,7 +12,6 @@ from pathlib import Path from src.trackers.COMMON import COMMON - class MTV(): """ Edit for Tracker: @@ -504,9 +503,16 @@ async def login(self, cookiefile): # handle 2fa if resp.url.endswith('twofactor/login'): + otp_uri = self.config['TRACKERS'][self.tracker].get('otp_uri') + if otp_uri: + import pyotp + mfa_code = pyotp.parse_uri(otp_uri).now() + else: + mfa_code = console.input('[yellow]MTV 2FA Code: ') + two_factor_payload = { 'token' : resp.text.rsplit('name="token" value="', 1)[1][:48], - 'code' : console.input('[yellow]MTV 2FA Code: '), + 'code' : mfa_code, 'submit' : 'login' } resp = session.post(url="https://www.morethantv.me/twofactor/login", data=two_factor_payload)