详情可见:

1

本博客的是根据柳申大佬的开源项目,修复了bug使用

复刻修改项目

  1. 修改仓库根目录的conf.yaml
    1
    2
    3
    4
    5
    6
    7
    spider_settings:
    enable: true
    json_url: "https://你的博客域名/friend.json"
    article_count: 5
    merge_result:
    enable: true
    merge_json_url: "https://你为朋友圈设置的域名"
    你可以先填,文件在下文会实现
  2. 继续修改conf.yaml

    1
    2
    3
    4
    5
    6
    7
    8
    rss_subscribe:
    enable: true
    github_username: willow-god
    github_repo: 朋友圈精简版
    your_blog_url: https://你的博客域名/
    email_template: "./push_templates/default.html"
    website_info:
    title: "你的名字/id"
  3. 点击左上角的main,更换为page
    删除all.json和errors.json里的全部内容,等会抓取链接的时候会自动更新

  4. 创建friend.json文件
    先创建一个朋友圈页面,再在博客根目录创建link.js
    3

  • 创建朋友圈页面
    1
    hexo new page fc #fc你可以更换别的
    并在朋友圈的index.md添加如下代码
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    <div id="friend-circle-lite-root"></div>

    <script>

        if (typeof UserConfig === 'undefined') {

            var UserConfig = {

                // 填写你的fc Lite地址

                private_api_url: 'https://你为朋友圈准备的域名/',

                // 点击加载更多时,一次最多加载几篇文章,默认20

                page_turning_number: 20,

                // 头像加载失败时,默认头像地址

                error_img: 'https://i.p-i.vip/30/20240815-66bced9226a36.webp',

            }

        }

    </script>

    <link rel="stylesheet" href="https://fastly.jsdelivr.net/gh/willow-god/Friend-Circle-Lite/main/fclite.min.css">

    <script src="https://fastly.jsdelivr.net/gh/willow-god/Friend-Circle-Lite/main/fclite.min.js"></script>
  • 创建link.js
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    const YML = require('yamljs')
    const fs = require('fs')

    const blacklist = ["友站名称1", "友站名称2", "友站名称3"]; // 由于某种原因,不想订阅的列表

    let friends = [],
    data_f = YML.parse(fs.readFileSync('source/_data/link.yml').toString().replace(/(?<=rss:)\s*\n/g, ' ""\n'));

    data_f.forEach((entry, index) => {
    let lastIndex = 2;
    if (index < lastIndex) {
    const filteredLinkList = entry.link_list.filter(linkItem => !blacklist.includes(linkItem.name));
    friends = friends.concat(filteredLinkList);
    }
    });

    // 根据规定的格式构建 JSON 数据
    const friendData = {
    friends: friends.map(item => {
    return [item.name, item.link, item.avatar];
    })
    };

    // 将 JSON 对象转换为字符串
    const friendJSON = JSON.stringify(friendData, null, 2);

    // 写入 friend.json 文件
    fs.writeFileSync('./source/friend.json', friendJSON);

    console.log('friend.json 文件已生成。');

    然后依次执行
    1
    2
    3
    npm i yamljs --save
    node link.js
    hexo cl;hexo g;hexo d
    这样友链数据就出来了。例:你的博客域名/friend.json
  1. vercel部署
    进入vercel点击右上角的new project,导入你fork的仓库,然后添加自定义域名
  2. 开始运行
    打开github朋友圈仓库,点击上方的action,再点击左侧的Friend circle lite
    4
    点击运行工作流程,等待几分钟就大功告成了

结尾

朋友圈会自动抓取配置了rss的博客,没有配置的博客不会显示
朋友圈底部的订阅:32 活跃:19,意思是你有32个友链,只有19人配置了rss
这下你访问你朋友圈域名或者博客朋友圈的页面就会显示文章了