Seems like you could combine get_twitter_embed_code and get_instagram_embed_code into one data-driven function,and even control the whole shebang with a dict keyed by content_type, with fields for content_container, oembed_endpoint, etc. Then adding a new input type would just mean adding a new entry to the dict.