justchokingaround / lobster

mmm lobster
GNU General Public License v2.0
559 stars 37 forks source link

[bug]: fails to get video links #193

Closed 1bn3mar closed 5 months ago

1bn3mar commented 8 months ago

*IDKy but the script just refused to work for me I'm using macOS and mpv as my media player i didn't do anything special.

For me what happened was i just followed the installation process then tried to watch a show Steps to reproduce the behavior:

  1. $ lobster
  2. specify which show exactly season & episode etc.
  3. then it just outputs this: gsed: -e expression #1, char 0: no previous regular expression No subtitles found

P.S. this happens for anything i try to watch. lobster.log

1bn3mar commented 8 months ago

This is the output gsed: -e expression #1, char 0: no previous regular expression No subtitles found

masoniis commented 8 months ago

For what it's worth, I am new to the script as well and I run into the same issue on NixOS and MacOS. For NixOS I am using the flake, and here is what it looks like running the command:

> lobster
Search Movie/TV Show: rick and morty
sed: -e expression #1, char 0: no previous regular expression
No subtitles found
justchokingaround commented 8 months ago
curl -s "https://keys4.fun" | tr -d '\n ' | sed -nE "s@.*\"rabbitstream\":\{\"keys\":\{\"v\":\"([^\"]*)\",\"h\":\"([^\"]*)\",\"b\":([0-9]*),\"agent\":\"([^\"]*)\",\"key\":\"([^\"]*)\".*@\1\t\2\t\3\t\4\t\5@p" | read -r v h b agent key

https://rabbitstream.net/ajax/v2/embed-4/getSources?id={}&v={}&h={}&b={}

rabbitstream changed their encryption above is the fix in question, which i'll do soon :tm:

LuisOrg26 commented 8 months ago

rabbitstream changed their encryption above is the fix in question, which I'll do soon ™️

Hi does this works with windows too? I'm new in this and the command doesn't worked for me

$ https://rabbitstream.net/ajax/v2/embed-4/getSources?id={}&v={}&h={}&b={}
[1] 750
bash: https://rabbitstream.net/ajax/v2/embed-4/getSources?id={}: No such file or directory
[2] 751
[3] 752
[1]   Exit 127                https://rabbitstream.net/ajax/v2/embed-4/getSources?id={}
[2]   Done                    v={}
[3]+  Done                    h={}

This is the output i got

justchokingaround commented 8 months ago

that was just some pseudo code, ure supposed to replace {} with the actual values

justchokingaround commented 8 months ago

yes, that is normal. also the encryption has changed again since my previous comment, so i need to wait for keys4.fun to update their stuff or look for another fix

pitsi commented 8 months ago

Honest and semi-offtopic question... because I do not remember how the keys variable/output looked like before the change.

Assuming that you want key "b" from the output. Wouldn't it be easier to add jq as a dependency for the script and get it like so

$ curl -s https://keys4.fun/ | jq .rabbitstream.keys.b
1878522368
justchokingaround commented 8 months ago

i prefer avoiding additional unneeded deps

pitsi commented 8 months ago

During the weekend, I tried patching the script using jq to get the key parameters and add them to the fake url above. It failed with the same error as before.

And today I saw how a kodi addon was patched so as to work again with the new decryption method. Oh my....

1bn3mar commented 8 months ago

Hi, sorry but what r the values that i should replace {} with??

justchokingaround commented 8 months ago

corresponding values u can find on https://keys4.fun , tho its broken rn

1bn3mar commented 8 months ago

So, ur saying there's noway to use lobster rn?

pitsi commented 8 months ago

@1bn3mar I made 3 new variables, as you can see below, which get keys v, h and b like so (replace the letters as needed) keyb=$(curl -s https://keys4.fun | jq .rabbitstream.keys.b) and I changed the json_data variable to this json_data=$(curl -s "${provider_link}/ajax/embed-${embed_type}/getSources?id=${source_id}&v=${keyv}&h=${keyh}&b=${keyb}" -H "X-Requested-With: XMLHttpRequest") but it fails with the same error, so it needs something else to be changed too.

@justchokingaround Do we need all those keys? A while ago, the script was grabbing 2 16-character long strings only as keys. If you do undestand python, I can show you what the kodi addon dev added to make it work again.

justchokingaround commented 8 months ago

u also need to pass -A $agent as the user agent, without it it wont work. sure show me the python commit @pitsi

pitsi commented 8 months ago

I see... I will try it again when I have some time.

As for the kodi addon, there is no commit for it, because the "change" is always a zip file that gets uploaded. But if you want, I can download both (old and new) and create a .patch file from them. If not, I can just mention the addon and the dev and you get them from his repo.

justchokingaround commented 8 months ago

the patch would be enough thx

pitsi commented 8 months ago

https://paste.debian.net/hidden/39332f7a/

Paste will be available for 7 days.

justchokingaround commented 8 months ago

thx i'll check it today

justchokingaround commented 8 months ago

@pitsi can u actually mention the repo pls?

pitsi commented 8 months ago

https://github.com/mbebe/blomqvist/tree/master/zips/plugin.video.fmoviesto

Version 1.30 is the new one that works.

pitsi commented 8 months ago

I just tried it with agent parameter, e.g. curl -s longurl?${source_id}&v={keyv}&h={keyh}&b={keyb}" -A "${agent}" -H "X-Requested-With: XMLHttpRequest" but the error remains.

The key parameter is probably needed, because somewhere the entire html code from vidcloud is parsed, but my brain cells are too few to figure out where. Here is a log in case it helps.

https://paste.debian.net/hidden/6dd4c3ba/

1bn3mar commented 8 months ago

@pitsi Yeah, to me this is a real brain teaser I'm no programmer by any means; I just don't know how to get the keys.

pitsi commented 8 months ago

What do you want me to explain? Tbh, it has been so many days since the real issue and new keys were found, but there is still no fix for it, so maybe rabbitstream is doing a great work protecting its links. I hope this won't mean the end of lobster :(

justchokingaround commented 8 months ago

it's not the end. i'm just a bit busy at work atm, so i don't have time to reverse engineer everything and can only port an existing solution or use keys that would be updated regularly by someone. i looked at the python code and the problem is all of the decryption is done in it, it doesnt rely on any key provider. porting that to shell would take me more time than i have atm

pitsi commented 8 months ago

But there is a key (provider?) in that python code, at the variable named klucze.

1bn3mar commented 7 months ago

In conclusion lobster does not work rn unless the user tinkers with it; if yes I'll just close the issue if not can someone please give me a oneliner to run or a preconfigured file to replace mine cuz if not I'll keep the question's coming.

PS: i don't get notified that's why i take too long.

justchokingaround commented 7 months ago

it's broken on my side not the user's. i should be able to come up with a fix soon tm

pitsi commented 7 months ago

What do you mean "tinkers with it"? What can be changed?

1bn3mar commented 7 months ago

@pitsi I mean the whole conversation between you and @justchokingaround i did not get one bit of it.

1bn3mar commented 7 months ago

Anyway's thank you all.

pitsi commented 7 months ago

I can explain stuff that you may not understand, but some basic knowledge is required first. For instance, I can not explain WHY things have to be decrypted for the script to work. It's just how it is.

Ask me :)

1bn3mar commented 7 months ago

@1bn3mar I made 3 new variables, as you can see below, which get keys v, h and b like so (replace the letters as needed) keyb=$(curl -s https://keys4.fun | jq .rabbitstream.keys.b) and I changed the json_data variable to this json_data=$(curl -s "${provider_link}/ajax/embed-${embed_type}/getSources?id=${source_id}&v=${keyv}&h=${keyh}&b=${keyb}" -H "X-Requested-With: XMLHttpRequest") but it fails with the same error, so it needs something else to be changed too.

@justchokingaround Do we need all those keys? A while ago, the script was grabbing 2 16-character long strings only as keys. If you do undestand python, I can show you what the kodi addon dev added to make it work again.

@pitsi So you said that using jq would solve the issue what do i need to replace the variables with?

1bn3mar commented 7 months ago

Like what is provider_link, embed_type, source_id, keyv, keyh, keyb should replace them with something or just leave them as is?

pitsi commented 7 months ago

Let me explain some stuff then...

Before I start, I want to say that my bash skills are not as good as the dev's, which is why I suggested jq. It is a small parsing app that helps people like me who do not understand sed and the like.

The scipt's core function is to get a very specific url and pass it to the player. In order to do so, it has to do some decrypting, because things are not as easy as they were a few months ago. In short, it has to use a url that looks like this https://rabbitstream.net/ajax/v2/embed-4/getSources?id={}&v={}&h={}&b={}

The id part is something that uniquely identifies the movie (or whatever you want to see), e.g for deadpool it's always 19694. The parameters (or keys) v, h, and b are stuff that changes MANY times per day and everytime the script is run, they are parsed fresh from a specific url. This was always the case though, but there were only 2 keys a few weeks ago.

In order for me to test the new way, I had to create 3 new variables for the keys and add them to the url above. That is where I used jq. However, they are not enough, because the script still fails (proof in the log). I also tried adding the user agent, but still no luck. As it seems, the whole thing is still incomplete, and I have no idea what to do next.

Any other questions?

justchokingaround commented 7 months ago

the keys are ip specific now i'm pretty sure, ill look into it soon

1bn3mar commented 7 months ago

No, so far so good now i don't feel brainless thank you.

pitsi commented 7 months ago

the keys are ip specific now i'm pretty sure, ill look into it soon

About that. I opened the page from my phone using mobile data, and ALL keys seem identical to the ones opened from my desktop, which uses a stable internet connection.

pitsi commented 7 months ago

Honest question: is there any chance that the keys provided by keys4fun are wrong?

justchokingaround commented 7 months ago

yes

pitsi commented 7 months ago

The following may be offtopic for lobster's development, but I want to mention it anyway.

One of the things that have annoyed me today is that the forementioned kodi addon broke. Again. Because the keys it uses to decode the urls are not working or wrong. Αgain.

So I though "why not try the keys from the url lobster uses?" and obviously the ones mentioned for fmovies. With my basic knowledge of python I patched its code and made it retrieve the correct ones. But it still failed. Then I had an... Archimedes* moment: what if it needs the keys for mycloud? I patched its code again, making it retrieve the keys for mycloud and poof! It worked first try!

How can lobster be changed so as to use those 2 keys, like it used to be?

*According to a rumor, when Archimedes was about to discover the laws for buoyancy, he was lost in his calculations and a "I may be in a wrong path" thought crossed his mind. So he started over, did his calculations again and this time they worked. The rest is what you learned from the history books :)

justchokingaround commented 7 months ago

lemme explain it the KISS way:

flixhq != fmovies

think of flixhq as an equivalent of hianime (ex aniwatch and ex zoro) think of fmovies as an equivalent of aniwave (ex 9anime)

flixhq uses vidcloud and upcloud which are basically rabbitstream e4 fmovies uses vidplay and mycloud, which use different encryption mechanisms

to adapt lobster to use fmovies instead of flixhq, a lot of code would have to be added, history would need to be changed etc. (u can see here an example of what it's like to implement a new provider, even though i never finished it: https://github.com/justchokingaround/lobster/pull/135/files)

if u're curious about the js functions used for decryption or encryption (e.g futoken), u can check the following link (some functions may be outdated): https://keys4.fun/decrypt.js

pitsi commented 7 months ago

I only knew half of that, thank you for enlightening me! Also, the hosts' names confuse me a lot!

I do not want you (or anyone) to rewrite lobster for fmovies, my suggestion was only for the hosts. But since they differ, its no use discussing anything else.

mesteryui commented 7 months ago

I have similar problems this is my output with lobster: I have my system in spanish but by the things that are saying I think is the same error sed: -e expresión #1, carácter 0: no hay una expresión regular previa

pitsi commented 7 months ago

the keys are ip specific now i'm pretty sure, ill look into it soon

About that, episode 2. My stupid brain thought that the keys offered by the site differ if you visit it from another ip, which is wrong. What differs are the generated keys themselves, because they were generated for that site's ip when the javascript file ran. So, is there any way to run that js file locally and get "personal" keys from it? Without resorting to node if possible.

justchokingaround commented 7 months ago

fix: rabbitstream tmp solution acts as a temporary fix

pitsi commented 7 months ago

It works for me now... on that 7am test I just did :D Thank you :)

pitsi commented 7 months ago

May I ask why the fix is named/marked as "temporary solution"?

justchokingaround commented 7 months ago

bc idk who is hosting json_data=$(curl -s "https://api.fffapifree.cam/get-source?id=${source_id}") and idk when it might go down

pitsi commented 7 months ago

Aaand it's broken again. Although I did not test it the days before, I tried it today and it playes this url (no matter what the user has searched or selected) https://api.fffapifree.cam/video/filename.m3u8 which is a 5 second video of a single frame that says "please purchase etc".

It was good as long as it lasted :(

stillmanpeeer commented 7 months ago

Aaand it's broken again. Although I did not test it the days before, I tried it today and it playes this url (no matter what the user has searched or selected) https://api.fffapifree.cam/video/filename.m3u8 which is a 5 second video of a single frame that says "please purchase etc".

It was good as long as it lasted :(

https://github.com/stillmanpeeer/rabbitstream