#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import requests
import re
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import pymongo
import time
from pymongo.collection import ReturnDocument
b=webdriver.Chrome()
wait=WebDriverWait(b,10)
KEY_WORD="建筑"
URL="https://www.XXXXXXXXX.com"
MONGO_URL='localhost'
MONGO_DB='albbs'
MONGO_TABLE='supplier'
client=pymongo.MongoClient(MONGO_URL)
db=client[MONGO_DB]
def search():
try:
b.get(URL)
ul=b.find_element_by_css_selector("#masthead > div.ali-search.fd-right > div.searchtypeContainer > ul")
ul.click()
b.find_element(By.XPATH,"//*[@id=&
python3.x爬虫实战:阿里巴巴网站定向信息抓取
最新推荐文章于 2024-05-08 16:26:39 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)