This CodeLet set title and body field values using Ajax. 
Place this CodeLet to your custom module file(.module) or Create a Custom module for Drupal 8 as per documentation https://www.drupal.org/docs/8/creating-custom-modules.

First of all add a field(field_link) to your content type. after that add an ajax to that field as per CodeLet.
Ajax example to replace multiple fields on ajaxCallback.
You set multiple fields value on ajax trigger in Drupal 8.

CodeLet
<?php
use Drupal\Core\Form\FormStateInterface;
use
Drupal\Core\Ajax\AjaxResponse;
use
Drupal\Core\Ajax\ReplaceCommand;

 function
MYMODULE_form_alter(&$form, FormStateInterface $form_state, $form_id) {
     if (
$form_id == 'FORM_ID') {//FORM_ID = node_TYPE_form
            //Add prefix and suffix to title field for ajax response.
      
$form['title']['#prefix'] = '<div id="mymodule-title-wrapper">';
        
$form['title']['#suffix'] = '</div>';
        
//Add prefix and suffix to body field for ajax response.
        
$form['body']['#prefix'] = '<div id="mymodule-body-wrapper">';    
        
$form['body']['#suffix'] = '</div>';
        
$form['field_link']['widget'][0]['value']['#ajax'] = array(
           
'callback' => 'MYMODULE_LinkCallback',//Ajax callback call on ajax
           
'event' =>'change',
           
'wrapper' => 'MYMODULE-link-wrapper',
           
'suppress_required_fields_validation' => TRUE,
           
'progress' => array(
                   
// Graphic shown to indicate ajax. Options: 'throbber' (default), 'bar'.
                   
'type' => 'throbber',
                   
// Message to show along progress graphic. Default: 'Please wait...'.
                   
'message' => NULL,
            ),
    );
     }
 }
 
/**
 * Ajax callback
 * MYMODULE_LinkCallback
 *
 * @param array $form
 * @param FormStateInterface $form_state
 * @return Ajax response
 */
function MYMODULE_LinkCallback(array $form, $form_state) {
   
$link_detail = '';
   
$title = 'Enter a title';
   
$description = 'Enter a summary';
   
$link = '';

    if (
$form_state->getValue('field_link')) {//get input url
       
$link = $form_state->getValue('field_link');
       
$link = $link['0']['value'];
    }
    if (
$link) {
       
$parsed = parse_url($link);
        if (empty(
$parsed['scheme'])) {
           
$link = 'http://' . ltrim($link, '/');
        }
       
$link_data = _GetUrlData($link);
           
       
$title = isset($link_data['title']) ? $link_data['title'] : '';
       
$description = isset($link_data['description']) ? $link_data['description'] : '';
       
//set Title and description value
       
$form['title']['widget'][0]['value']['#value'] = $title;
       
$form['body']['widget'][0]['value']['#value'] = $description;
    }
   
   
$ajax_response = new AjaxResponse();
   
   
//Replace Title and Description
   
$ajax_response->addCommand(new ReplaceCommand('#mymodule-title-wrapper', $article_form['body']));
   
$ajax_response->addCommand(new ReplaceCommand('#mymodule-title-wrapper', $article_form['title']));
       
    return
$ajax_response;   
}


/**
 * _GetUrlData
 * @param string $url
 * @return Ambigous <boolean, string>
 */
function _GetUrlData($url = '') {
   
$result = false;
    if (!empty(
$url))
       
$contents = @file_get_contents($url);

    if (isset(
$contents) && is_string($contents)) {
       
$title = null;
       
$metaTags = null;
        
       
preg_match('/<title>([^>]*)<\/title>/si', $contents, $match );

        if (isset(
$match) && is_array($match) && count($match) > 0) {
           
$title = strip_tags($match[1]);
        }
        
       
preg_match_all('/<[\s]*meta[\s]*name="?' . '([^>"]*)"?[\s]*' . 'content="?([^>"]*)"?[\s]*[\/]?[\s]*>/si', $contents, $match);
        
        if (isset(
$match) && is_array($match) && count($match) == 3) {
           
$originals = $match[0];
           
$names = $match[1];
           
$values = $match[2];
            if (
count($originals) == count($names) && count($names) == count($values)) {
                for (
$i=0, $limiti=count($names); $i < $limiti; $i++) {
                   
$result[strtolower($names[$i])] = $values[$i];
                }
            }
        }
       
$result['title'] = $title;
    }
 
    return
$result;
}
?>
Submitted by saru1683 on