惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
T
Tailwind CSS Blog
V
V2EX
阮一峰的网络日志
阮一峰的网络日志
H
Help Net Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
腾讯CDC
GbyAI
GbyAI
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Last Week in AI
Last Week in AI
A
About on SuperTechFans
L
LangChain Blog
Engineering at Meta
Engineering at Meta
F
Fortinet All Blogs
G
Google Developers Blog
The Cloudflare Blog
云风的 BLOG
云风的 BLOG
D
Docker
博客园 - 聂微东
博客园 - 司徒正美
Recent Announcements
Recent Announcements
MyScale Blog
MyScale Blog
U
Unit 42

夜行人

回家路上 第一期的直播演示项目 震动检测器 正能量 在线参观CodeLab Neverland 发布 CodeLab Adapter 3.3.1 DynamicTable 之 纸糊方向盘 CodeLab DynamicTable: 一个可实施的技术方案 CodeLab Insight 发布 Alpha 版 情人节 Home Assistant 周报 && IoT 周报 (02) Joplin: 关注隐私的 Evernote 开源替代软件 浏览器的未来与 Web 传感器 Home Assistant 周报 && IoT 周报 (01) 百宝箱(01) 论自由 介绍 WebThings Home Assistant 周报 && iot 周报 (00) 百宝箱(00) 毛姆读书心得 传世之作 周末徒步 CodeLab Adapter ❤️ Jupyter/Python 航班 躲雨 夏令营途中 [译]思想--作为一种技术 The future of coding 美国之行 三门问题的程序模拟
Scratch3技术分析之社区 API(第5篇)
种瓜 · 2019-01-16 · via 夜行人

文章目录

我们主要关心以下页面的API:

  • 社区主页: https://scratch.mit.edu/
  • 发现页: https://scratch.mit.edu/explore/projects/all

我们可以把这些API视为项目查询接口,查询社区用户已创建的项目(Projects), 这些接口的不同只是查询的条件不同。

社区主页

已登陆用户和未登录用户看到的社区主页,略有不同,我们分别分析。

未登录用户

GET https://api.scratch.mit.edu/proxy/featured

已登陆用户

GET https://api.scratch.mit.edu/proxy/featured

返回数据相同。

已登陆用户会请求更多的API:

新闻接口:

GET https://api.scratch.mit.edu/news?limit=3

返回:

 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
[
  {
    "id": 181868395058,
    "stamp": "2019-01-09T13:53:40.000Z",
    "headline": "Updates and Bug Fixes!",
    "url": "https://scratch.mit.edu/discuss/topic/331439/",
    "image": "https://66.media.tumblr.com/2bbe2bc9317585c1de96c91f56bb061b/tumblr_inline_pad1ik8d2k1tqsk9m_540.png",
    "copy": "We have some updates and bug fixes for you! See here for more information…"
  },
  {
    "id": 181645899223,
    "stamp": "2019-01-02T14:49:48.000Z",
    "headline": "Scratch 3.0 is here!",
    "url": "https://scratch.mit.edu/discuss/topic/326861/",
    "image": "https://66.media.tumblr.com/2bbe2bc9317585c1de96c91f56bb061b/tumblr_inline_pad1ik8d2k1tqsk9m_540.png",
    "copy": "Scratch 3.0 has launched! See here for more information…"
  },
  {
    "id": 181645869948,
    "stamp": "2019-01-02T14:48:22.000Z",
    "headline": "First Scratch Design Studio in 3.0",
    "url": "https://scratch.mit.edu/studios/5801323/",
    "image": "https://66.media.tumblr.com/ee9c9705a8c0334c07c6a32303ec0748/tumblr_inline_p7in9yfrIU1tqsk9m_540.png",
    "copy": "Have you ever wondered what life might be like in the year 3000? Here is your chance to share your dreams and wishes for the future!  "
  }
]
关注者赞过的项目

GET https://api.scratch.mit.edu/users/wwj718/following/users/loves

返回:

关注的工作室的项目

GET https://api.scratch.mit.edu/users/wwj718/following/studios/projects

返回:

发现页

发现页可以用于发现项目工作室。工作室(Studio)目前官方还没有迁移完,我们暂时不关心。(工作室非常接近知乎收藏夹的概念)。

默认请求

GET https://api.scratch.mit.edu/explore/projects?limit=16&offset=0&language=zh-cn&mode=trending&q=*

默认情况下,选择了全部热门的简体中文(页底),从url参数你可以看到这些。

最受欢迎的动画

GET https://api.scratch.mit.edu/explore/projects?limit=16&offset=0&language=zh-cn&mode=popular&q=animations

观察URL参数,我们便搞懂了发现页的API细节了。