先凑活着,毕竟还破解不了登录的公众号
优采云 发布时间: 2021-03-20 09:01先凑活着,毕竟还破解不了登录的公众号
标签:URL微信伪造品以爬取公共令牌textprintid
哈哈,我终于找到了文章,可以一键获取所有正式帐户。尽管它很愚蠢,但让我们活着。毕竟,我无法破解登录。
参考链接:
第一步:先注册一个官方帐户
注册后登录首页,找到该物料管理系统
然后您将看到以下页面
点击此红色箭头指向的链接
记住要打开调试工具
然后搜索您要抓取的官方帐户
此请求将返回我们搜索的官方帐户。如果是第一个帐户,我们想要的官方帐户也会在此列表中
我们需要此帐号ID来标记此官方帐户
下一步选择,然后单击
然后文章列表出现
整个过程需要令牌,官方帐户名和cookie
最后,代码直接上传
# -*- coding: utf-8 -*-
import pymysql as pymysql
from fake_useragent import UserAgent
import requests
import json
from retrying import retry
@retry(stop_max_attempt_number=5)
def get_author_list():
"""
获取搜索到的公众号列表
:return:
"""
global s
url = "https://mp.weixin.qq.com/cgi-bin/searchbiz?action=search_biz&begin=0&count=5&query={}&token={}&lang=zh_CN&f=json&ajax=1".format(
name, token)
try:
response = s.get(url, headers=headers, cookies=cookie)
text = json.loads(response.text)
# print('一共查询出来{}个公众号'.format(text['total']))
return text
except Exception as e:
print(e)
reset_parmas()
@retry(stop_max_attempt_number=5)
def get_first_author_params(text):
"""
获取单个公众号的参数
:param text: 前面搜索获取的公众号列表
:return:fake_id公众号id, text请求公众号详情的相应内容
"""
fake_id = text['list'][0] # 一般第一个就是咱们需要的,所以取第一个
# print(text['list'][0])
url = 'https://mp.weixin.qq.com/cgi-bin/appmsg?action=list_ex&begin=0&count=5&fakeid={}&type=9&query=&token={}&lang=zh_CN&f=json&ajax=1'.format(fake_id['fakeid'], token)
response = s.get(url, headers=headers, cookies=cookie)
try:
text1 = json.loads(response.text)
return text1, fake_id
except Exception as e:
print(e)
reset_parmas()
@retry(stop_max_attempt_number=5)
def get_title_url(text, fake_id):
"""
得到公众号的标题和链接
:param text:
:param fake_id:
:return:
"""
print(text)
num = int(text['app_msg_cnt'])
if num % 5 > 0:
num = num // 5 + 1
for i in range(num):
# token begin:参数传入
url = 'https://mp.weixin.qq.com/cgi-bin/appmsg?action=list_ex&begin={}&count=5&fakeid={}&type=9&query=&token={}&lang=zh_CN&f=json&ajax=1'.format(str(i * 5),fake_id['fakeid'], token,)
try:
response = s.get(url, headers=headers, cookies=cookie)
text = json.loads(response.text)
print(text)
artile_list = text['app_msg_list']
for artile in artile_list:
print('标题:{}'.format(artile['title']))
print('标题链接:{}'.format(artile['link']))
save_mysql(name, artile['title'], artile['link'])
except Exception as e:
print(e)
reset_parmas()
def save_mysql(name, title, url):
"""
保存数据到数据库
:param name: 作者名字
:param title:文章标题
:param url: 文章链接
:return:
"""
try:
sql = """INSERT INTO title_url(author_name, title, url) values ('{}', '{}', '{}')""".format(name, title, url)
conn.ping(reconnect=False)
cur.execute(sql)
conn.commit()
except Exception as e:
print(e)
def reset_parmas():
"""
失效后重新输入参数
:return:
"""
global name, token, s, cookie, headers
name = input("请输入你要查看的公众号名字: ")
token = input("请输入你当前登录自己公众号的token: ")
cookies = input("请输入当前页面的cookie: ")
s = requests.session()
cookie = {'cookie': cookies}
headers = {
"User-Agent": UserAgent().random,
"Host": "mp.weixin.qq.com",
}
def run():
reset_parmas()
text = get_author_list()
text1, fake_id = get_first_author_params(text)
get_title_url(text1, fake_id)
run()
我需要解释,数据库本身甚至都没有编码我。
而且,该接口似乎经常更新,因此您只需要了解我的代码的逻辑即可。
好
标签:url,微信,假冒,抓取,公开,令牌,文本,打印,id