Answer the question
In order to leave comments, you need to log in
What to do with the problem when parsing the site?
import requests
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from random import choice
def main():
url = '--url--'
useragents = open('useragents.txt').read().split('\n')
proxies = open('proxies').read().split('\n')
proxy = {'http' : 'http://' + proxies[0]}
useragent = {'User-Agent' : choice(useragents)}
opts = Options()
opts.add_argument("user-agent=" + str(useragents[0]))
opts.add_argument('--proxy-server=http://' + proxies[0])
driver = webdriver.Chrome(executable_path=r'--path to chromedriver--',chrome_options=opts)
driver.get(url)
print(driver.find_element_by_class_name('ip').text())
if __name__ == '__main__':
main()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question