How to follow a rediect?
#1
I have been messing with the fastpasstv plug-in and in looking at getting it working again and I have it down to where I pull the url for the redirect out but I am stuck there. Is there a way to get the script to follow the url, wait 15 seconds for the redirect to happen and then read the html source of the page I end up at?

If that made no sense then that si because I am new to this.

Thanks,
Reply
#2
Hi Free,

I've been doing a bit of work on it too. Here is the function I used for the redirect

Code:
def redirector(url):
    ''' redirecter is to get through the 15 seconds wait page on the directed page.'''
    req = urllib2.Request(url)
    req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
    response = urllib2.urlopen(req)
    link=response.read()
    gurl=re.compile('<p align="center">\n<a href="(.+?)">').findall(link)
    gurl2 = "http://www.fastpasstv.ms"+str(gurl[0])
    return gurl2

Run this first on each of the url resolver functions.

Code:
link0 = redirector(url)

I got novamov working, but nothing else.

Let me know if you want to work together on this?
Reply
#3
I know nothing about python.

But this was the first hit on google:
http://diveintopython.org/http_web_servi...rects.html
Code:
GRANT ALL PRIVILEGES ON `xbmc_%`.* TO 'xbmc'@'%';
IF you have a mysql problem, find one of the 4 dozen threads already open.
Reply
#4
Thanks. I will try to use your function and see what can get working. If i make any progress on any other sites i will let you know and send it to you.

I also got videoweeks.es links working as well as novamov, but only those two. videoweeds file is about the same to extract.

I don't want to offer to help too much because i have written a total of about 10 lines of python code in my life and think at this point i will slow down any development effort more then i would help.
Reply
#5
You really do not need to. The http://www.fastpasstv.ms/redirect/?url= always remains the same, just grab the string after it and add it before requesting the url.

The response url is the original page of the file.

Code:
import urllib,urllib2,re,sys,os

req = urllib2.Request('http://www.fastpasstv.ms/redirect/?url=3uXn46ChlNzr7Z%2Fg4tzlzcbm25%2Fh2Nqh1dHV79blodba1aTqs6io15%2FY1Z3d2tekqpY%3D')
req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14')
response = urllib2.urlopen(req)
print response.url
Reply
#6
Voinage Wrote:You really do not need to. The http://www.fastpasstv.ms/redirect/?url= always remains the same, just grab the string after it and add it before requesting the url.

The response url is the original page of the file.
...

I had gotten that far. The problem I am having is that links redirects to a page with a 15 second timer before another redirect to the page with the video file in it. As I said i have only written about 10 lines of python so this may be a no-brainer but it is helping me figure a little bit of this out.
Reply

Logout Mark Read Team Forum Stats Members Help
How to follow a rediect?0