-
Notifications
You must be signed in to change notification settings - Fork 1
/
reels.php
130 lines (115 loc) · 11 KB
/
reels.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php
function getVideoLink($reel_link)
{
$reel_id = preg_match('/\/reel\/([\w]+)\//', $reel_link, $matches) ? $matches[1] : null;
if (!$reel_id) {
return array("", "");
}
$link = "https://www.instagram.com/graphql/query/";
$headers = array(
'User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.193 Safari/537.36'
);
$variables = '{"child_comment_count":3,"fetch_comment_count":40,"has_threaded_comments":true,"parent_comment_count":24,"shortcode":"' . $reel_id . '"}';
$params = array(
'hl' => 'en',
'query_hash' => 'b3055c01b4b222b8a47dc12b090e4e64',
'variables' => $variables
);
$url = $link . '?' . http_build_query($params);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
try {
$resp = curl_exec($ch);
$data = json_decode($resp, true);
$video_link = $data['data']['shortcode_media']['video_url'];
$image_preview = $data['data']['shortcode_media']['display_url'];
return array($video_link, $image_preview);
} catch (Exception $e) {
return array("", "");
} finally {
curl_close($ch);
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Instagram Reels Downloader</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<link href="https://fonts.googleapis.com/css2?family=Gotu&display=swap" rel="stylesheet">
<style type="text/css">
html,
body {
font-family: "Gotu"
}
input {
padding: 5px;
border-radius: 10px;
border-style: solid;
border-color: blue;
transition-duration: 0.5s;
width: 80%;
}
input:focus {
border-color: skyblue;
transition-duration: 0.5s;
}
</style>
</head>
<body class="bg-light">
<div class="text-center p-5">
<img src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMzIuMDA0IiBoZWlnaHQ9IjEzMiIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgoJPGRlZnM+CgkJPGxpbmVhckdyYWRpZW50IGlkPSJiIj4KCQkJPHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjMzc3MWM4Ii8+CgkJCTxzdG9wIHN0b3AtY29sb3I9IiMzNzcxYzgiIG9mZnNldD0iLjEyOCIvPgoJCQk8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiM2MGYiIHN0b3Atb3BhY2l0eT0iM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TYzLTE2IDE2LTE2eiIvPgo8L3N2Zz4=">
<h1 class="mt-5">Intagram Reels Downloader</h1>
</div>
<div class="text-center">
Paste a video url below and press "Download". Now scroll down to "Download Video" button and press to initiate the download process.<br><br>
<form method="POST" class="mt-2">
<input type="text" placeholder="https://www.instagram.com/reel/abcdef1234/?hl=en" class="mb-3" name="insta-url"><br><br>
<button class="btn btn-success" type="submit">Download</button>
</form>
</div>
<?php
if (isset($_POST['insta-url']) && !empty($_POST['insta-url'])) {
$url = trim($_POST['insta-url']);
$response_array = getVideoLink($url);
$embed_link = $response_array[0];
$image_preview = $response_array[1];
?>
<div class="border m-3 mb-5" id="result">
<div class="row m-0 p-2">
<div class="col-sm-5 col-md-5 col-lg-5 text-center"><img width="250px" height="250px" src="<?php echo $image_preview; ?>"></div>
<div class="col-sm-6 col-md-6 col-lg-6 text-center mt-5">
<ul style="list-style: none;padding: 0px">
<li>
<button onclick="window.open('<?php echo $embed_link; ?>', '_blank')" class="btn btn-success" type='button' name='download'>Download Video</button>
</li>
<li>
<div class="alert alert-primary mb-0 mt-3">If the video opens directly, try saving it by pressing CTRL+S or on phone, save from three dots in the bottom left corner</div>
</li>
</ul>
</div>
</div>
</div>
<?php } ?>
<div class="m-5">
</div>
<div class="bg-dark text-white" style="position: fixed; bottom: 0;width: 100%;padding:15px">Developed by <a target="_blank" href="https://www.github.com/TufayelLUS">Tufayel Ahmed</a> <span style="float: right;">Copyright © <?php echo date("Y"); ?></span></div>
<script type="text/javascript">
window.setInterval(function() {
if ($("input[name='insta-url']").attr("placeholder") == "https://www.instagram.com/reel/CvP2R_RMPsP/?hl=en") {
$("input[name='insta-url']").attr("placeholder", "https://www.instagram.com/reel/Cu9xY6BRv6x/?hl=en");
} else {
$("input[name='insta-url']").attr("placeholder", "https://www.instagram.com/reel/CvP2R_RMPsP/?hl=en");
}
}, 3000);
</script>
</body>
</html>