Skip to content

Conversation

@mbertrand
Copy link
Member

@mbertrand mbertrand commented Oct 24, 2025

What are the relevant tickets?

Part of https://github.com/mitodl/hq/issues/8880

Description (What does it do?)

  • Adds an API endpoint for video shorts
  • Adds a webhook endpoint to process new video short metadata coming from ol-data-platform
  • Adds a management command to backpopulate video shorts from S3

How can this be tested?

With your mit-learn containers up, run this in a python shell in your host OS:

import hmac
import hashlib
import json
import requests

data =  {
    "video_id": "k_AA4_fQIHc",
    "youtube_metadata": <use sample_youtube_metadata dict in the parent conftest.py file>,
    "source": "youtube"
}

secret = "please-change-this"
payload_string = json.dumps(data, separators=(",", ":"))
signature = hmac.new(secret.encode(), payload_string.encode(), hashlib.sha256).hexdigest()
headers = {
    "X-MITLearn-Signature": signature,
    "Content-Type": "application/json",
}

response = requests.post("http://open.odl.local:8063/api/v1/webhooks/video_shorts/", data=payload_string, headers=headers)
print(response)

You can also try out the new backpopulate management command: ./manage.py backpopulate_video_shorts

TODO

  • devops will need to set up fastly so that /shorts/... urls will route to the correct bucket location

@github-actions
Copy link

OpenAPI Changes

Show/hide 3 changes: 0 error, 0 warning, 3 info
3 changes: 0 error, 0 warning, 3 info
info	[endpoint-added] at head/openapi/specs/v0.yaml	
	in API GET /api/v0/video_shorts/
		endpoint added

info	[endpoint-added] at head/openapi/specs/v0.yaml	
	in API GET /api/v0/video_shorts/{youtube_id}/
		endpoint added

info	[endpoint-added] at head/openapi/specs/v1.yaml	
	in API POST /api/v1/webhooks/video_shorts/
		endpoint added


Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

@mbertrand mbertrand force-pushed the mb/video_shorts_api branch from d96cf02 to 44ac1b9 Compare October 24, 2025 19:04
@mbertrand mbertrand force-pushed the mb/video_shorts_api branch from f5d66e4 to 096f4dc Compare October 24, 2025 21:33
@shanbady shanbady self-assigned this Oct 27, 2025
Copy link
Contributor

@shanbady shanbady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. only question i had is around why this is a completely separate model (not a learning resource) - just making sure its intentional we dont want embeddings or for this to show up in the search index

@mbertrand
Copy link
Member Author

Good question, these are intended only for the "MIT Learning Moments" carousel which currently shows up on the home page on RC (the shorts are currently hardcoded in the frontend). They should not show up in learning resource or contentfile results.

@mbertrand mbertrand merged commit dbcb98d into main Oct 28, 2025
13 checks passed
@mbertrand mbertrand deleted the mb/video_shorts_api branch October 28, 2025 15:02
@odlbot odlbot mentioned this pull request Oct 28, 2025
3 tasks
This was referenced Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants