Created
April 4, 2012 09:44
-
-
Save paradoxxxzero/2300026 to your computer and use it in GitHub Desktop.
Offliberpy
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 -*- | |
# | |
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
# Version 2, December 2004 | |
# | |
# Copyright (C) 2012 paradoxxx_zero | |
# | |
# Everyone is permitted to copy and distribute verbatim or modified | |
# copies of this license document, and changing it is allowed as long | |
# as the name is changed. | |
# | |
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | |
# | |
# 0. You just DO WHAT THE FUCK YOU WANT TO. | |
import sys | |
from urllib.request import urlopen | |
from urllib.parse import urlencode | |
from re import search | |
post_url = "http://offliberty.com/off.php" | |
def parse_response(response): | |
return search(b'<A HREF="(.*)" class="download"', response).group(1) | |
def get_response(url): | |
return urlopen( | |
post_url, | |
urlencode({ | |
'track': url, | |
'reftext': ''}).encode('utf-8')).read() | |
def offliberpy(url): | |
return parse_response(get_response(url)) | |
if __name__ == '__main__': | |
print(offliberpy(sys.argv[1]).decode('utf-8')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment