Facebook帖文详情
// ==UserScript==
// @name Facebook帖文详情
// @namespace http://tampermonkey.net/
// @version 2024-02-29
// @description try to take over the world!
// @author You
// @match https://mbasic.facebook.com/story.php?story_fbid=*
// @icon https://www.google.com/s2/favicons?sz=64&domain=facebook.com
// @require http://cdn.bootcss.com/jquery/1.11.2/jquery.js
// @require https://scriptcat.org/lib/513/2.0.0/ElementGetter.js
// @grant GM_xmlhttpRequest
// ==/UserScript==
function EmitParentClose(){
// let parentif = iframe.contentWindow;
let parentif = window.top;
parentif.postMessage('close_window','*')
}
(function() {
'use strict';
var monkey_url = 'http://127.0.0.1:8883/ajaxHook';
elmGetter.selector($);
elmGetter.each('div#m_story_permalink_view', company_name => {
// console.log(company_name);
console.log('page is fully loaded');
// elmGetter.each('ul#list-container li .list-info a.shop-name', company_name => {
// var shop_url = company_name[0].innerText;
var dataList = [];
var content = company_name.find('div.bb div.bn div p').text()
var timeline = company_name.find('footer abbr').text()
var emoji = company_name.find('div.dk.dl div.dq').attr('aria-label')
var msg_username = company_name.find('div.ei a.ej.bg').text()
var msg_text = company_name.find('div.ei div.ek').text() + company_name.find('div.ei div.el img').attr('src')
var msg_time = company_name.find('div.ei abbr').text()
if (content) {
// content = 'https:' + content
dataList.push({
'帖文内容':content,
'帖文时间':timeline,
'帖文表情':emoji,
'留言用户':msg_username,
'留言内容':msg_text,
'留言时间':msg_time
})
}
if (dataList.length > 0){
console.log(dataList);
GM_xmlhttpRequest({
method: "POST",
url: monkey_url,
data : JSON.stringify(dataList),
onload: function(response) {
//这里写处理函数
console.log(response);
console.log(dataList);
//window.close();
}
});
}
// 发送关闭信号
EmitParentClose();
});
// Your code here...
})();