某黑马magnet搜索接口
Published on 2024-02-12 09:58 in 分类: python 爬虫 with 萧海~
分类: python 爬虫

某黑马magnet搜索接口

    import requests
    cookies = {
    'JSESSIONID': 'ACC5D9245FC54596A57C4486CF2C0EA9',
    'HstCfa4602665': '1707702051444',
    'HstCla4602665': '1707702051444',
    'HstCmu4602665': '1707702051444',
    'HstPn4602665': '1',
    'HstPt4602665': '1',
    'HstCnv4602665': '1',
    'HstCns4602665': '1',
    'aywcUid': 'waMYJwndUl_20240212094110',
    'tet': '1707705671658',
    'tetm': 'E8F5E',
    'tcv': 'V4',
    }
    headers = {
    'authority': 'heimaai.top',
    'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
    'accept-language': 'zh-CN,zh;q=0.9',
    'cache-control': 'no-cache',
    # Requests sorts cookies= alphabetically
    # 'cookie': 'JSESSIONID=ACC5D9245FC54596A57C4486CF2C0EA9; HstCfa4602665=1707702051444; HstCla4602665=1707702051444; HstCmu4602665=1707702051444; HstPn4602665=1; HstPt4602665=1; HstCnv4602665=1; HstCns4602665=1; aywcUid=waMYJwndUl_20240212094110; tet=1707705671658; tetm=E8F5E; tcv=V4',
    'pragma': 'no-cache',
    'referer': 'https://heimaai.top/recaptcha/v4/challenge?url=https://heimaai.top&s=1',
    'sec-ch-ua': '"Not A(Brand";v="99", "Google Chrome";v="121", "Chromium";v="121"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"Windows"',
    'sec-fetch-dest': 'document',
    'sec-fetch-mode': 'navigate',
    'sec-fetch-site': 'same-origin',
    'upgrade-insecure-requests': '1',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36',
    }
    params = {
    'keyword': '美女',
    }
    response = requests.get('https://heimaai.top/search', params=params, cookies=cookies, headers=headers)
    # print(response.text)
    html=etree.HTML(response.text)
    href=html.xpath('//li/a[@class="result-resource-title common-link"]/@href')
    # print(href)
    soup = BeautifulSoup(response.text, "html.parser")
    title=[]
    # 获取所有 li 标签下 p 标签下 a 标签的文本
    for li_tag in soup.find_all("li"):
    for a in li_tag.find_all('a',{'class':'result-resource-title common-link'}):
    # print(a.text)
    title.append(a.text)
    for item in list(zip(title,href)):
    if item[1].startswith("https"):
    print(item[0],item[1])
    else:
    print(item[0],'https://heimaai.top'+item[1])
    posted @   萧海~  阅读(1427)  评论(0编辑  收藏  举报
    相关博文:
    阅读排行:
    · winform 绘制太阳,地球,月球 运作规律
    · AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
    · 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
    · 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
    · 上周热点回顾(3.3-3.9)
    点击右上角即可分享
    微信分享提示
    电磁波切换