Glanceway Glanceway
所有信息源

GitHub Trending

开发者 v1.0.0

Trending repositories on GitHub

@codytseng #github #trending #programming

安装与配置方法

  1. 先在 Mac 上安装并打开 Glanceway,再使用上方的安装链接。
  2. 点击“安装到 Glanceway”。如果浏览器无法唤起应用,下载 .gwsrc 文件并在信息源管理中导入。
  3. 填写下列必填字段并保存,设置刷新间隔,等待首次成功获取。

配置检查

  • LANGUAGE — 可选. Filter by programming language (e.g., javascript, python). Leave empty for all languages.

没有显示内容时如何排查

  • 对照当前版本配置表核对字段、列表项和凭据。下方示例不包含可用的真实凭据。
  • 检查网络与上游服务状态。认证失败或速率限制可能导致刷新失败,应根据上游限制调整间隔。
  • 空列表也可能表示没有符合条件的条目。内容和更新时间取决于数据提供方及信息源实现。

配置项

名称 键 类型 必填 默认值 描述
Language LANGUAGE string 否 — Filter by programming language (e.g., javascript, python). Leave empty for all languages.

源代码

id: codytseng/github-trending
version: 1.0.0
name: GitHub Trending
description: Trending repositories on GitHub
author: codytseng
author_url: https://github.com/codytseng
category: Developer
tags:
  - github
  - trending
  - programming

config:
  - key: LANGUAGE
    name: Language
    type: string
    required: false
    description: Filter by programming language (e.g., javascript, python). Leave empty for all languages.
module.exports = async (api) => {
  const language = api.config.get("LANGUAGE");

  async function fetchData() {
    const since = new Date();
    since.setDate(since.getDate() - 7);
    const sinceStr = since.toISOString().split("T")[0];

    let query = `created:>${sinceStr} stars:>5`;
    if (language) {
      query += ` language:${language}`;
    }

    const response = await api.fetch(
      `https://api.github.com/search/repositories?q=${encodeURIComponent(query)}&sort=stars&order=desc&per_page=100`,
    );

    if (!response.ok || !response.json) {
      throw new Error(`Failed to fetch GitHub trending repositories (HTTP ${response.status})`);
    }

    api.emit(
      response.json.items.map((repo) => {
        return {
          id: repo.id.toString(),
          title: repo.full_name,
          subtitle: repo.description || `${repo.language ?? "Unknown"} · ${repo.stargazers_count} stars`,
          url: repo.html_url,
        };
      }),
    );
  }

  await fetchData();

  return {
    refresh: fetchData,
  };
};

相关信息源