From ffbb4e011d2bb54c5f764eeb35bdd177adec098a Mon Sep 17 00:00:00 2001 From: zapp-brannigan Date: Tue, 3 Feb 2015 13:16:36 +0100 Subject: [New Hoster] drive.google.com A simple plugin to download public shared files from drive.google.com --- module/plugins/hoster/GoogledriveCom.py | 54 +++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 module/plugins/hoster/GoogledriveCom.py (limited to 'module/plugins/hoster') diff --git a/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py new file mode 100644 index 000000000..d3736f219 --- /dev/null +++ b/module/plugins/hoster/GoogledriveCom.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -* +# +# Test links: +# https://drive.google.com/file/d/0B6RNTe4ygItBQm15RnJiTmMyckU/view?pli=1 + +import re +import HTMLParser + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class GoogledriveCom(SimpleHoster): + __name__ = "GoogledriveCom" + __type__ = "hoster" + __version__ = "0.01" + + __pattern__ = r'https?://(?:www\.)?drive.google.com/file/.*' + + __description__ = """drive.google.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] + + + NAME_PATTERN = r'"og:title" content="(?P.*?)">' + SIZE_PATTERN = r'^unmatchable$' # NOTE: There is no filesize on the website + + OFFLINE_PATTERN = r'align="center">

',html) + if not link2: + self.error(_("Hop #2 not found")) + link2 = HTMLParser.HTMLParser().unescape(link2.group(1)) + self.logDebug("Next hop: %s" % link2) + + link3 = self.load("https://docs.google.com" + link2, just_header=True) + self.logDebug("DL-Link: %s" % link3['location']) + + self.download(link3['location']) # NOTE: I don't use disposition=True because it breaks the filename. + + +getInfo = create_getInfo(GoogledriveCom) -- cgit v1.2.3