facebook page notify v1.0

This commit is contained in:
Jay
2018-06-27 23:38:56 +08:00
parent 99e5a455cb
commit e2eeef9d82
4 changed files with 190 additions and 154 deletions
+2 -2
View File
@@ -16,11 +16,11 @@ const cheerio = require('cheerio')
const getLastPost = async (pageid = '') => {
if (typeof pageid !== 'string' || pageid.trim().length === 0) return null
pageid = pageid.trim()
console.log('access facebook fan page :::: ' + pageid)
let page = await new Promise((resolve) => {
request({
baseUrl: 'https://facebook.com',
url: `/${pageid}/posts`,
url: `/${encodeURIComponent(pageid)}/posts`,
method: 'get',
headers: {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0'