How to set featured image from external url programmatically

You can use the post_thumbnail_html filter to set the post thumbnail programmatically to an external URL.

Then you wold set the image URL in a Custom Field on the post writing screen metabox (in this example with a meta key of thumbnail_url):

add_filter('post_thumbnail_html', 'custom_thumbnail_tag_filter', 10, 3);
function custom_thumbnail_tag_filter($html, $postid, $thumbnailid) {
    if (!$thumbnailid) {
        $src = get_post_meta($postid, 'thumbnail_url', true);
        if ($src) {$html = "<img src="" . $src . "">";}
    }
    return $html;
}