python-爬虫-requests

import requests,time
from lxml import html
def test4():
    url4=[]
    url = ['https://www.keyomii.com/']
    for i in url:
        res = requests.get(i)
        tree = html.fromstring(res.text)
        name = tree.xpath("//ul[@class='three-col']")
        for hh in name:
            img4 = hh.xpath("//p[@class='title']/a/@href")
            auth4 = hh.xpath("//p[@class='title']/a/text()")
            name4 = hh.xpath("//span[@class='pay-price sl-subhead-title']/text()")
            for k in range(len(name4)):
                url4.append(i)
    c = list(zip(url4,img4,name4,auth4))
    print(c)
test4()

详见此链接:https://www.cnblogs.com/person1-0-1/p/11311163.html

posted @ 2020-07-01 14:31  不放弃自己  阅读(102)  评论(0编辑  收藏  举报