Jump to content

Redirect after grabbing URL


Graxeon

Recommended Posts

Note: I did not write these scripts. They were openly available for use. Also...I am asking for quite a bit here. It's not worth it having to go through hours of learning to get 1 thing done :(. (I don't mean to sound rude)

 

This is a Greasemonkey script used on FireFox. I need to convert it for use on a website. Through FireFox, whenever you visit a veoh video (like: http://www.veoh.com/videos/v1706497Yse7Gyte) the script below will automatically find the source file of the video and output a link to it instead of playing the actual video.

 

So again, I would like for it to be available through a website (instead of installing it) and make it so it finds the source file and automatically REDIRECTS you to that source file.

 

Here it is in greater detail:

 

I would like to take this:

 

// ==UserScript==
// @name           Strip Veoh URL & Use To Find FLV & Replace Page with Link
// @namespace      me
// @description    This is a quick and dirty hack that connects to Veoh directly and asks for a download link for their stupid flv. I made a bunch of other programs, but I want Veoh to work, the sites haven't updated their scripts to make mine work yet, so I just did this from scratch and they can go do what they will.
// @include        http://www.veoh.com/videos/*
// ==/UserScript==
var initX=function(){
document.body.innerHTML="";
var id=location.href.split("\?")[0].split("/")[4];
var url="http\:\/\/www.veoh.com\/rest\/video\/"+id+"\/details";
	GM_xmlhttpRequest({
	method: "GET",
	url: url,
	onload: function(stuff){
		document.body.innerHTML=stuff.responseText;
		document.body.innerHTML="<a href=\""+document.getElementsByTagName("video")[0].getAttribute("fullpreviewhashpath")+"\">Click here to Download FLV.</a>";
	}
});
}
initX();/////THIS IS THE WORST SCRIPT I EVER MADE. But it works.

 

And make it accessible through http://www.domain.com/file.php?=

 

(file.php would refer to the script on top)

 

So then I could use the full link like so: http://www.domain.com/file.php?=http://www.veoh.com/videos/v1706497Yse7Gyte

 

*but*

 

Instead of having the script output a link to the file, I would like it to just redirect to the file.

 

I think this is the redirect script:

 

<script language="javascript"><!--
location.replace("veoh.com/linkedfilehere")
//-->
</script>

 

 

If that can't be done, then is it possible to output the source file url back to the page that requested it? Like say we had a FLV web player running and it was told to play the file "http://www.domain.com/file.php?=http://www.veoh.com/videos/v1706497Yse7Gyte" but the "file.php" would just send back the source file url.

 

 

I hope this isn't too much work. I really need to figure out how to do this :(.

Link to comment
https://forums.phpfreaks.com/topic/134669-redirect-after-grabbing-url/
Share on other sites

I dont think I get you 100%.  But, if this is the URL:

 

http://www.domain.com/file.php?=http://www.veoh.com/videos/v1706497Yse7Gyte

 

And you want the script to redirect to http://www.veoh.com/videos/v1706497Yse7Gyte

 

Then alls you have to do is this:

 

<?php
if (isset($_GET["file"])) {
    $file = $_GET["file"];
    header("Location: $file");
}
?>

Sorry for this but I'm a total newbie D:

 

How exactly would I use the php code you gave me with the first script I gave?

 

And to clarify things up:

 

I would like to have the feature found here: http://max.subfighter.com/flv/downloader.php?flvsite=http://www.veoh.com/videos/v7590839tSY2GbW

 

But...instead of linking people to the file...I would like the PHP file to redirect the page to the source file.

 

So say I had a FLV player and it was setup somewhat like this:

 

<script language="JavaScript" type="text/javascript">
      var flashvars =
      {
        file:                 'http://www.domain.com/file.php?=http://www.veoh.com/videos/v7590839tSY2GbW',
        playlist:             'bottom',
        playlistsize:         '150',
        shuffle:              'false',
        repeat:               'false',
        stretching:           'exactfit',
        backcolor:            'FFFFFF',
        frontcolor:           '000000',
        lightcolor:           '000000',
        volume:               '100',
        autostart:            'false'
      };

      var params =
      {
        allowfullscreen:      'true',
        allowscriptaccess:    'always',
        wmode:                'opaque',
        bgcolor:              '#FFFFFF'
      };

      var attributes =
      {
        id:                   'playerId',
        name:                 'playerId'
      };

      swfobject.embedSWF('player.swf', 'player', '480', '452', '9.0.124', false, flashvars, params, attributes);
    </script>

 

So this FLV player is asking "file.php" to grab the source file of "http://www.veoh.com/videos/v7590839tSY2GbW". And then "file.php" would link back that source file (or redirect...which ever works) to the FLV player so that it can be viewed through this FLV player.

 

 

Is that better? >.<

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.