22 lines
585 B
Python
22 lines
585 B
Python
from flask import abort, Blueprint
|
|
from .youtube import APIClient, NoSuchChannel
|
|
from .feed import construct_rss
|
|
|
|
|
|
def create_blueprint(config):
|
|
"""Create a YouTube endpoint blueprint."""
|
|
client = APIClient(config["key"])
|
|
twitch = Blueprint("youtube", __name__)
|
|
|
|
@twitch.route("/<string:login>", methods=["GET", "HEAD"])
|
|
def vod(login: str):
|
|
try:
|
|
return (
|
|
construct_rss(client, login),
|
|
{"Content-Type": "application/rss+xml"},
|
|
)
|
|
except NoSuchChannel:
|
|
abort(404)
|
|
|
|
return twitch
|