修改browsers位置,删除无用引入
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,25 +0,0 @@
|
||||
import socket
|
||||
import random
|
||||
from DrissionPage import Chromium, ChromiumOptions
|
||||
|
||||
def getBrowsers(chrome_zoom = 1.0, save_path: str = "") -> Chromium:
|
||||
while True:
|
||||
port = random.randint(9000, 65535)
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
||||
if s.connect_ex(('127.0.0.1', port)) != 10061:
|
||||
continue
|
||||
break
|
||||
|
||||
if save_path:
|
||||
options = ChromiumOptions().set_local_port(port).set_user_data_path(save_path)
|
||||
else:
|
||||
options = ChromiumOptions().auto_port()
|
||||
options = options.set_argument('--force-device-scale-factor', str(chrome_zoom))
|
||||
# options = options.set_user_agent('Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)')
|
||||
while True:
|
||||
try:
|
||||
browser = Chromium(options)
|
||||
break
|
||||
except:
|
||||
pass
|
||||
return browser
|
||||
@@ -1,5 +1,5 @@
|
||||
import os
|
||||
from core import browsers
|
||||
from utils import browsers
|
||||
|
||||
class Spiders:
|
||||
def __init__(self, project_name: str, bitch: int = 5, worker_num: int = 1, switch_clash: bool = False, reflush_browser: bool = False):
|
||||
|
||||
Reference in New Issue
Block a user