Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed an issue with csrf token not being extracted correctly #164

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

anasomar1
Copy link

Fixed issue with csrf token and new error "Could not login: 'NoneType' object has no attribute 'get'"

Fixed Could not login: 'NoneType' object has no attribute 'get'
@Jeffade1
Copy link

@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.

@anasomar1
Copy link
Author

@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

@Jeffade1
Copy link

@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👍

@anasomar1
Copy link
Author

@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.

@kdurov
Copy link

kdurov commented Dec 30, 2023

Thank you @anasomar1 for the PRs and your fork!
It helps a lot.

@Milor123
Copy link

Milor123 commented Jan 4, 2024

@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

road-master added a commit to road-master/dockerfile-pyinstalive that referenced this pull request Jan 27, 2024
FYI:
- Fixed an issue with csrf token not being extracted correctly by anasomar1 · Pull Request #164 · dvingerh/PyInstaLive
  dvingerh/PyInstaLive#164
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants