Jump to content

Need help with php script


csong95

Recommended Posts

So i have a script that grabs the video file from mp4upload embed video player but for some reason it stop grabbing the source/mp4 file.

Can someone help me or guild me in the right direction fix this bug.

<?php
error_reporting(E_ERROR | E_PARSE);
$id = $_GET['id'];
function curl($url) {
	$ch = @curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	$head[] = "Connection: keep-alive";
	$head[] = "Keep-Alive: 300";
	$head[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
	$head[] = "Accept-Language: en-us,en;q=0.5";
	curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36');
	curl_setopt($ch, CURLOPT_HTTPHEADER, $head);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_TIMEOUT, 60);
	curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
	@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
	curl_setopt($ch, CURLOPT_REFERER, $u);
	curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
	$page = curl_exec($ch);
	curl_close($ch);
	return $page;
}

$u = curl('https://www.mp4upload.com/embed-'.$id.'.html');
$url = curl('https://www.mp4upload.com/'.$id);
// mp4
$mp4 = explode('"file": "', $u);
$mp4 = explode('",', $mp4[1]);

// jpg
$img = explode('"image": "', $u);
$img = explode('",', $img[1]);

// title
$title = explode('<span class="dfilename">', $url);
$title = explode('</span>', $title[1]);
$title = str_replace(".mp4","",$title[0]);

?>



<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8"/>
<?php
if($title!=''){ echo '<title>'.$title.'</title>'; }
?>

<link rel="shortcut icon" type="image/x-icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAA9CAYAAAAd1W/BAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAIGNIUk0AAHolAACAgwAA+f8AAIDoAABSCAABFVgAADqXAAAXb9daH5AAAAKGSURBVHja7NpLaxNRFAfwfIGqSZPMTOZ902SaNE3GryO4E9y5UsSFuNRNRcGN+KBUEUVFVKQqWLWCRBeaInRh8d1KoVE/wt/VyECdYW6Ted2exX89c37knjvn3hQAFHZzCgRAAARAAARAAARAAARAAAQwch41avjlsn9Z79q4bFUhPMBFs4o/++uBGboMVy0JQgLcYHJo8f5s9GyckIsQCiBq8f68aekQAuDzrIWdAHh5MFVDrgFGKd7fH87pFexaAC9fZi0IB/Cja3ND9BPuD7EAbLkMzx0NR6r7cJPJWOvw94rrtozcAqx2zG0v/7SpYidNM5cAK20j8MUXGzX87PEtjU8x9od4AGaM0Bc+Jhex5KjcEI8bKoQA8HJUKuLVtJbqskgVwMtpdRLLDh/ElssgDICXOb2MQdtI9LM6UwBeLhgVboj7UwqEAfByyaziG8fH1Ps2/3MzDQCgcKA0gXlLwnpEiNt1vl9C5gH8uVtXxr5L5ArAy5KjYuiyQICzehlCAwAofJgxx3LOkFuAfksPBHjSVMUGOFUr4XtIU1ywJTEBDpX34F5dwe+Q9S9kEzw4OYE7dSXS8LTWscQCuGJJ+Nq1YhuUMguwYEtY7ZixT4mZAzivV7DCOQc8HOF4PTMAc3oZb0O2tnGs90wCnFRKeD2tp3YokhrAcbmIfkvHZo9xFX7NlrJ/IjQIGUsPV/Zi2dGwwXke+MLRkJtD0XcBAM+aKtd8P86jr8QAhi7DGW37NPaRc0vjneoycz1+i/3/Roen8MVGcrfGid3BRSl80DYSKzxTAJs9lnjhiQMEbXfzKf93KNGH+W+JX8a0rdH/BAmAAAiAAAiAAAiAAAggWv4OAI9sgX7ix1myAAAAAElFTkSuQmCC"/>
<meta name="robots" content="noindex" />
<META NAME="GOOGLEBOT" CONTENT="NOINDEX" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<script type="text/javascript" src="jw/jwplayer.js?v=7.11.2"></script>
<script type="text/javascript" src="jw/provider.cast.js"></script>
<script type="text/javascript">jwplayer.key = "Q1akbMX1ca0QaE5RQm9N7fKHIandDAw/oIWCsw==";</script>
<style type="text/css">*{margin:0;padding:0}#container{position:absolute;width:100%!important;height:100%!important}</style>
</head>
<body>
<div id="container" class="container"></div>
<script type="text/javascript">
var playerInstance = jwplayer("container");
playerInstance.setup({
width: "100%",
height: "100%",
controls: true,
title: '<?php echo $title; ?>',
displaytitle: true,
flashplayer: "jw/jwplayer.flash.swf",
aspectratio: "16:9",
fullscreen: "true",
primary: 'html5',
provider: 'http',
autostart: false,
image:'<?php if($img[0]!=''){ echo $img[0]; } ?>',
sources: [<?php if($mp4[0]!=''){ echo "{file:'".$mp4[0]."',type: 'video/mp4',default: true}"; } ?>],

logo : {file: "",
		link: "",
		hide: true,
		},
sharing: {
		code: encodeURI("<iframe width=\"640\" height=\"380\" src=\"http://.com/mp4.php?id=<?php echo $id; ?>\" frameborder=\"0\" scrolling=\"no\"></iframe>"),
	},
abouttext: "",
aboutlink: ""
});
jwplayer().addButton(
		"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sb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Download Video",
		function(){
			window.location.href = '<?php if($mp4[0]!=''){ echo str_replace("video",$title,$mp4[0]); } ?>';
		},
		"download"
);
</script>
</body>
</html>

Link to comment
Share on other sites

I don't think so, the only thing that change mp4upload added ads to there start menu but the mp4 file can be seen in the html

 

I don't know where it fail if i did i could have fix it. but the script grabs the title and wont grab image and video.

 

Thanks for taking the time to answer my question. @Administrator

Link to comment
Share on other sites

So... are you looking for suggestions on how to troubleshoot this? Look at what's in $u and see how that compares to what your code expects.

 

Fact is, if it was working before and is not working now then something has changed, and if it wasn't your code then it must have been their code.

Link to comment
Share on other sites

The videos I found via Google had no “file:” or “image:” anywhere in the response. What the page does is run obfuscated JavaScript code which then dynamically injects the video.

 

It's safe to assume they're doing this precisely to stop people from scraping their content, and hotlinking is explicitly prohibited in their FAQ. If you don't want to end up in the abuse category, I suggest you take that seriously. In any case, you're on your own now.

Link to comment
Share on other sites

I see where your coming from with FAQ. My reason for this is to bypass there popup ads which we know can be dangerous to users since popup ads most of the time contain virus ads which is harmful for user. i not saying for everyone to use my method but to give options.

Link to comment
Share on other sites

If you didn't get it the first time: Circumventing protection mechanisms (however ineffective they may be) and violating rules on other websites isn't supported here.

There no need to be rude dude. there site is hosted on copyrighted materials which is illegal. there making money on that copyrighted content but i guess that doesn't matter.

Link to comment
Share on other sites

I see where your coming from with FAQ. My reason for this is to bypass there popup ads which we know can be dangerous to users since popup ads most of the time contain virus ads which is harmful for user. i not saying for everyone to use my method but to give options.

Thing is, that's not your decision to make. Videos uploaded to their website are to be accessed via their website - hotlinking (which is what you're doing) isn't allowed. If you don't like ads then use an ad blocker.

 

there site is hosted on copyrighted materials which is illegal. there making money on that copyrighted content but i guess that doesn't matter.

That's not even remotely true, and your "two wrongs make a right" argument doesn't fly.

 

 

It seems they use obfuscation to prevent people from doing the sorts of things you're trying to do. That, and the explicit prohibition against hotlinking, means we cannot help you.

Link to comment
Share on other sites

No need to go that far. Thanks for not getting upset at us - forums like ours don't get any sort of common carrier-type immunity from people posting content that breaks rules and laws so we can't just look the other way.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.