更新
This commit is contained in:
18
Python-100-Days/Day66-75/code/example11.py
Normal file
18
Python-100-Days/Day66-75/code/example11.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from bs4 import BeautifulSoup
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
|
||||
|
||||
def main():
|
||||
driver = webdriver.Chrome()
|
||||
driver.get('https://v.taobao.com/v/content/live?catetype=704&from=taonvlang')
|
||||
elem = driver.find_element_by_css_selector('input[placeholder=输入关键词搜索]')
|
||||
elem.send_keys('运动')
|
||||
elem.send_keys(Keys.ENTER)
|
||||
soup = BeautifulSoup(driver.page_source, 'lxml')
|
||||
for img_tag in soup.body.select('img[src]'):
|
||||
print(img_tag.attrs['src'])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user