第三方微博登录:"error_code" = 21338

博客指出项目出现问题的原因是其Bundle Identifier与新浪开放平台所填写的Bundle ID不一致,这属于信息技术中移动开发相关问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原因:项目的Bundle Identifier 与 新浪开放平台所填写的 Bundle ID不一致。

import requests from bs4 import BeautifulSoup import re import csv import time from fake_useragent import UserAgent # 设置请求头,模拟浏览器 ua = UserAgent() headers = { 'User-Agent': ua.random, 'Referer': 'https://weibo.com/' } # 微博转发页面的URL(示例) weibo_url = "https://weibo.com/1234567890/ABCDEFGHIJ" # 替换为目标微博的URL # 获取微博转发页面的HTML def get_weibo_reposts(url, page=1): params = { 'page': page } response = requests.get(url, headers=headers, params=params) if response.status_code == 200: return response.text else: print(f"请求失败,状态码:{response.status_code}") return None # 解析转发记录 def parse_reposts(html): soup = BeautifulSoup(html, 'html.parser') reposts = [] # 查找转发记录 for item in soup.find_all('div', class_='repost'): try: # 转发用户ID user_id = item.find('a', class_='name')['href'].split('/')[-1] # 转发时间 time_tag = item.find('a', class_='time') repost_time = time_tag.text.strip() if time_tag else "未知时间" # 转发路径 path_tag = item.find('p', class_='path') repost_path = path_tag.text.strip() if path_tag else "未知路径" # 用户类型(普通用户、VIP等) user_type_tag = item.find('em', class_=re.compile('icon')) user_type = user_type_tag['title'] if user_type_tag else "普通用户" # 添加到转发记录列表 reposts.append({ 'user_id': user_id, 'repost_time': repost_time, 'repost_path': repost_path, 'user_type': user_type }) except Exception as e: print(f"解析失败:{e}") continue return reposts # 保存数据到CSV文件 def save_to_csv(data, filename='weibo_reposts.csv'): with open(filename, 'w', newline='', encoding='utf-8') as csvfile: fieldnames = ['user_id', 'repost_time', 'repost_path', 'user_type'] 修改代码不用bs4
最新发布
03-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

豪冷啊

你的鼓励是对我的认可!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值