吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1130|回复: 3
上一主题 下一主题
收起左侧

[经验求助] 求帮忙写pyhton源码:爬取抖店商品链接发货地

[复制链接]
跳转到指定楼层
楼主
境界彼方tau 发表于 2024-1-6 18:58 回帖奖励
50吾爱币
需求:
我有几百个抖店商品的链接,现在需要批量爬取这些链接的发货地址;帮忙用python写个源码,谢谢!

目标网址1:
https://haohuo.jinritemai.com/ecommerce/trade/detail/index.html?id=3637205268498149252预计18小时内从广西壮族自治区发货,包邮
目标网址2:
https://haohuo.jinritemai.com/ecommerce/trade/detail/index.html?id=3649120070661209894
广东省48小时内从广东省发货,包邮
目标网址3:未知则显示未知,不显示空
https://haohuo.jinritemai.com/ecommerce/trade/detail/index.html?id=3649120070661209894
48小时内发货,包邮

顺便问一下:
为什么我按下边的写法python报错:{"code":11001,"data":null,"msg":"当前网络不稳定,请稍后再试","st":11001}
目前只有这么多币了,提前感谢

import requests
def send_post_request():
    # 设置请求头
    headers = {
        'Host': 'haohuo.jinritemai.com',
        'Connection': 'keep-alive',
        'Content-Length': '569',
        'sec-ch-ua': '"Not.A/Brand";v="8", "Chromium";v="114"',
        'Accept': 'application/json, text/plain, */*',
        'Content-Type': 'application/x-www-form-urlencoded',
        'sec-ch-ua-mobile': '?0',
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.5735.289 Safari/537.36',
        'sec-ch-ua-platform': '"Windows"',
        'Origin': 'https://haohuo.jinritemai.com',
        'Sec-Fetch-Site': 'same-origin',
        'Sec-Fetch-Mode': 'cors',
        'Sec-Fetch-Dest': 'empty',
        'Referer': 'https://haohuo.jinritemai.com/ecommerce/trade/detail/index.html?id=3637205268498149252',
        'Accept-Encoding': 'gzip, deflate, br',
        'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8',
        'Cookie': 'Cookie'  # Cookie信息隐藏
    }
    # 设置请求体参数
    data = {
        'ui_params': '{"from_live":false,"from_video":null,"three_d_log_data":null,"follow_status":null,"which_account":null,"ad_log_extra":null,"from_group_id":null,"bolt_param":null,"transition_tracker_data":null,"selected_ids":null,"window_reposition":null,"is_short_screen":null,"full_mode":true}',  # 完整的ui_params参数
        'use_new_price': '1',
        'is_h5': '1',
        'bff_type': '2',
        'is_in_app': '0',
        'origin_type': '',
        'promotion_ids': '3637205268498149252',
        'meta_param': '',
        'source_page': '',
        'request_additions': '',
        'isFromVideo': 'false',
        'enable_timing': 'true'
    }
    url = 'https://haohuo.jinritemai.com/aweme/v2/shop/promotion/pack/h5/?is_h5=1&is_native_h5=1&verifyFp=verify_lpseyl2g_zYR8tlCG_ao5k_47gZ_ALH0_L7E53qfxkYSb&msToken=fu0YIT3vGjWhVrxcaLUv_PSR2Kp7kCjrk_K5pcagI3RjwYxxh59wPXXFJF_Xu01qjEyi2V5-g8IjOeszznyh9-UokGf-nH60sEYD_NPTrH3HeW3L6wG_2hP3nTr5nW0%3D&a_bogus=YJ-EDchgMsR1KEhcKwkz9n9gcbj0YW-DgZEzhY%2F4OzwA'
    # 发送POST请求
    response = requests.post(url, headers=headers, data=data)
    # 打印响应内容
    print(response.text)

if __name__ == "__main__":
    send_post_request()

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

沙发
 楼主| 境界彼方tau 发表于 2024-1-10 00:43 |楼主
没人回应我完结了
3#
Zercher 发表于 2024-1-10 09:52
4#
Linen666 发表于 2024-8-10 23:58
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2025-5-28 09:40

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表