Created
February 11, 2012 20:42
-
-
Save jan-matejka/1804107 to your computer and use it in GitHub Desktop.
turn safelinks to rapidshare links in the /// form, not the |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # use: $ echo "safelink" | safelinks2rapid.py | |
| import pycurl | |
| import sys | |
| import StringIO | |
| def vtors(a): | |
| r= a.split('|') | |
| print "http://www.rapidshare.com/files/"+r[2]+"/"+r[3] | |
| for l in sys.stdin: | |
| c = pycurl.Curl() | |
| c.setopt(pycurl.URL,l) | |
| b = StringIO.StringIO() | |
| c.setopt(pycurl.WRITEFUNCTION, b.write) | |
| c.setopt(pycurl.FOLLOWLOCATION,1) | |
| c.setopt(pycurl.MAXREDIRS,5) | |
| c.perform() | |
| vtors(b.getvalue()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment