diff --git a/Modules/utils.py b/Modules/utils.py index 7083a88..c33703f 100644 --- a/Modules/utils.py +++ b/Modules/utils.py @@ -98,7 +98,7 @@ async def get_channels(self): with open(r"data\channels.json", "w") as f: json.dump(response, f, ensure_ascii=False, indent=4) - def sendOTP(mobile): + def sendOTP(self, mobile): body = { "identifier": mobile, "otpIdentifier": mobile, @@ -127,7 +127,7 @@ def login(self, email, password, mode="unpw"): """ body = { "identifier": email, - "password": password, + "password" if mode == "unpw" else "otp": password, "rememberUser": "T", "upgradeAuth": "Y", "returnSessionDetails": "T", diff --git a/README.md b/README.md index c0247e5..a9e9f9e 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,14 @@ JioTV proxy developed using Python and FastAPI framework. - For Sony Liv channels I have added direct stream links instead of JIO-TV stream. [Found It From Here.](https://github.com/dhruv-2015/JIOTVServer/blob/main/utils/genPlaylist.mjs) +- (2024-05-31) Added OTP login. + # How to use (From Binary) - Download the latest for your platform from [Releases](https://github.com/henry-richard7/JioTV-Proxy/releases) - Run JioTV file. -- Login to your Jio Account at http://localhost:8000/login. +- Login to your Jio Account using Email at http://localhost:8000/?mode=unpw. +- Login to your Jio Account using OTP at http://localhost:8000/?mode=otp. - To play live channels on web http://localhost:8000. - To play live channels in media player such as vlc http://localhost:8000/playlist.m3u - To play live channels on your local network http://:8000/playlist.m3u (You can get this from console when running the app.) @@ -23,6 +26,7 @@ JioTV proxy developed using Python and FastAPI framework. - Follow the above steps. # Known Issues + - CN HD+ Tamil: It is noted that Cartoon Network HD+ Tamil channel does not work under API v2.0 but working in v2.1. Using v2.1 breaks other channels. Need to find a way to use v2.1 endpoint if currently playing channel is CN HD+ Tamil. - Sony channels are not playing in Web Browser. This is due to **CORS**. To workaround Need to install [Cors Bypass Extension](https://chromewebstore.google.com/detail/cors-unblock/lfhmikememgdcahcdlaciloancbhjino?pli=1) diff --git a/main.py b/main.py index 7d482eb..cb8ed9f 100644 --- a/main.py +++ b/main.py @@ -147,7 +147,10 @@ def welcome_msg(): print("===================================================") print("Welcome to JioTV-Proxy") print(f"Web Player: http://{localip}:8000/") - print(f"Please Login at http://{localip}:8000/login") + print( + f"Please Login Using Email and Password at http://{localip}:8000/login?mode=unpw" + ) + print(f"Please Login Using OTP at http://{localip}:8000/login?mode=otp") print(f"Playlist m3u: http://{localip}:8000/playlist.m3u") print("===================================================") print() @@ -193,7 +196,7 @@ async def middleware(request: Request, call_next): Returns: - Response: The HTTP response object to be sent back to the client. """ - if request.url.path in ["/login", "/playlist.m3u", "/createToken"]: + if request.url.path in ["/login", "/playlist.m3u", "/createToken", "/get_otp"]: response = await call_next(request) return response @@ -213,7 +216,7 @@ async def middleware(request: Request, call_next): elif token_check == "Expired": email, password, login_mode = get_creds() - if login_mode == "": + if login_mode == "unpw": jiotv_obj.login(email, password) update_expire_time(email=email, password=password) jiotv_obj.update_headers() @@ -236,6 +239,11 @@ async def middleware(request: Request, call_next): return response +@app.get("/get_otp") +def get_otp(phone_no): + return jiotv_obj.sendOTP(phone_no) + + @app.get("/createToken") def createToken(email, password, mode): """ @@ -266,7 +274,7 @@ def createToken(email, password, mode): @app.get("/login") -async def loginJio(request: Request): +async def loginJio(request: Request, mode: str): """ Get the login page. @@ -276,7 +284,10 @@ async def loginJio(request: Request): Returns: TemplateResponse: The response containing the login page HTML template. """ - return templates.TemplateResponse("login.html", {"request": request}) + if mode == "unpw": + return templates.TemplateResponse("login.html", {"request": request}) + elif mode == "otp": + return templates.TemplateResponse("otp_login.html", {"request": request}) @app.get("/playlist.m3u") diff --git a/templates/index.html b/templates/index.html index 7607407..56a301a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -39,7 +39,10 @@ > + diff --git a/templates/otp_login.html b/templates/otp_login.html new file mode 100644 index 0000000..ef5de14 --- /dev/null +++ b/templates/otp_login.html @@ -0,0 +1,187 @@ + + + + + + + JIO TV Login + + + + + + + + + + + +
+ +
+ + +
+
+ +
+ + +
+ + + + +
+
+ + + + + + + + \ No newline at end of file