Glanceway Glanceway
すべてのソース

Product Hunt

ニュース v1.0.0

Today's top products from Product Hunt

@codytseng #producthunt #products #startups

Install and configure this source

  1. Install Glanceway and open it on your Mac before using the install link above.
  2. Choose Install in Glanceway. If the browser cannot open the app, download the .gwsrc file and import it through source management.
  3. Complete the required fields below, save, and choose a refresh interval. Check the source after its first successful fetch.

Configuration checklist

  • API_TOKEN — Required. Product Hunt Developer Token (get one at https://api.producthunt.com/v2/oauth/applications) Use your own credential; do not share it in screenshots or public files.

If items are missing

  • Verify the field names, list entries, and credentials against the current version’s configuration table. Sample values below are examples, not active credentials.
  • Check network access and upstream service availability. Authentication failures and rate limits can prevent a refresh; use a slower interval when the provider limits requests.
  • An empty result can also mean there are no matching items. Fetched content and update timing depend on the provider and source implementation.

設定項目

名前 キー タイプ 必須 デフォルト 説明
API Token API_TOKEN secret はい — Product Hunt Developer Token (get one at https://api.producthunt.com/v2/oauth/applications)

ソースコード

id: codytseng/product-hunt
version: 1.0.0
name: Product Hunt
description: Today's top products from Product Hunt
author: codytseng
author_url: https://github.com/codytseng
category: News
tags:
  - producthunt
  - products
  - startups

config:
  - key: API_TOKEN
    name: API Token
    type: secret
    required: true
    description: Product Hunt Developer Token (get one at https://api.producthunt.com/v2/oauth/applications)
module.exports = async (api) => {
  const token = api.config.get("API_TOKEN");

  async function fetchData() {
    const query = `{
      posts(order: RANKING) {
        edges {
          node {
            id
            name
            tagline
            url
            votesCount
            createdAt
          }
        }
      }
    }`;

    const response = await api.fetch("https://api.producthunt.com/v2/api/graphql", {
      method: "POST",
      headers: {
        Authorization: `Bearer ${token}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ query }),
    });

    if (!response.ok || !response.json) {
      throw new Error(`Failed to fetch Product Hunt posts (HTTP ${response.status})`);
    }

    api.emit(
      response.json.data.posts.edges.map((edge) => ({
        id: edge.node.id,
        title: edge.node.name,
        subtitle: edge.node.tagline,
        url: edge.node.url,
        timestamp: edge.node.createdAt,
      })),
    );
  }

  await fetchData();

  return {
    refresh: fetchData,
  };
};

関連ソース