import requests
from lxml import etree
"""
nodename 选择这个节点名的所有子节点
/ 从当前节点选择直接子节点
// 从当前节点选取子孙节点
. 选择当前节点
… 选取当前节点的父节点
@ 选取属性
"""
response = requests.get('https://www.ivsky.com/tupian/renwutupian/')
print(response.text)
root = etree.HTML(response.content)
img_src = root.xpath("//ul[@class='ali']/li/div/a/img/@src")
for img in img_src:
img = 'https:'+img
print(img)