Created
February 18, 2021 13:26
-
-
Save defrindr/134167d265f4799cc9d217a31ff3ca10 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class IG { | |
public static function get($custom_header = null) | |
{ | |
$url = "https://www.instagram.com/batutracking19/"; | |
$html_response = file_get_contents($url); | |
$json_response = explode("window._sharedData = ", $html_response)[1]; | |
$json_response = explode(";</script>", $json_response)[0]; | |
$response = json_decode($json_response); | |
$timelines_default = $response | |
->entry_data | |
->ProfilePage[0] | |
->graphql | |
->user | |
->edge_felix_video_timeline | |
->edges; | |
$timelines = []; | |
foreach($timelines_default as $timeline){ | |
$timeline = $timeline->node; | |
$timelines[] = [ | |
"display_url" => $timeline->display_url, | |
"is_video" => $timeline->is_video, | |
"video_url" => $timeline->video_url, | |
"video_duration" => $timeline->video_duration, | |
]; | |
} | |
return $timelines; | |
} | |
public static function toObject($data){ | |
return (object)json_decode($data); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment