Z
Z
zlodiak2020-01-31 23:31:14
Python
zlodiak, 2020-01-31 23:31:14

Why did the page stop parsing?

Vkontakte has a page for searching people by last name:
https://vk.com/people/Иванов

I wrote a script that once received a page with several people found at this address (that is, I worked it out without problems). But for some time now this script has stopped working. The reason is that html is now returned, which contains the phrase in the markup:

<div id="no_results" class="no_rows">Ваш запрос не дал результатов<br> Возможно, Вы искали   <a hr


Perhaps this is how VKontakte protects itself from a large number of requests from one IP. Please tell me how to get around this. I tried using different headers and proxies:

import requests

headers = {
    'User-agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0)'
}

response = requests.get('https://vk.com/people/Козлов', headers=headers, proxies={"http":"http://10.10.1.10:3128"})
    
if response.status_code == 200:
    print('ok', response.text)
else:
    print('fail')

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Sokolov, 2020-02-01
@sergiks

And what is not searched through the API? users.search()

D
Dr. Bacon, 2020-02-01
@bacon

1. the request is for https, but the proxy is for http
2. the proxy is "local", its external ip can be the same as yours
, and certainly not on VKontakte to learn how to bypass blocking

P
Page-Audit.ru, 2020-02-01
@PageAuditRU

My script worked and returned a result with a list of last names.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question