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/GoogledriveCom.py') 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 From 80f03e5c1dbb0bc6d4c20995f3a2d467dcab82c0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 3 Feb 2015 16:42:23 +0100 Subject: [GoogledriveCom] Cleanup --- module/plugins/hoster/GoogledriveCom.py | 45 ++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 18 deletions(-) (limited to 'module/plugins/hoster/GoogledriveCom.py') diff --git a/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py index d3736f219..1feb8132e 100644 --- a/module/plugins/hoster/GoogledriveCom.py +++ b/module/plugins/hoster/GoogledriveCom.py @@ -4,9 +4,9 @@ # https://drive.google.com/file/d/0B6RNTe4ygItBQm15RnJiTmMyckU/view?pli=1 import re -import HTMLParser from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.utils import html_unescape class GoogledriveCom(SimpleHoster): @@ -14,16 +14,14 @@ class GoogledriveCom(SimpleHoster): __type__ = "hoster" __version__ = "0.01" - __pattern__ = r'https?://(?:www\.)?drive.google.com/file/.*' + __pattern__ = r'https?://(?:www\.)?drive\.google\.com/file/.+' - __description__ = """drive.google.com hoster plugin""" + __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: + + else: + self.logDebug("Next hop: %s" % link1)) + + self.html = self.load(link1).decode('unicode-escape') + + try: + link2 = html_unescape(re.search(r'href="(/uc\?export=download.*?)">', + self.html).group(1)) + + except AttributeError: self.error(_("Hop #2 not found")) - link2 = HTMLParser.HTMLParser().unescape(link2.group(1)) - self.logDebug("Next hop: %s" % link2) - + + else: + 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. - - + self.link = link3['location'] #@NOTE: I don't use disposition=True because it breaks the filename. + + getInfo = create_getInfo(GoogledriveCom) -- cgit v1.2.3 From fa4df27a217171be99b9f0903768f30ee7c1298e Mon Sep 17 00:00:00 2001 From: stickell Date: Wed, 4 Feb 2015 11:10:09 +0100 Subject: [GoogledriveCom] Fixed syntax error --- module/plugins/hoster/GoogledriveCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/GoogledriveCom.py') diff --git a/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py index 1feb8132e..1fcdf8ff0 100644 --- a/module/plugins/hoster/GoogledriveCom.py +++ b/module/plugins/hoster/GoogledriveCom.py @@ -12,7 +12,7 @@ from module.utils import html_unescape class GoogledriveCom(SimpleHoster): __name__ = "GoogledriveCom" __type__ = "hoster" - __version__ = "0.01" + __version__ = "0.02" __pattern__ = r'https?://(?:www\.)?drive\.google\.com/file/.+' @@ -40,7 +40,7 @@ class GoogledriveCom(SimpleHoster): self.error(_("Hop #1 not found")) else: - self.logDebug("Next hop: %s" % link1)) + self.logDebug("Next hop: %s" % link1) self.html = self.load(link1).decode('unicode-escape') -- cgit v1.2.3 From 6616c00ba1c40f5d56959bd0e4725f26250e1292 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 9 Feb 2015 17:42:31 +0100 Subject: Spare code cosmetics --- module/plugins/hoster/GoogledriveCom.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/GoogledriveCom.py') diff --git a/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py index 1fcdf8ff0..0c8ca9c52 100644 --- a/module/plugins/hoster/GoogledriveCom.py +++ b/module/plugins/hoster/GoogledriveCom.py @@ -12,7 +12,7 @@ from module.utils import html_unescape class GoogledriveCom(SimpleHoster): __name__ = "GoogledriveCom" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" __pattern__ = r'https?://(?:www\.)?drive\.google\.com/file/.+' @@ -21,6 +21,8 @@ class GoogledriveCom(SimpleHoster): __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] + DISPOSITION = False + NAME_PATTERN = r'"og:title" content="(?P.*?)">' OFFLINE_PATTERN = r'align="center">

Date: Wed, 25 Mar 2015 23:10:07 +0100 Subject: __config__ cosmetics --- module/plugins/hoster/GoogledriveCom.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hoster/GoogledriveCom.py') diff --git a/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py index 0c8ca9c52..d07b5121e 100644 --- a/module/plugins/hoster/GoogledriveCom.py +++ b/module/plugins/hoster/GoogledriveCom.py @@ -15,6 +15,7 @@ class GoogledriveCom(SimpleHoster): __version__ = "0.03" __pattern__ = r'https?://(?:www\.)?drive\.google\.com/file/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Drive.google.com hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From ccc8e88b850846d50089f1f575a3cc2288c3a885 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 28 Mar 2015 01:59:42 +0100 Subject: [GoogledriveCom] Improve --- module/plugins/hoster/GoogledriveCom.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/GoogledriveCom.py') diff --git a/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py index d07b5121e..81926080a 100644 --- a/module/plugins/hoster/GoogledriveCom.py +++ b/module/plugins/hoster/GoogledriveCom.py @@ -12,7 +12,7 @@ from module.utils import html_unescape class GoogledriveCom(SimpleHoster): __name__ = "GoogledriveCom" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __pattern__ = r'https?://(?:www\.)?drive\.google\.com/file/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -22,7 +22,7 @@ class GoogledriveCom(SimpleHoster): __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] - DISPOSITION = False + DISPOSITION = False #: Remove in 0.4.10 NAME_PATTERN = r'"og:title" content="(?P.*?)">' OFFLINE_PATTERN = r'align="center">

Date: Mon, 30 Mar 2015 01:08:22 +0200 Subject: [GoogledriveCom] Fix handleDirect --- module/plugins/hoster/GoogledriveCom.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/GoogledriveCom.py') diff --git a/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py index 81926080a..57a5ab7fb 100644 --- a/module/plugins/hoster/GoogledriveCom.py +++ b/module/plugins/hoster/GoogledriveCom.py @@ -12,7 +12,7 @@ from module.utils import html_unescape class GoogledriveCom(SimpleHoster): __name__ = "GoogledriveCom" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __pattern__ = r'https?://(?:www\.)?drive\.google\.com/file/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -39,8 +39,8 @@ class GoogledriveCom(SimpleHoster): self.link = self.directLink(pyfile.url, self.resumeDownload) if self.link: - remote = urllib2.urlopen(link) - name = remote.info()['Content-Disposition'].split(';') + remote = urllib2.urlopen(self.link) + name = remote.info()['Content-Disposition'].split(';') pyfile.name = name[1].split('filename=')[1][1:] -- cgit v1.2.3 From 0c86984827d60e0a94d8152df55a16d232020336 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 30 Mar 2015 19:11:33 +0200 Subject: [GoogledriveCom][UlozTo] Fix handleDirect (2) --- module/plugins/hoster/GoogledriveCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/GoogledriveCom.py') diff --git a/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py index 57a5ab7fb..bb4a5d1d4 100644 --- a/module/plugins/hoster/GoogledriveCom.py +++ b/module/plugins/hoster/GoogledriveCom.py @@ -12,7 +12,7 @@ from module.utils import html_unescape class GoogledriveCom(SimpleHoster): __name__ = "GoogledriveCom" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __pattern__ = r'https?://(?:www\.)?drive\.google\.com/file/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -41,7 +41,7 @@ class GoogledriveCom(SimpleHoster): if self.link: remote = urllib2.urlopen(self.link) name = remote.info()['Content-Disposition'].split(';') - pyfile.name = name[1].split('filename=')[1][1:] + pyfile.name = name[1].split('filename=')[1][1:-1] def handleFree(self, pyfile): -- cgit v1.2.3 From fcaf6c9e4c5c618b8c2741ca7ee5676787b4c3f0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 31 Mar 2015 23:58:33 +0200 Subject: Temp fixup to `filename*=UTF-8` bug --- module/plugins/hoster/GoogledriveCom.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'module/plugins/hoster/GoogledriveCom.py') diff --git a/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py index bb4a5d1d4..66f36e6c0 100644 --- a/module/plugins/hoster/GoogledriveCom.py +++ b/module/plugins/hoster/GoogledriveCom.py @@ -12,7 +12,7 @@ from module.utils import html_unescape class GoogledriveCom(SimpleHoster): __name__ = "GoogledriveCom" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" __pattern__ = r'https?://(?:www\.)?drive\.google\.com/file/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -22,8 +22,6 @@ class GoogledriveCom(SimpleHoster): __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] - DISPOSITION = False #: Remove in 0.4.10 - NAME_PATTERN = r'"og:title" content="(?P.*?)">' OFFLINE_PATTERN = r'align="center">

Date: Mon, 4 May 2015 21:31:34 +0200 Subject: [GoogledriveCom][OneFichierCom][UlozTo] Reset DISPOSITION to False --- module/plugins/hoster/GoogledriveCom.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'module/plugins/hoster/GoogledriveCom.py') diff --git a/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py index 66f36e6c0..09c54a8da 100644 --- a/module/plugins/hoster/GoogledriveCom.py +++ b/module/plugins/hoster/GoogledriveCom.py @@ -12,7 +12,7 @@ from module.utils import html_unescape class GoogledriveCom(SimpleHoster): __name__ = "GoogledriveCom" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.08" __pattern__ = r'https?://(?:www\.)?drive\.google\.com/file/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -22,6 +22,8 @@ class GoogledriveCom(SimpleHoster): __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] + DISPOSITION = False #: Remove in 0.4.10 + NAME_PATTERN = r'"og:title" content="(?P.*?)">' OFFLINE_PATTERN = r'align="center">

Date: Mon, 25 May 2015 13:52:28 +0200 Subject: [GoogledriveCom] Improve __pattern__ --- module/plugins/hoster/GoogledriveCom.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/GoogledriveCom.py') diff --git a/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py index 09c54a8da..c7830b734 100644 --- a/module/plugins/hoster/GoogledriveCom.py +++ b/module/plugins/hoster/GoogledriveCom.py @@ -4,6 +4,7 @@ # https://drive.google.com/file/d/0B6RNTe4ygItBQm15RnJiTmMyckU/view?pli=1 import re +import urlparse from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo from module.utils import html_unescape @@ -12,9 +13,9 @@ from module.utils import html_unescape class GoogledriveCom(SimpleHoster): __name__ = "GoogledriveCom" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" - __pattern__ = r'https?://(?:www\.)?drive\.google\.com/file/.+' + __pattern__ = r'https?://(?:www\.)?(drive|docs)\.google\.com/file/d/\w+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Drive.google.com hoster plugin""" @@ -57,7 +58,7 @@ class GoogledriveCom(SimpleHoster): else: self.logDebug("Next hop: %s" % link2) - link3 = self.load("https://docs.google.com" + link2, just_header=True) + link3 = self.load(urlparse.urljoin("https://docs.google.com", link2), just_header=True) self.logDebug("DL-Link: %s" % link3['location']) self.link = link3['location'] -- cgit v1.2.3 From 7e65484b60890bbfa39aa7631343dcfb5c379cf9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 26 May 2015 01:25:05 +0200 Subject: [GoogledriveCom] Fixup --- module/plugins/hoster/GoogledriveCom.py | 47 ++++++++++++++------------------- 1 file changed, 20 insertions(+), 27 deletions(-) (limited to 'module/plugins/hoster/GoogledriveCom.py') diff --git a/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py index c7830b734..5a8862e6b 100644 --- a/module/plugins/hoster/GoogledriveCom.py +++ b/module/plugins/hoster/GoogledriveCom.py @@ -13,7 +13,7 @@ from module.utils import html_unescape class GoogledriveCom(SimpleHoster): __name__ = "GoogledriveCom" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" __pattern__ = r'https?://(?:www\.)?(drive|docs)\.google\.com/file/d/\w+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -28,6 +28,8 @@ class GoogledriveCom(SimpleHoster): NAME_PATTERN = r'"og:title" content="(?P.*?)">' OFFLINE_PATTERN = r'align="center">

', - self.html).group(1)) - - except AttributeError: - self.error(_("Hop #2 not found")) - - else: - self.logDebug("Next hop: %s" % link2) - - link3 = self.load(urlparse.urljoin("https://docs.google.com", link2), just_header=True) - self.logDebug("DL-Link: %s" % link3['location']) - - self.link = link3['location'] + for _i in xrange(2): + m = re.search(self.LINK_FREE_PATTERN, self.html) + + if m is None: + self.error(_("Free download link not found")) + + else: + link = html_unescape(m.group(1).decode('unicode-escape')) + if not urlparse.urlparse(link).scheme: + link = urlparse.urljoin("https://docs.google.com/", link) + + direct_link = self.directLink(link, False) + if not direct_link: + self.html = self.load(link, decode=True) + else: + self.link = direct_link + break getInfo = create_getInfo(GoogledriveCom) -- cgit v1.2.3 From b150e9d731213410345628f06c1182a662e63ec5 Mon Sep 17 00:00:00 2001 From: zapp-brannigan Date: Wed, 27 May 2015 14:58:22 +0200 Subject: [GoogledriveCom] Make it more flexible Support links like ` https://drive.google.com/uc?export=download&id= ` See forum: http://forum.pyload.org/viewtopic.php?f=13&t=4203 --- module/plugins/hoster/GoogledriveCom.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/GoogledriveCom.py') diff --git a/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py index 5a8862e6b..871ce0f2b 100644 --- a/module/plugins/hoster/GoogledriveCom.py +++ b/module/plugins/hoster/GoogledriveCom.py @@ -13,9 +13,9 @@ from module.utils import html_unescape class GoogledriveCom(SimpleHoster): __name__ = "GoogledriveCom" __type__ = "hoster" - __version__ = "0.10" + __version__ = "0.11" - __pattern__ = r'https?://(?:www\.)?(drive|docs)\.google\.com/file/d/\w+' + __pattern__ = r'https?://(?:www\.)?(drive|docs)\.google\.com/(file/d/\w+|uc.+?)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Drive.google.com hoster plugin""" @@ -38,6 +38,10 @@ class GoogledriveCom(SimpleHoster): def handleFree(self, pyfile): + if "export=download" in self.pyfile.url: + dl_id = self.pyfile.url.split("id=")[1] + self.html = self.load("https://docs.google.com/file/d/%s/edit" %dl_id) + self.pyfile.name = re.search(self.NAME_PATTERN,self.html).group(1) for _i in xrange(2): m = re.search(self.LINK_FREE_PATTERN, self.html) -- cgit v1.2.3 From 46781a7b3b2ec464e48e2629ab7f23412f9aa5b6 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 28 May 2015 00:05:49 +0200 Subject: [GoogledriveCom][MediafireCom] Cleanup --- module/plugins/hoster/GoogledriveCom.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'module/plugins/hoster/GoogledriveCom.py') diff --git a/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py index 871ce0f2b..1c33a1e4e 100644 --- a/module/plugins/hoster/GoogledriveCom.py +++ b/module/plugins/hoster/GoogledriveCom.py @@ -13,9 +13,9 @@ from module.utils import html_unescape class GoogledriveCom(SimpleHoster): __name__ = "GoogledriveCom" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.12" - __pattern__ = r'https?://(?:www\.)?(drive|docs)\.google\.com/(file/d/\w+|uc.+?)' + __pattern__ = r'https?://(?:www\.)?(drive|docs)\.google\.com/(file/d/\w+|uc\?.*id=)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Drive.google.com hoster plugin""" @@ -25,7 +25,7 @@ class GoogledriveCom(SimpleHoster): DISPOSITION = False #: Remove in 0.4.10 - NAME_PATTERN = r'"og:title" content="(?P.*?)">' + NAME_PATTERN = r'(?:|class="uc-name-size".*>)(?P<N>.+?)(?: - Google Drive| \()' OFFLINE_PATTERN = r'align="center">