先湊活著(zhù),畢竟還破解不了登錄的公眾號
優(yōu)采云 發(fā)布時(shí)間: 2021-03-20 09:01先湊活著(zhù),畢竟還破解不了登錄的公眾號
標簽:URL微信偽造品以爬取公共令牌textprintid
哈哈,我終于找到了文章,可以一鍵獲取所有正式帳戶(hù)。盡管它很愚蠢,但讓我們活著(zhù)。畢竟,我無(wú)法破解登錄。
參考鏈接:
第一步:先注冊一個(gè)官方帳戶(hù)
注冊后登錄首頁(yè),找到該物料管理系統
然后您將看到以下頁(yè)面
點(diǎn)擊此紅色箭頭指向的鏈接
記住要打開(kāi)調試工具
然后搜索您要抓取的官方帳戶(hù)
此請求將返回我們搜索的官方帳戶(hù)。如果是第一個(gè)帳戶(hù),我們想要的官方帳戶(hù)也會(huì )在此列表中
我們需要此帳號ID來(lái)標記此官方帳戶(hù)
下一步選擇,然后單擊
然后文章列表出現
整個(gè)過(guò)程需要令牌,官方帳戶(hù)名和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('一共查詢(xún)出來(lái){}個(gè)公眾號'.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):
"""
獲取單個(gè)公眾號的參數
:param text: 前面搜索獲取的公眾號列表
:return:fake_id公眾號id, text請求公眾號詳情的相應內容
"""
fake_id = text['list'][0] # 一般第一個(gè)就是咱們需要的,所以取第一個(gè)
# 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("請輸入當前頁(yè)面的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()
我需要解釋?zhuān)瑪祿毂旧砩踔炼紱](méi)有編碼我。
而且,該接口似乎經(jīng)常更新,因此您只需要了解我的代碼的邏輯即可。
好
標簽:url,微信,假冒,抓取,公開(kāi),令牌,文本,打印,id