Skip to content

Commit

Permalink
MTV: Add support for otp url (#242)
Browse files Browse the repository at this point in the history
* added support for otp url

* Move pyotp import

---------

Co-authored-by: Zentis <>
Co-authored-by: L4GSP1KE <[email protected]>
  • Loading branch information
zentis and L4GSP1KE authored Sep 8, 2023
1 parent d09e543 commit 4d9c522
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ beautifulsoup4
pyoxipng
rich
Jinja2
pyotp
10 changes: 8 additions & 2 deletions src/trackers/MTV.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from pathlib import Path
from src.trackers.COMMON import COMMON


class MTV():
"""
Edit for Tracker:
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 4d9c522

Please sign in to comment.