A
A
anya_hacker2021-03-21 23:55:42
Python
anya_hacker, 2021-03-21 23:55:42

Why doesn't the address change with the proxy?

I'm trying to change my ip address using a proxy using selenium in Python.
The address changes (I see confirmation of this when I go to https://2ip.ru/ using the same selenium),
but when I write a request to Yandex under a new IP address, for example: "buy a scooter"
Then there are links in the top 10 results to a site with the heading: "buy an inexpensive scooter in Rostov."
Although the new proxy is the city of Moscow. Why is it that with a new IP (i.e. proxy) that leads to another city (to Moscow), Yandex still gives me sites in the search results that are sent directly to Rostov, where is my ip, so to speak, "by default"? How to fix it? Those. offer links that lead to the city where the proxy is configured (to Moscow)

from seleniumwire import webdriver
from fake_useragent import UserAgent

from time import sleep

login = 'r4EdkrXq'
password = 'rY1Ff395'
proxy_adress_now = '44.84.113.123:52574' # Московский прокси

proxy_options = {
    "proxy": {
        "https": f"http://{login}:{password}@{proxy_adress_now}" # здесь я авторизовалась под новым прокси
    },
    "User-Agent": UserAgent().chrome # также делаю каждый запрос новый фейковый юзер-агент
}

driver = webdriver.Chrome(
    executable_path='chromedriver.exe',
    # скачать chromedriver.exe можно на сайте https://chromedriver.storage.googleapis.com/index.html
    seleniumwire_options=proxy_options
)

try:
    url = "https://2ip.ru/" # если теперь раскоментировать строку 25, можно увидеть, что яндексу всё равно на этот прокси
    # url = f"https://yandex.ru/search/?lr=39&text=купить самокат"
    driver.get(url)
    sleep(25)
except Exception:
    print("Ошибка")

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexa2007, 2021-03-22
@anya_hacker

url = f" https://yandex.ru/search/?lr=39&text=buy a scooter" - Rostov
url = f" https://yandex.ru/search/?lr=22&text=buy a scooter" - Kaliningrad

S
Sergey Karbivnichy, 2021-03-21
@hottabxp

How to change proxy while working with selenium webd...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question