Added MediaFire resolver

develop
Sven Slootweg 13 years ago
parent 302e6c4c0a
commit 86d9b6dc7a

@ -14,6 +14,8 @@ def resolve(url):
return filebox.resolve(url) return filebox.resolve(url)
elif re.match("https?:\/\/(www\.)?pastebin\.com\/[a-zA-Z0-9]+", url) is not None: elif re.match("https?:\/\/(www\.)?pastebin\.com\/[a-zA-Z0-9]+", url) is not None:
return pastebin.resolve(url) return pastebin.resolve(url)
elif re.match("https?:\/\/(www\.)?mediafire\.com\/\?[a-z0-9]+", url) is not None:
return mediafire.resolve(url)
else: else:
return {} return {}

@ -5,3 +5,4 @@ from onechannel import *
from youtube import * from youtube import *
from filebox import * from filebox import *
from pastebin import * from pastebin import *
from mediafire import *

@ -0,0 +1,22 @@
import re, urllib2
from resolv.shared import ResolverError, unescape
def resolve(url):
try:
contents = urllib2.urlopen(url).read()
except:
raise ResolverError("Could not retrieve the specified URL.")
matches = re.search('kNO = "([^"]+)";', contents)
if matches is None:
raise ResolverError("No download was found on the given URL; the server for this file may be in maintenance mode, or the given URL may not be valid. It is also possible that you have been blocked - CAPTCHA support is not yet present.")
file_url = matches.group(1)
try:
file_title = unescape(re.search('<title>([^<]+)<\/title>', contents).group(1))
except:
raise ResolverError("Could not find the download title.")
return { 'title': file_title, 'files': { 'file': file_url } }
Loading…
Cancel
Save