PyInstaLive
PyInstaLive copied to clipboard
Fixed an issue with csrf token not being extracted correctly
Fixed issue with csrf token and new error "Could not login: 'NoneType' object has no attribute 'get'"
@anasomar1 Just replaced the helpers.py with your fix and it works great, thanks alot Anas.
Since you seem to understand pyinstalive code, could you take a look for another fix which does not work on version 4.0.2 but was alright on version 3.2.4: Download only starts if the following is the host of the live, if the following is a guest it doesn't. There is probably a little tweak to do in the download.py for the get_following_livestreams/broadcast_owner/cobroadcasters/guest_username part taking inspiration from dlfuncs.py of version 3.2.4.
@Jeffade1 You're welcome!
By taking a look at the code in that file there seems to be a misunderstanding in how it should be implemented. In the code we check if there is a guest in the stream and if there is one, we download using "pyinstalive -d "guestname"". However, we always need to download the stream using the broadcast owner's name, even if the person we follow is a guest, the stream we'll download will be the stream of the person hosting our guest and not the stream of the guest, so we just need the owner's name.
So the code in get_following_livestreams would go from
try:
livestream_list = api.get_reels_tray()
usernames_available_livestreams = []
if livestream_list.get("broadcasts", None):
for livestream in livestream_list.get("broadcasts", None):
owner_username = livestream.get("broadcast_owner", None).get("username", None)
try:
guest_username = livestream.get("cobroadcasters", None)[0].get("username", None)
except:
guest_username = None
if guest_username:
usernames_available_livestreams.append(guest_username)
else:
usernames_available_livestreams.append(owner_username)
to
try:
livestream_list = api.get_reels_tray()
usernames_available_livestreams = []
if livestream_list.get("broadcasts", None):
for livestream in livestream_list.get("broadcasts", None):
owner_username = livestream.get("broadcast_owner", None).get("username", None)
usernames_available_livestreams.append(owner_username)
I'll need to test the code above before actually making a PR and it might take a while as the people I follow barely go live
@anasomar1 Deleting the 7 lines and aligning the last 2 makes it work. I tested it on some broadcasts. Well that's another problem fixed👍
@Jeffade1 thanks for testing it. I'll create a PR for that then and also push all the changes to my fork of the repo.
Thank you @anasomar1 for the PRs and your fork! It helps a lot.
@anasomar1 Thank you veryy muchhhh, it now allows log in!!! Love you! Try use it.
Edit1: I can confirm that now all is working again, i can record the lives!!! Thank u very much @anasomar1