// ==UserScript== // @name Daily News Fetcher - Moyu Ribao, Weiyu Jianbao & TopURL // @namespace https://bbs.tampermonkey.net.cn/ // @description 获取每日新闻并显示所有新闻和图片(结合摸鱼日报、新闻简报和TopURL API) // @version 1.1.0 // @author shuaima // @crontab * once * * * // @grant GM_xmlhttpRequest // @grant GM_notification // @grant GM_openInTab // @grant GM_log // @connect dayu.qqsuu.cn // @connect news.topurl.cn // ==/UserScript== return new Promise((resolve, reject) => { // Fetching Moyu Ribao API GM_xmlhttpRequest({ method: "GET", url: "https://dayu.qqsuu.cn/moyuribao/apis.php?type=json", // Moyu Ribao JSON data onload: xhr => { try { let moyuData = JSON.parse(xhr.responseText); GM_log(moyuData); // Debug log for Moyu Ribao data // Fetching Weiyu Jianbao API GM_xmlhttpRequest({ method: "GET", url: "https://dayu.qqsuu.cn/weiyujianbao/apis.php?type=json", // Weiyu Jianbao JSON data onload: xhr => { try { let weiyuData = JSON.parse(xhr.responseText); GM_log(weiyuData); // Debug log for Weiyu Jianbao data // Fetching TopURL API GM_xmlhttpRequest({ method: "GET", url: "http://news.topurl.cn/api", // TopURL JSON data onload: xhr => { try { let topurlData = JSON.parse(xhr.responseText); GM_log(topurlData); // Debug log for TopURL data // Create content from Moyu Ribao let moyuImageUrl = moyuData.data; let moyuContent = ''; if (moyuImageUrl) { moyuContent = `
没有获取到新闻内容,请稍后再试。
`; } // Show a notification and display all content when clicked GM_notification({ title: "每日新闻播报", text: "点击查看全部新闻和图片", onclick: function () { // Combine the content into a single HTML page let newsPageContent = `