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

Unknown API auth error #62

Closed
iknoorjobs opened this issue Apr 30, 2024 · 3 comments
Closed

Unknown API auth error #62

iknoorjobs opened this issue Apr 30, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@iknoorjobs
Copy link

iknoorjobs commented Apr 30, 2024

🐛 Describe the bug

Hi,
When I run the following code with my credentials, it gives an error "AuthError: Unknown API auth error", could you please tell me what might be causing the issue?

from vk_url_scraper import VkScraper
vks = VkScraper("username", "password")
# scrape any "video" URL
res = vks.scrape("https://vk.com/video-6596301_145810025")

Error:

---------------------------------------------------------------------------
AuthError                                 Traceback (most recent call last)
<ipython-input-87-3f4ee1c1cb0d> in <module>
      1 from vk_url_scraper import VkScraper
      2 
----> 3 vks = VkScraper("+44□□□□□□□□□□", "Qa□□□□□□□□")
      4 
      5 # scrape any "video" URL

~/miniconda3/lib/python3.8/site-packages/vk_url_scraper/scraper.py in __init__(self, username, password, token, session_file, captcha_handler)
     74         )
     75         if token is None or len(token) == 0:
---> 76             self.session.auth(token_only=True)
     77 
     78     def scrape(self, url: str) -> List:

~/miniconda3/lib/python3.8/site-packages/vk_api/vk_api.py in auth(self, reauth, token_only)
    183 
    184         if token_only:
--> 185             self._auth_token(reauth=reauth)
    186         else:
    187             self._auth_cookies(reauth=reauth)

~/miniconda3/lib/python3.8/site-packages/vk_api/vk_api.py in _auth_token(self, reauth)
    235         elif self.password:
    236             self._vk_login()
--> 237             self._api_login()
    238 
    239     def _vk_login(self, captcha_sid=None, captcha_key=None):

~/miniconda3/lib/python3.8/site-packages/vk_api/vk_api.py in _api_login(self)
    514 
    515         else:
--> 516             raise AuthError('Unknown API auth error')
    517 
    518     def server_auth(self):

AuthError: Unknown API auth error

Versions

Python 3.8.5
vk==3.0
vk-api==11.9.9
vk-url-scraper==0.3.27

@iknoorjobs iknoorjobs added the bug Something isn't working label Apr 30, 2024
@GalenReich
Copy link

Hi Iknoor, thanks for opening this issue. This bug appears to be related to an upstream issue that we are tracking at the moment, namely: python273/vk_api#496

@msramalho has a live issue on the vk_api repo python273/vk_api#500 to try and get code to fix this merged to the upstream repository, and he may be able to help further.

@msramalho
Copy link
Collaborator

Yeah, it's a bummer. You can still get this tool to run if you install it locally and then install vk_api directly from their GitHub.

Another option is in this answer: python273/vk_api#496 (comment) which requires you finding the client_secret that you can probably intercept from a web browser after logging in and digging around the Network panel for request parameters or cookies.

@msramalho
Copy link
Collaborator

I've pushed a new release and more details on the readme on the problem with the vk-api dependency, but you should now be able to login successfully if you uninstall/re-install the hardcoded version of vk-api, after installing vk-url-scraper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants