-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmagnet_link.php
52 lines (46 loc) · 2.92 KB
/
magnet_link.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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<!-- snackbar style -->
<style>#snackbar { visibility: hidden; min-width: 250px; margin-left: -125px; background-color: #333; color: #fff; text-align: center; border-radius: 2px; padding: 16px; position: fixed; z-index: 1; left: 50%; bottom: 30px; font-size: 17px;}#snackbar.show { visibility: visible; -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s; animation: fadein 0.5s, fadeout 0.5s 2.5s;}@-webkit-keyframes fadein { from {bottom: 0; opacity: 0;} to {bottom: 30px; opacity: 1;}}@keyframes fadein { from {bottom: 0; opacity: 0;} to {bottom: 30px; opacity: 1;}}@-webkit-keyframes fadeout { from {bottom: 30px; opacity: 1;} to {bottom: 0; opacity: 0;}}@keyframes fadeout { from {bottom: 30px; opacity: 1;} to {bottom: 0; opacity: 0;}}</style>
<style>.responsive { width: 100%; max-width: 400px; height: auto; }</style><!-- responsive img work -->
</head>
<body>
<?php
/**********get main data except ads**************/
$link_for_magnet = $_GET["link"];
$url = 'https://1337x.to/torrent/'.$link_for_magnet;
$raw = file_get_contents($url);
$re = '/<div class="tab-content">(.*?)<div role="tabpanel" class="tab-pane" id="comments">/ms';
preg_match_all($re, $raw, $matches);
$matched_data = $matches[1][0];
/*************** img section work repalce relative tags with absolute tags********************/
$re3 = '/data-original="(.*?)"/sm';
$count3 = preg_match_all($re3, $raw, $images);
$re4 = '/<img src=\"\/(.*)\"/mU';
for ($y = 0; $y < $count3; $y++) {
//echo '<br><img src="'.$images[1][$y].'" alt="loading" >';
$matched_data = preg_replace($re4, '<img class="responsive" src="get_img.php?images='.$images[1][$y].'" alt="loading"', $matched_data, 1);
}
echo $matched_data;
/***************magnet link data get and display *********************/
$re2 = $re = '/magnet:\?xt=urn:btih:(.*?)"/sm';
preg_match_all($re2, $raw, $magnet);
$magnet_link = "magnet:?xt=urn:btih:".$magnet[1][0];
//echo $magnet_link;
echo '<textarea rows="4" cols="50" name="comment" id="myInput" form="myInput">'.$magnet_link.'</textarea>';
echo '<button onclick="myFunction()">Copy Magnet Link</button><div id="snackbar">Text has been copied</div>';
?>
<!-- snackbar work -->
<script>
function myFunction() {
var copyText = document.getElementById("myInput");
var x = document.getElementById("snackbar")
x.className = "show";
setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
copyText.select();
document.execCommand("Copy");
// alert("Copied the text: \n" + copyText.value);
}
</script>