How to obtain historical messages of WeChat public account
I will explain to you how to obtain information on the entry history message page collected from WeChat public account articles. Friends in need may refer to this content.
Collecting WeChat articles is the same as collecting website content. You need to start from a list page. The list page of WeChat articles is the view history message page in the official account. Many other WeChat collectors on the Internet now use Sogou to search. Although the collection method is much simpler, the content is incomplete. Therefore, we still have to collect it from the most standard and comprehensive public account history message page.
Due to the limitations of WeChat, the link we can copy is incomplete and cannot be opened in the browser to see the content. Therefore, we need to use anyproxy to obtain the link address of a complete WeChat public account historical message page through the method introduced in the previous article.
http://mp.weixin.qq.com/mp/getmasssendmsg?__biz=MjM5NDAwMTA2MA==&uin=NzM4MTk1ODgx&key=bf9387c4d02682e186a298a18276d8e0555e3ab51d81ca46de339e6082eb767343 bef610edd80c9e1bfda66c2b62751511f7cc091a33a029709e94f0d1604e11220fc099a27b2e2d29db75cc0849d4bf&devicetype=android-17&version=26031c34&lang=zh_CN&nettype=WIFI&as cene=3&pass_ticket=Iox5ZdpRhrSxGYEeopVJwTBP7kZj51GYyEL24AT5Zyx+BoEMdPDBtOun1F/9ENSz&wx_header =1
As mentioned in the previous article, the biz parameter is the ID of the official account, and uin is the user's ID. At present, uin is unique among all official accounts. The other two important parameters key and pass_ticket are supplementary parameters on the WeChat client.
So before this address expires, we can get the article list of historical messages by viewing the original text with a browser. If we want to automatically analyze the content, we can also make a program to add this address with the address that has not yet expired. Submit the link address of key and pass_ticket, and then obtain the article list through a php program, for example.
Recently, a friend told me that his collection target is a single public account. I think this makes it unnecessary to use the batch collection method written in the previous article. So let's take a look at how to get the article list in the historical message page. By analyzing the article list, we can get all the content link addresses of this official account, and then collect the content.
If the certificate is configured correctly in the anyproxy web interface, the https content can be displayed. The address of the web interface is http://localhost:8002, where localhost can be replaced with your own IP address or domain name. Find the record starting with getmasssendmsg from the list. After clicking it, the details of this record will be displayed on the right side:
The red box part is the complete link address. WeChat public After the domain name of the platform is spliced in front, it can be opened in the browser.
Then pull the page down to the end of the html content. We can see a json variable that is a list of historical news articles:
We copy the variable value of msgList and analyze it with the json formatting tool. We can see that the json has the following structure:
{ "list": [ { "app_msg_ext_info": { "author": "", "content": "", "content_url": "http://mp.weixin.qq.com/s?__biz=MzA5MzEzNDg3MQ==&mid=2652767427&idx=1&sn=37da0d7208283bf90e9a4a536e0af0ea&chksm=8b882dbbbcffa4ad2f0b8a141cc988d16bace564274018e68e5c53ee6f354f8ad56c9b98bade&scene=4#wechat_redirect", "copyright_stat": 100, "cover": "http://mmbiz.qpic.cn/mmbiz/MofBAcBsJ6X0xGrQ2XK5yQjzwb2eswxkRNBTgLtcqGziaFqwibzvtZAHCDkMeJU1fGZHpjoeibanPJ8rziaq68Akkg/0?wx_fmt=jpeg", "digest": "擦亮双眼,远离谣言。", "fileid": 505283695, "is_multi": 1, "multi_app_msg_item_list": [ { "author": "", "content": "", "content_url": "http://mp.weixin.qq.com/s?__biz=MzA5MzEzNDg3MQ==&mid=2652767427&idx=2&sn=449ef1a874a37fed2429e14f724b56ef&chksm=8b882dbbbcffa4ade48a7932cda4263687e34fca8ea3a5a6233d2589d448b9f6130d3890ce93&scene=4#wechat_redirect", "copyright_stat": 100, "cover": "http://mmbiz.qpic.cn/mmbiz_png/MofBAcBsJ6XyaIn0qEDSSicBUBZbMYHYrhibia89ZnksCsUiaia2TLI1fyqjclibGa1hw3icP6oXeSpaWMjiabaghHl7yw/0?wx_fmt=png", "digest": "12月28日,广州亚运城综合体育馆,内附购票入口~", "fileid": 0, "source_url": "http://wechat.show.wepiao.com/detail/ff764b0731b7465db03b56b998e1f2b8?detailReferrer=1&from=groupmessage&isappinstalled=0", "title": "2017微信公开课Pro版即将召开" }, ...//循环被省略 ], "source_url": "", "subtype": 9, "title": "谣言热榜 | 十一月朋友圈十大谣言" }, "comm_msg_info": { "content": "", "datetime": 1480933315, "fakeid": "3093134871", "id": 1000000010, "status": 2, "type": 49 //类型为49的时候是图文消息 } }, ...//循环被省略 ] }
Briefly analyze this json (only some important information is introduced here, others are omitted):
"list": [ //最外层的键名;只出现一次,所有内容都被它包含。 {//这个大阔号之内是一条多图文或单图文消息,通俗的说就是一天的群发都在这里 "app_msg_ext_info":{//图文消息的扩展信息 "content_url": "图文消息的链接地址", "cover": "封面图片", "digest": "摘要", "is_multi": "是否多图文,值为1和0", "multi_app_msg_item_list": [//这里面包含的是从第二条开始的图文消息,如果is_multi=0,这里将为空 { "content_url": "图文消息的链接地址", "cover": "封面图片", "digest": ""摘要"", "source_url": "阅读原文的地址", "title": "子内容标题" }, ...//循环被省略 ], "source_url": "阅读原文的地址", "title": "头条标题" }, "comm_msg_info":{//图文消息的基本信息 "datetime": '发布时间,值为unix时间戳', "type": 49 //类型为49的时候是图文消息 } }, ...//循环被省略 ]
One more thing to mention here is that if you want To obtain the content of historical messages that are older, you need to pull the page down on your mobile phone or simulator. When you pull it to the bottom, WeChat will automatically read the content of the next page. The link address of the next page and the link address of the historical message page are also addresses starting with getmasssendmsg. But the content is only json, not html. Just parse json directly.
At this time, you can use the method introduced in the previous article to use anyproxy to match the msgList variable value regularly, submit it to the server asynchronously, and then use php's json_decode from the server to parse the json into an array. Then loop through the array. We can get the title and link address of each article.
If you only need to collect the content of a single public account, you can obtain the complete link address with key and pass_ticket through anyproxy after sending in bulk every day. Then make a program yourself and manually submit the address to your program. Use a language such as php to regularly match msgList and then parse json. In this way, there is no need to modify the rules of anyproxy, and there is no need to create a collection queue and jump page.
Related recommendations:
php WeChat public account randomly distributes cash red envelope function
PHP cURL to obtain WeChat public account access_token step analysis
Detailed explanation of the steps for vue to implement WeChat public account on the mobile terminal
The above is the detailed content of How to obtain historical messages of WeChat public account. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Tomato Novel is a very popular novel reading software. We often have new novels and comics to read in Tomato Novel. Every novel and comic is very interesting. Many friends also want to write novels. Earn pocket money and edit the content of the novel you want to write into text. So how do we write the novel in it? My friends don’t know, so let’s go to this site together. Let’s take some time to look at an introduction to how to write a novel. Share the Tomato novel tutorial on how to write a novel. 1. First open the Tomato free novel app on your mobile phone and click on Personal Center - Writer Center. 2. Jump to the Tomato Writer Assistant page - click on Create a new book at the end of the novel.

Unfortunately, people often delete certain contacts accidentally for some reasons. WeChat is a widely used social software. To help users solve this problem, this article will introduce how to retrieve deleted contacts in a simple way. 1. Understand the WeChat contact deletion mechanism. This provides us with the possibility to retrieve deleted contacts. The contact deletion mechanism in WeChat removes them from the address book, but does not delete them completely. 2. Use WeChat’s built-in “Contact Book Recovery” function. WeChat provides “Contact Book Recovery” to save time and energy. Users can quickly retrieve previously deleted contacts through this function. 3. Enter the WeChat settings page and click the lower right corner, open the WeChat application "Me" and click the settings icon in the upper right corner to enter the settings page.

Colorful motherboards enjoy high popularity and market share in the Chinese domestic market, but some users of Colorful motherboards still don’t know how to enter the bios for settings? In response to this situation, the editor has specially brought you two methods to enter the colorful motherboard bios. Come and try it! Method 1: Use the U disk startup shortcut key to directly enter the U disk installation system. The shortcut key for the Colorful motherboard to start the U disk with one click is ESC or F11. First, use Black Shark Installation Master to create a Black Shark U disk boot disk, and then turn on the computer. When you see the startup screen, continuously press the ESC or F11 key on the keyboard to enter a window for sequential selection of startup items. Move the cursor to the place where "USB" is displayed, and then

Mobile games have become an integral part of people's lives with the development of technology. It has attracted the attention of many players with its cute dragon egg image and interesting hatching process, and one of the games that has attracted much attention is the mobile version of Dragon Egg. To help players better cultivate and grow their own dragons in the game, this article will introduce to you how to hatch dragon eggs in the mobile version. 1. Choose the appropriate type of dragon egg. Players need to carefully choose the type of dragon egg that they like and suit themselves, based on the different types of dragon egg attributes and abilities provided in the game. 2. Upgrade the level of the incubation machine. Players need to improve the level of the incubation machine by completing tasks and collecting props. The level of the incubation machine determines the hatching speed and hatching success rate. 3. Collect the resources required for hatching. Players need to be in the game

Setting font size has become an important personalization requirement as mobile phones become an important tool in people's daily lives. In order to meet the needs of different users, this article will introduce how to improve the mobile phone use experience and adjust the font size of the mobile phone through simple operations. Why do you need to adjust the font size of your mobile phone - Adjusting the font size can make the text clearer and easier to read - Suitable for the reading needs of users of different ages - Convenient for users with poor vision to use the font size setting function of the mobile phone system - How to enter the system settings interface - In Find and enter the "Display" option in the settings interface - find the "Font Size" option and adjust it. Adjust the font size with a third-party application - download and install an application that supports font size adjustment - open the application and enter the relevant settings interface - according to the individual

Google Authenticator is a tool used to protect the security of user accounts, and its key is important information used to generate dynamic verification codes. If you forget the key of Google Authenticator and can only verify it through the security code, then the editor of this website will bring you a detailed introduction on where to get the Google security code. I hope it can help you. If you want to know more Users please continue reading below! First open the phone settings and enter the settings page. Scroll down the page and find Google. Go to the Google page and click on Google Account. Enter the account page and click View under the verification code. Enter your password or use your fingerprint to verify your identity. Obtain a Google security code and use the security code to verify your Google identity.

In today's society, mobile phones have become an indispensable part of our lives. As an important tool for our daily communication, work, and life, WeChat is often used. However, it may be necessary to separate two WeChat accounts when handling different transactions, which requires the mobile phone to support logging in to two WeChat accounts at the same time. As a well-known domestic brand, Huawei mobile phones are used by many people. So what is the method to open two WeChat accounts on Huawei mobile phones? Let’s reveal the secret of this method. First of all, you need to use two WeChat accounts at the same time on your Huawei mobile phone. The easiest way is to

The difference between Go language methods and functions lies in their association with structures: methods are associated with structures and are used to operate structure data or methods; functions are independent of types and are used to perform general operations.
