K
K
kopelev20002019-12-02 19:08:52
Python
kopelev2000, 2019-12-02 19:08:52

I want to parse phone numbers from OLX.ua, but nothing comes out, it says “suspicious activity detected”, what can I do?

I want to parse phone numbers from OLX.ua, but it doesn’t work, it says “suspicious activity detected”, I use a proxy, I tried a huge list of proxies I have, the page loads, as soon as I start following links, this window appears:
5de5367fd10fc280276907.png
What can I do, to solve this problem?
The code

from selenium import webdriver
import time
import random

urls = open("input.txt", "r")
for url in urls:

    myProxy = random.choice(open('proxy.txt').readlines())
    print(myProxy + "\n")

    def get_url(driver): 
        driver.get(url)
        print("GOT URL")
        time.sleep(3)


    def press_cookie_btn(driver):
        cookie_btn = driver.find_element_by_xpath("//div[@class='topinfo rel']"
                                                  "/button[@class='cookie-close abs cookiesBarClose']")
        cookie_btn.click()
        print("COOKIE")
        time.sleep(2)


    def page_pagination(driver):
        ars = driver.find_elements_by_xpath("//a[@class='marginright5 link linkWithHash detailsLink']")
        urls_1 = []
        for ar in ars:
            url_1 = ar.get_attribute("href")
            urls_1.append(url_1)
            print(url_1)
        for url_2 in urls_1:
            driver.get(url_2)
            time.sleep(3)
            driver.get(url)
            time.sleep(3)



    def main():
        chrome_options = webdriver.ChromeOptions()
        chrome_options.add_argument('--proxy-server=%s' % myProxy)
        driver = webdriver.Chrome(options=chrome_options)
        driver.implicitly_wait(10)
        get_url(driver)
        press_cookie_btn(driver)
        page_pagination(driver)
        driver.quit()


    main()

urls.close()

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Armenian Radio, 2019-12-02
@gbg

Stop violating ToS, for example.

W
WebReklamist, 2019-12-05
@WebReklamist

kopelev2000 , try to randomize pauses on pages and in general everything that is possible.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question