MCPcopy
hub / github.com/pyload/pyload / process

Method process

module/plugins/hoster/GoogledriveCom.py:81–124  ·  view source on GitHub ↗
(self, pyfile)

Source from the content-addressed store, hash-verified

79 raise
80
81 def process(self, pyfile):
82 json_data = self.api_response("files/" + self.info['pattern']['ID'], fields="md5Checksum,name,size")
83
84 if json_data is None:
85 self.fail("API error")
86
87 if 'error' in json_data:
88 if json_data['error']['code'] == 404:
89 self.offline()
90
91 else:
92 self.fail(json_data['error']['message'])
93
94 pyfile.size = int(json_data['size'])
95 pyfile.name = json_data['name']
96 self.info['md5'] = json_data['md5Checksum']
97
98 # Somehow, API downloads are sacrificially slow compared to "normal" download :(
99 # self.api_download()
100
101 self.data = self.load(pyfile.url)
102 for _i in range(2):
103 m = re.search(r'"([^"]+uc\?.*?)"', self.data)
104 if m is None:
105 if "Quota exceeded" in self.data:
106 self.temp_offline()
107 else:
108 self.fail(_("link pattern not found"))
109
110 link = urlparse.urljoin(pyfile.url, m.group(1).decode('unicode-escape'))
111
112 #: "Only files smaller than 100 MB can be scanned for viruses"
113 #: https://support.google.com/a/answer/172541?hl=en
114 if pyfile.size > 104857600:
115 if re.search(r'/uc\?.*&confirm=', link):
116 self.download(link, disposition=False)
117 return
118
119 else:
120 self.data = self.load(link)
121
122 else:
123 self.download(link, disposition=False)
124 return

Callers

nothing calls this directly

Calls 9

api_responseMethod · 0.95
temp_offlineMethod · 0.80
decodeMethod · 0.80
_Function · 0.50
failMethod · 0.45
offlineMethod · 0.45
loadMethod · 0.45
searchMethod · 0.45
downloadMethod · 0.45

Tested by

no test coverage detected