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("/", methods=["GET", "HEAD"]) def vod(login: str): try: return ( construct_rss(client, login), {"Content-Type": "application/rss+xml"}, ) except NoSuchChannel: abort(404) return twitch