Skip to content

Instantly share code, notes, and snippets.

@jan-matejka
Created February 11, 2012 20:42
Show Gist options
  • Select an option

  • Save jan-matejka/1804107 to your computer and use it in GitHub Desktop.

Select an option

Save jan-matejka/1804107 to your computer and use it in GitHub Desktop.
turn safelinks to rapidshare links in the /// form, not the |||
#! /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