modify link qs
This commit is contained in:
parent
e25e03c4e3
commit
cf506a815d
@ -1,5 +1,6 @@
|
|||||||
const request = require('request')
|
const request = require('request')
|
||||||
const cheerio = require('cheerio')
|
const cheerio = require('cheerio')
|
||||||
|
const qs = require('querystring')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef lastPost
|
* @typedef lastPost
|
||||||
@ -96,7 +97,18 @@ const getLastPost = async (pageid = '') => {
|
|||||||
return b.time - a.time
|
return b.time - a.time
|
||||||
})
|
})
|
||||||
let post = posts[0]
|
let post = posts[0]
|
||||||
post.link = `https://www.facebook.com/${post.link.replace(/^\//, '')}`
|
|
||||||
|
let larr = post.link.split('?')
|
||||||
|
let linkqs = qs.parse(larr[1])
|
||||||
|
let newqs = {}
|
||||||
|
for (let i in linkqs) {
|
||||||
|
if (/id/i.test(i)) {
|
||||||
|
newqs[i] = linkqs[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post.link = larr[0] + '?' + qs.stringify(newqs)
|
||||||
|
|
||||||
|
post.link = `https://www.facebook.com/${post.link.replace(/^\//, '')}`.replace(/\?$/, '')
|
||||||
return post
|
return post
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user