https://bedirhanerkan.com.tr/on-sunum/twitter.json Sadece csrf token ve cookie alıp kullanmak kalıyor. Yenileme içinde reflesh değerini bulup gönderilirse en yenileri baştan aşağı otomatik getiriyor.
<?php
echo "<pre>";
function twitter($urlNe)
{
global $step;
// Generated by curl-to-PHP: http://incarnate.github.io/curl-to-php/
$ch = curl_init();
$urlNe = urlencode($urlNe);
curl_setopt($ch, CURLOPT_URL, "https://twitter.com/i/api/2/search/adaptive.json?include_profile_interstitial_type=1&include_blocking=1&include_blocked_by=1&include_followed_by=1&include_want_retweets=1&include_mute_edge=1&include_can_dm=1&include_can_media_tag=1&skip_status=1&cards_platform=Web-12&include_cards=1&include_ext_alt_text=true&include_quote_count=true&include_reply_count=1&tweet_mode=extended&include_entities=true&include_user_entities=true&include_ext_media_color=true&include_ext_media_availability=true&send_error_codes=true&simple_quoted_tweet=true&q=selam&tweet_search_mode=live&count=20&query_source=typed_query&cursor={$urlNe}&pc=1&spelling_corrections=1&ext=mediaStats%2ChighlightedLabel%2CsignalsReactionMetadata%2CsignalsReactionPerspective%2CvoiceInfo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
$headers = array();
$headers[] = 'Authority: twitter.com';
$headers[] = 'Sec-Ch-Ua: \"Google Chrome\";v=\"93\", \" Not;A Brand\";v=\"99\", \"Chromium\";v=\"93\"';
$headers[] = 'X-Twitter-Client-Language: tr';
$headers[] = 'X-Csrf-Token: CSRF_DEĞERLERİ';
$headers[] = 'Sec-Ch-Ua-Mobile: ?0';
$headers[] = 'Authorization: Authorization_DEĞERLERİ';
$headers[] = 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36';
$headers[] = 'X-Twitter-Auth-Type: OAuth2Session';
$headers[] = 'X-Twitter-Active-User: yes';
$headers[] = 'Sec-Ch-Ua-Platform: \"macOS\"';
$headers[] = 'Accept: */*';
$headers[] = 'Sec-Fetch-Site: same-origin';
$headers[] = 'Sec-Fetch-Mode: cors';
$headers[] = 'Sec-Fetch-Dest: empty';
$headers[] = 'Referer: https://twitter.com/search?q=selam&src=typed_query&f=live';
$headers[] = 'Accept-Language: tr,ru;q=0.9,en;q=0.8,tr-TR;q=0.7,en-US;q=0.6,la;q=0.5';
$headers[] = 'Cookie: COOKIE_DEĞERLERİ';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
$data = json_decode($result);
preg_match('/"scroll:.*",/',$result,$m);
return array(trim($m[0],',"'),$data->globalObjects->tweets);
}
$data = twitter('scroll:thGAVUV0VFVBaCwLC5gZW56ycWksCy8ayOuusnEnEVyIB6FYCJehgHREVGQVVMVDUBFQQVAAA=');
print_r($data[1]);
for($i=0; $i<10 ; $i++)
{
echo $i."<br>";
$data = twitter($data[0]);
print_r($data[1]);
}
?>