fetch-ecosystem.py 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/bin/env python3
  2. # DSH ecosystem snapshot: GitHub stars + npm downloads + latest version
  3. # usage: python3 fetch-ecosystem.py [outfile.md]
  4. import json, sys, urllib.request
  5. from datetime import datetime
  6. REPOS = [
  7. "deepseek-ai/deepseek-harness",
  8. "anywhere-labs/deepseek-harness-desktop",
  9. "awesome-dsh-plugin/awesome-dsh-plugin",
  10. "yjh051108/dsh-routing-suite",
  11. "zhu1090093659/dsh-web-ui",
  12. "ccch1mneyyy/dsh-TUI",
  13. "dataelement/dsh-desktop",
  14. "dsh-market/dsh-market",
  15. "Small-tailqwq/dsh-deep-whale",
  16. "fufankeji/deepseek-harness-studio",
  17. "lencx/Minke",
  18. "TermonyHQ/Termony",
  19. "hust-open-atom-club/oh-dsh",
  20. "shenjackyuanjie/dsh-ohos-patch",
  21. ]
  22. def get(url):
  23. req = urllib.request.Request(url, headers={"User-Agent": "dsh-harmony-kb"})
  24. with urllib.request.urlopen(req, timeout=15) as resp:
  25. return json.loads(resp.read().decode())
  26. lines = ["# DSH ecosystem snapshot " + datetime.now().strftime("%Y-%m-%d %H:%M"), ""]
  27. lines += ["## GitHub repos", "", "| repo | stars | forks | last push |", "|---|---|---|---|"]
  28. for r in REPOS:
  29. try:
  30. d = get("https://api.github.com/repos/" + r)
  31. lines.append("| {} | {} | {} | {} |".format(d.get("full_name"), d.get("stargazers_count"), d.get("forks_count"), str(d.get("pushed_at", ""))[:10]))
  32. except Exception as e:
  33. lines.append("| {} | ERR | - | - |".format(r))
  34. lines += ["", "## npm (@deepseek-ai/dsh)", ""]
  35. for label, url in [("weekly", "https://api.npmjs.org/downloads/point/last-week/@deepseek-ai/dsh"), ("monthly", "https://api.npmjs.org/downloads/point/last-month/@deepseek-ai/dsh")]:
  36. try:
  37. lines.append("- " + label + " downloads: " + str(get(url).get("downloads")))
  38. except Exception:
  39. lines.append("- " + label + " downloads: ERR")
  40. try:
  41. lines.append("- latest version: " + str(get("https://registry.npmjs.org/@deepseek-ai/dsh").get("dist-tags", {}).get("latest")))
  42. except Exception:
  43. lines.append("- latest version: ERR")
  44. lines += ["", "watch: anywhere-labs cross-platform moves, dsh-web-ui mobile remote, Termony+ohos CLI combo.", ""]
  45. out = chr(10).join(lines)
  46. print(out)
  47. if len(sys.argv) > 1:
  48. open(sys.argv[1], "w").write(out)
  49. print("saved to " + sys.argv[1], file=sys.stderr)