Answer the question
In order to leave comments, you need to log in
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
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question