您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Automatically refreshes Miniflux feeds
当前为
- // ==UserScript==
- // @name Miniflux automatically refresh feeds
- // @namespace https://reader.miniflux.app/
- // @version 9
- // @description Automatically refreshes Miniflux feeds
- // @author Tehhund
- // @match *://*.miniflux.app/*
- // @icon https://www.google.com/s2/favicons?sz=64&domain=miniflux.app
- // @run-at document-start
- // ==/UserScript==
- const apiKey = ''; // Put your API key from Miniflux here.
- const rateLimit = 43200000; // Only refresh twice per day. 43200000 miliseconds = 12 hours. If a feed has an error (e.g., too many requests) its checked_at datetime still gets updated so we won't hit the feeds with too many requests.
- const refreshFeeds = async () => {
- let req = await fetch('https://reader.miniflux.app/v1/feeds', { headers: { 'X-Auth-Token': apiKey } });
- let res = JSON.parse(await req.text());
- let feedsArray = res.map(currentFeed => currentFeed);
- for (let feed of feedsArray) {
- let lastChecked = new Date(feed.checked_at).getTime();
- if (Date.now() - lastChecked > rateLimit) {
- console.log('it\'s been more than 24 hours, refresh.');
- let res = await fetch(`https://reader.miniflux.app/v1/feeds/${feed.id}/refresh`, {
- method: "PUT",
- headers: { 'X-Auth-Token': apiKey }
- });
- console.log(res);
- } else console.log('it\'s been less than 24 hours, do nothing.')
- }
- }
- // run once when the page is loaded.
- try { refreshFeeds(); } catch (e) { }// If the script runs after DOMContentLoaded this will add the links. If it runs before DOMContentLoaded, this will error and the listener below will run it instead.
- window.addEventListener("DOMContentLoaded", refreshFeeds);