• 02-09-2021, 00:09:04
    #1
    Herkese merhaba bu aralar bir proje yazdım fakat geckodriver'ı ne kadar proxy çektirmeye çalışsam da hep bir hata yapıyorum.

    Bu konuda yardımcı olabilecek var mı ?


    Proxy.txt' dosyasından proxy seçeçek işlemini yapacak sıradaki proxy'e geçeçek mantığı... ( https )
  • 02-09-2021, 00:17:08
    #2
    Merhaba dostum, eskiden selenium üzerinde yaptığım bir projede şu kodları buldum kendine göre ayarlayıp deneyebilirsin;
    PROXY_Host = "91.121.44.145"
    PROXY_PORT = str(randint(30000,59999))
    fp = webdriver.FirefoxProfile('C:\\Users\\***\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\enmc1bv8.default-release')
    print PROXY_PORT
    print PROXY_Host
    fp.set_preference('extensions.lastAppBuildId', "<apppID> -1")
    fp.set_preference("network.proxy.type", 1)
    fp.set_preference("network.proxy.http",PROXY_Host)
    fp.set_preference("network.proxy.http_port",int(PROXY_PORT))
    fp.set_preference("network.proxy.https",PROXY_Host)
    fp.set_preference("network.proxy.https_port",int(PROXY_PORT))
    fp.set_preference("network.proxy.ssl",PROXY_Host)
    fp.set_preference("network.proxy.ssl_port",int(PROXY_PORT))  
    fp.set_preference("network.proxy.ftp",PROXY_Host)
    fp.set_preference("network.proxy.ftp_port",int(PROXY_PORT))  
    fp.set_preference("network.proxy.socks",PROXY_Host)
    fp.set_preference("network.proxy.socks_port",int(PROXY_PORT))  
    fp.update_preferences()
    driver = webdriver.Firefox(firefox_profile=fp)
  • 02-09-2021, 00:19:35
    #3
    Jaxen adlı üyeden alıntı: mesajı görüntüle
    Merhaba dostum, eskiden selenium üzerinde yaptığım bir projede şu kodları buldum kendine göre ayarlayıp deneyebilirsin;
    PROXY_Host = "91.121.44.145"
    PROXY_PORT = str(randint(30000,59999))
    fp = webdriver.FirefoxProfile('C:\\Users\\***\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\enmc1bv8.default-release')
    print PROXY_PORT
    print PROXY_Host
    fp.set_preference('extensions.lastAppBuildId', "<apppID> -1")
    fp.set_preference("network.proxy.type", 1)
    fp.set_preference("network.proxy.http",PROXY_Host)
    fp.set_preference("network.proxy.http_port",int(PROXY_PORT))
    fp.set_preference("network.proxy.https",PROXY_Host)
    fp.set_preference("network.proxy.https_port",int(PROXY_PORT))
    fp.set_preference("network.proxy.ssl",PROXY_Host)
    fp.set_preference("network.proxy.ssl_port",int(PROXY_PORT))  
    fp.set_preference("network.proxy.ftp",PROXY_Host)
    fp.set_preference("network.proxy.ftp_port",int(PROXY_PORT))  
    fp.set_preference("network.proxy.socks",PROXY_Host)
    fp.set_preference("network.proxy.socks_port",int(PROXY_PORT))  
    fp.update_preferences()
    driver = webdriver.Firefox(firefox_profile=fp)
    ilgin için çok teşekkür ederim dostum , kod üzerinden değil de txt üzerinden çekmesini istiyorum ben ama üzerinde biraz oynama yapayım belki kendime göre uyarlayabilirim.
  • 02-09-2021, 00:25:27
    #4
    dosyadan çekip döngüye alıp koda uyarlamalısın dostum
  • 02-09-2021, 00:34:22
    #5
    En iyisi sanırım
    proxies = []
    with open('proxies.txt', 'r', encoding='UTF-8') as f:
       for line in f.readlines():
          proxies.append(line.strip())
    bu şekilde proxyleri listeye alın daha sonra programınıza for döngüsüyle dahil edin. boşluklarda hata olabilir
  • 02-09-2021, 00:39:18
    #6
    Cestomina adlı üyeden alıntı: mesajı görüntüle
    ilgin için çok teşekkür ederim dostum , kod üzerinden değil de txt üzerinden çekmesini istiyorum ben ama üzerinde biraz oynama yapayım belki kendime göre uyarlayabilirim.
    Aynı dizindeki proxy.txt den çekip ip ve port olarak alabilirsin bu şekilde
    f = open("proxy.txt", "r")
    for x in f:
      x = x.strip()
      pos = x.index(":")
      ip = x[0:pos]
      port = x[pos+1:len(x)]