recloudstream / cloudstream

Android app for streaming and downloading media.
GNU General Public License v3.0
6.73k stars 538 forks source link

Streamplay is broken #1212

Open SomeoneLikeYou462 opened 3 months ago

SomeoneLikeYou462 commented 3 months ago

Steps to reproduce

  1. I tried to play this streamplay video, https://stre4mplay.one/1twe4yogrbpl

Expected behavior

Should play the video

Actual behavior

An error appears instead of playing the video: ErrorLoadingException: can't bypass captcha

Cloudstream version and commit hash

0c418fdf

Android version

Pixel 6 Pro API 31 Android 12

Logcat

2024-07-24 18:34:51.143  7919-7957  System.err              com...cloudstream3.prerelease.debug  W  com.lagradost.cloudstream3.ErrorLoadingException: can't bypass captcha
2024-07-24 18:34:51.145  7919-7957  System.err              com...cloudstream3.prerelease.debug  W      at com.lagradost.cloudstream3.extractors.Streamplay.getUrl$suspendImpl(Streamplay.kt:37)
2024-07-24 18:34:51.145  7919-7957  System.err              com...cloudstream3.prerelease.debug  W      at com.lagradost.cloudstream3.extractors.Streamplay$getUrl$1.invokeSuspend(Unknown Source:18)
2024-07-24 18:34:51.145  7919-7957  System.err              com...cloudstream3.prerelease.debug  W      at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
2024-07-24 18:34:51.145  7919-7957  System.err              com...cloudstream3.prerelease.debug  W      at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
2024-07-24 18:34:51.145  7919-7957  System.err              com...cloudstream3.prerelease.debug  W      at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:585)
2024-07-24 18:34:51.145  7919-7957  System.err              com...cloudstream3.prerelease.debug  W      at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:802)
2024-07-24 18:34:51.146  7919-7957  System.err              com...cloudstream3.prerelease.debug  W      at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:706)
2024-07-24 18:34:51.146  7919-7957  System.err              com...cloudstream3.prerelease.debug  W      at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:693)

Other details

No response

Acknowledgements

int3debug commented 3 months ago

This is not a bug If a site needs captcha then you can not play

SomeoneLikeYou462 commented 3 months ago

I thought it would be possible cause there are implemented functions to try to resolve it https://github.com/recloudstream/cloudstream/blob/2fc279f4aea56ff2422b2b114165465bb08d9035/library/src/commonMain/kotlin/com/lagradost/cloudstream3/MainAPI.kt#L124

Luna712 commented 3 months ago

1) the captcha token request will give a malformed response because the sitekey ends in an underscore and a URL doesn't like that (and the URL it builds uses that last). Changing the URL in getCaptchaToken to a trailing slash (IE https://www.google.com/recaptcha/api.js?render=$key/) would fix this issue. 2) streamplay does not use invisible captcha so getCaptchaToken wont work since it uses size=invisible rather than size=normal (which streamplay expects) resulting in "This site key is not enabled for the invisible captcha." 3) streamplay is broken, embed links no longer work on the stre4mplay.one link and streamplay.to just redirects to it. So the extractor isn't going to work, as it uses:

val key = redirectUrl.substringAfter("embed-").substringBefore(".html")
app.post(
            "$mainServer/player-$key-488x286.html", data = mapOf(
                "op" to "embed",
                "token" to token
            )

Both embed- and player- no longer works in streamplay (even though it is still referenced in the html of the site). Also if you do not use the embed- version of the URL the $key becomes the full URL leading to the wrong URL anyway and it is not meant to work for the URL you used.

This is at least as far as I can tell. I could also be wrong in parts of this.

My point in all this is though is this seems to be a streamplay issue mess caused by them changing their URL but not for everything making things very broken at the moment.

SomeoneLikeYou462 commented 2 months ago

I tried to fix it on my own but I found another bug, as @Luna712 said with the last slash works the url perfectly and you get the vToken and also the recapToken, but when you have to make the last post using all the obtained data the last url returns null (expected the google recaptcha token)

https://github.com/recloudstream/cloudstream/blob/2fc279f4aea56ff2422b2b114165465bb08d9035/library/src/commonMain/kotlin/com/lagradost/cloudstream3/MainAPI.kt#L145