header('Content-Type: text/html; charset=utf-8');
function get_string_between($string, $start, $end)
{
preg_match_all( '/' . preg_quote( $start, '/') . '(.*?)' . preg_quote( $end, '/') . '/', $string, $matches);
return $matches[1];
}
$sayfa = file_get_contents("https://www.youtube.com/results?search_query=deneme");
echo "<pre>";
print_r(get_string_between($sayfa,"<a href=\"/watch?v=","\" class=\"yt-uix-sessionlink"));
//print_r(get_string_between($sayfa,'title="','" rel="spf-prefetch"'));
//print_r(get_string_between($sayfa,'title="','" rel="spf-prefetch" aria-describedby="description-id-'));
print_r(get_string_between($sayfa,'<div class="yt-lockup-description yt-ui-ellipsis yt-ui-ellipsis-2" dir="ltr">','</div></div>'));
echo "</pre>";
$d = fopen("html.txt", "w") or die("d açılamıyor!");
fwrite($d, $sayfa);
fclose($d);