Skip to content

Commit

Permalink
兼容最新版微信抓取
Browse files Browse the repository at this point in the history
  • Loading branch information
yimun committed Mar 30, 2019
1 parent 3c967c9 commit b4fb57f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions rule/index.js
Expand Up @@ -7,7 +7,8 @@ const {
getComments,
getProfileBasicInfo,
getPostList,
handleProfileHtml
handleProfileHtml,
getNextPostLink,
} = require('./wechatRule');
const basicAuth = require('./basicAuth');
const config = require('../config');
Expand Down Expand Up @@ -80,7 +81,10 @@ const rule = {
if (!config.rule.profile.disable) {
nextLink = yield models.Profile.getNextProfileLink();
}
if (!nextLink) nextLink = '';
if (!nextLink) {
nextLink = yield getNextPostLink();
debug('没有需要抓取的公众号了,自动开始文章抓取');
}
debug('nextLink', nextLink);
return {
response: {
Expand Down
3 changes: 2 additions & 1 deletion rule/wechatRule.js
Expand Up @@ -381,7 +381,7 @@ const handleProfileHtml = async function (ctx) {
const isScrollFn = time => {
let contentText = document.querySelector('.weui-panel').innerText;
contentText = contentText.trim();
const contentArr = contentText.split('\\n');
const contentArr = contentText.split('\\n').filter(function(el) {return el.length != 0});
// 最后一行表示目前抓取的状态
// 正在加载
Expand Down Expand Up @@ -582,4 +582,5 @@ module.exports = {
getProfileBasicInfo,
getPostList,
handleProfileHtml,
getNextPostLink,
};

0 comments on commit b4fb57f

Please sign in to comment.