How to get nid from URL alias in drupal 7?
The $_SERVER['HTTP_REFERER'] will return the full URL, but the function drupal_lookup_path() takes only the alias as argument, so parse you URL and pass only the alias, john/video/nature-beauty then it will work.

$url = $_SERVER['HTTP_REFERER'];
$path = preg_replace('/\//','',parse_url($url,PHP_URL_PATH),1);
$org_path = drupal_lookup_path("source", $path);
$node = menu_get_object("node", 1, $org_path);
$nid=$node-&gt;nid;
print $nid;