Glanceway Glanceway
جميع المصادر

StackOverflow Hot

المطورون v1.0.0

Hot questions from StackOverflow

@codytseng #stackoverflow #programming #qa

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

  • TAG — Optional. Filter by tag (e.g. javascript, python, react). Leave empty for all tags. Add each value as a separate list item.
  • SORT — Optional. Sort order for questions

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.

الإعدادات

الاسم المفتاح النوع مطلوب القيمة الافتراضية الوصف
Tag TAG list لا — Filter by tag (e.g. javascript, python, react). Leave empty for all tags.
Sort SORT select لا hot Sort order for questions
hotactivityvotescreationweekmonth

الشيفرة المصدرية

id: codytseng/stackoverflow-hot
version: 1.0.0
name: StackOverflow Hot
description: Hot questions from StackOverflow
author: codytseng
author_url: https://github.com/codytseng
category: Developer
tags:
  - stackoverflow
  - programming
  - qa

config:
  - key: TAG
    name: Tag
    type: list
    required: false
    description: Filter by tag (e.g. javascript, python, react). Leave empty for all tags.
  - key: SORT
    name: Sort
    type: select
    required: false
    default: hot
    description: Sort order for questions
    options:
      - hot
      - activity
      - votes
      - creation
      - week
      - month
module.exports = async (api) => {
  const tags = api.config.get("TAG") ?? [];
  const sort = api.config.get("SORT") || "hot";

  async function fetchData() {
    const toItems = (questions) =>
      questions.map((q) => ({
        id: q.question_id.toString(),
        title: q.title,
        subtitle: `${q.score} votes · ${q.answer_count} answers · ${q.tags.slice(0, 3).join(", ")}`,
        url: q.link,
        timestamp: q.creation_date,
      }));

    if (tags.length > 0) {
      const pageSize = Math.min(100, Math.floor(500 / tags.length));
      await Promise.allSettled(
        tags.map(async (tag) => {
          const res = await api.fetch(
            `https://api.stackexchange.com/2.3/questions?order=desc&sort=${sort}&site=stackoverflow&pagesize=${pageSize}&tagged=${encodeURIComponent(tag)}`,
          );
          if (res.ok && res.json) {
            api.emit(toItems(res.json.items));
          }
        }),
      );
    } else {
      const res = await api.fetch(
        `https://api.stackexchange.com/2.3/questions?order=desc&sort=${sort}&site=stackoverflow&pagesize=100`,
      );
      if (!res.ok || !res.json) {
        throw new Error(`Failed to fetch Stack Overflow questions (HTTP ${res.status})`);
      }
      api.emit(toItems(res.json.items));
    }
  }

  await fetchData();

  return {
    refresh: fetchData,
  };
};

مصادر ذات صلة