From bf1c20316877de6da50485bd662f686c0f5995c3 Mon Sep 17 00:00:00 2001 From: sorencto Date: Wed, 26 Jun 2024 10:44:43 +0530 Subject: [PATCH] Fixed jiocinema bug of not getting the url because of not appropriate authtoken Changes to be committed: modified: README.md renamed: jiocinema.go -> src/jiocinema/jiocinema.go renamed: jiosaavn.go -> src/jiosaavn/jiosaavn.go --- README.md | 9 +++-- jiocinema.go => src/jiocinema/jiocinema.go | 47 +++++++++++++++++++++- jiosaavn.go => src/jiosaavn/jiosaavn.go | 0 3 files changed, 51 insertions(+), 5 deletions(-) rename jiocinema.go => src/jiocinema/jiocinema.go (56%) rename jiosaavn.go => src/jiosaavn/jiosaavn.go (100%) diff --git a/README.md b/README.md index edb9b35..855ef41 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,14 @@ this is a repository to bypass jio restrictions and stream # jiosaavn Get the song url of jiosaavn using `lite.duckduckgo.com` after your 100% jio data quota exhausted and use jiosaavn.go build it using go and use it as ```./jiosaavn --url ``` or you can also use ```go build jiosaavn.go --url ``` and the url the script will generate will be used to stream music even after data quota exhausted. -if it not works in your computer -add ```2600:140f:1c00::1740:8cd3 aac.saavncdn.com``` in ```/etc/hosts``` +It will work on mobile +If it not works in your computer +add ```2405:200:1609:1731::312c:8a8b aac.saavncdn.com``` in ```/etc/hosts``` # jiocinema Get the id of movie or any show -![image](https://github.com/lsnnt/jio-tricks/assets/85880458/555ac951-a3eb-4f12-b1ee-a3373f36beaf) -like for this url id is "3776321" +![image_showing_which_is_id](https://i.imgur.com/aJB0cab.png) +like for this url id is "3979150" After getting id you can build `jiocinema.go` and run ```./jiocinema --id ``` or you can run ```go run jiocinema.go --id ``` the link the script will generate should be used with vlc media player to stream movies & all free videos avaliable in jiocinema For paid videos streaming you can contact me at nnt@nnnt.shop i will respond how to do diff --git a/jiocinema.go b/src/jiocinema/jiocinema.go similarity index 56% rename from jiocinema.go rename to src/jiocinema/jiocinema.go index 426cee1..42ac4b6 100644 --- a/jiocinema.go +++ b/src/jiocinema/jiocinema.go @@ -7,8 +7,52 @@ import ( "net/http" "strings" "flag" + "encoding/json" ) +type UserData struct { + AuthToken string `json:"authToken"` + // Add other fields if needed +} +func getguestauthtoken() string{ + client := &http.Client{} + var data = strings.NewReader(`{"appName":"RJIL_JioCinema","deviceType":"pc","os":"web","deviceId":"aabf1b9a-3ae8-43a0-b0f0-b3062ea4bea4","freshLaunch":true,"adId":"aabf1b9a-3ae8-43a0-b0f0-b3062ea4bea4","appVersion":"24.06.25.1-d22894a9"}`) + req, err := http.NewRequest("POST", "https://auth-jiocinema.voot.com/tokenservice/apis/v4/guest", data) + if err != nil { + log.Fatal(err) + } + req.Header.Set("accept", "application/json, text/plain, */*") + req.Header.Set("accept-language", "en-GB,en;q=0.8") + req.Header.Set("content-type", "application/json") + req.Header.Set("origin", "https://www.jiocinema.com") + req.Header.Set("priority", "u=1, i") + req.Header.Set("referer", "https://www.jiocinema.com/") + req.Header.Set("sec-ch-ua", `"Not/A)Brand";v="8", "Chromium";v="126", "Brave";v="126"`) + req.Header.Set("sec-ch-ua-mobile", "?0") + req.Header.Set("sec-ch-ua-platform", `"Linux"`) + req.Header.Set("sec-fetch-dest", "empty") + req.Header.Set("sec-fetch-mode", "cors") + req.Header.Set("sec-fetch-site", "cross-site") + req.Header.Set("sec-gpc", "1") + req.Header.Set("user-agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36") + resp, err := client.Do(req) + if err != nil { + log.Fatal(err) + } + defer resp.Body.Close() + bodyText, err := io.ReadAll(resp.Body) + if err != nil { + log.Fatal(err) + } + fmt.Printf("%s\n", bodyText) + var dataa UserData + if err := json.Unmarshal([]byte(bodyText), &dataa); err != nil { + log.Fatal(err) + } + // Access and print the authToken field + // fmt.Println("AuthToken:", dataa.AuthToken) + return dataa.AuthToken +} func main() { client := &http.Client{} var id string @@ -27,7 +71,7 @@ func main() { } req.Header.Set("accept", "application/json, text/plain, */*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QtNDZmNy1hMDIyLWM5MzkyZjBkNDc0OSIsImFkc0NvbmZpZyI6eyJpbnN0cmVhbUFkcyI6eyJsaXZlIjp7ImVuYWJsZWQiOnRydWV9LCJ2b2QiOnsiZW5hYmxlZCI6dHJ1ZX19fSwiZXhwZXJpbWVudEtleSI6eyJjb25maWdLZXkiOiI2ZjI5NTg0OS0xZjRhLTRmNWMtOTE5My0xZmQ4MTdmZGFkNTYiLCJncm91cElkIjozODE3fSwicHJvZmlsZURldGFpbHMiOnsicHJvZmlsZVR5cGUiOiJjaGlsZCIsImNvbnRlbnRBZ2VSYXRpbmciOiJVL0EgNysifSwidmVyc2lvbiI6MjAyNDAzMDQwfSwiZXhwIjoxNzE3MzEwNzc0LCJpYXQiOjE3MTczMDM1NzR9.SDxPBDPTLLno9JkrrfbeWeMuHO8nn2k9OSpv5bISVKg10Oy3vS3FIKgIqNPHxe5vMM3ZdqMu8jHQ291Ca9IGLw") + req.Header.Set("accesstoken", getguestauthtoken()) // populate authtoken here req.Header.Set("appname", "RJIL_JioCinema") req.Header.Set("cache-control", "no-cache") req.Header.Set("content-type", "application/json") @@ -61,4 +105,5 @@ func main() { dashurl := strings.Split(string(bodyText), `,{"macros":[],"url":"`)[1] dashurl = strings.Split(dashurl, `","`)[0] fmt.Println(dashurl) + fmt.Println("\n\n use the above url in vlc media player and enjoy watching after FUP data limit ehausted") } diff --git a/jiosaavn.go b/src/jiosaavn/jiosaavn.go similarity index 100% rename from jiosaavn.go rename to src/jiosaavn/jiosaavn.go