Hi Guys
I'm trying to write a plugin for mediafire, but after a few days of trial and error I don't seem to be getting any further, and thought I would ask the experts
My script is as follow. I'd be grateful to anyone who could take a look for me:
I'm trying to write a plugin for mediafire, but after a few days of trial and error I don't seem to be getting any further, and thought I would ask the experts
My script is as follow. I'd be grateful to anyone who could take a look for me:
Code:
from t0mm0.common.net import Net
from urlresolver.plugnplay.interfaces import UrlResolver
from urlresolver.plugnplay.interfaces import PluginSettings
from urlresolver.plugnplay import Plugin
from urlresolver import common
import re, urllib2, os, xbmcgui, xbmc
net = Net()
error_logo = os.path.join(common.addon_path, 'resources', 'images', 'logo.png')
datapath = common.profile_path
class MediaFireResolver(Plugin, UrlResolver, PluginSettings):
implements = [UrlResolver, PluginSettings]
name = "mediafire"
def __init__(self):
p = self.get_setting('priority') or 100
self.priority = int(p)
self.net = Net()
def get_media_url(self, host, media_id):
url = self.get_url(host, media_id)
website = urllib2.urlopen(url)
html = website.read()
link = re.search(r'http://download[0-9].[\'"]?([^\'" >])+', html)
if link:
return link.groups(0)
else:
return
def get_url(self, host, media_id):
return 'http://www.mediafire.com/download/%s' % media_id
def get_host_and_id(self, url):
r = re.search('//(.+?)/([0-9a-zA-Z]+)', url)
if r:
return r.groups()
else:
return False
def valid_url(self, url, host):
return (re.match('http://(www.)?mediafire.com/download/' +
'[0-9A-Za-z]+', url) or
'mediafire' in host)