We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[OneFichierCom]Non restricted file
Hello, i try to download little files on 1fichier( like this : ) but i cannot

```
ff^[^[^[^[^[^[19.08.2015 07:59:13 INFO      Added package Nonrestricted file containing 1 links
19.08.2015 07:59:13 DEBUG     Run Info Fetching for OneFichierCom
19.08.2015 07:59:14 INFO      Download starts: https://1fichier.com/?86zu29oou8
19.08.2015 07:59:14 DEBUG     HOOK UserAgentSwitcher: Use custom user-agent string: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0
19.08.2015 07:59:14 DEBUG     HOOK UserAgentSwitcher: Use custom user-agent string: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0
19.08.2015 07:59:14 DEBUG     HOSTER OneFichierCom[126]: PROCESS URL https://1fichier.com/?86zu29oou8 | PLUGIN VERSION 0.88
19.08.2015 07:59:14 INFO      HOSTER OneFichierCom[126]: Updating file info...
Traceback (most recent call last):
  File "/usr/share/pyload/module/network/HTTPRequest.py", line 279, in write
    raise Exception("Loaded Url exceeded limit")
Exception: Loaded Url exceeded limit
19.08.2015 07:59:15 DEBUG     Finished Info Fetching for OneFichierCom
Traceback (most recent call last):
  File "/usr/share/pyload/module/network/HTTPRequest.py", line 279, in write
    raise Exception("Loaded Url exceeded limit")
Exception: Loaded Url exceeded limit
19.08.2015 07:59:17 DEBUG     HOSTER OneFichierCom[126]: File info: {'status': 3, 'url': u'https://1fichier.com/?86zu29oou8', 'size': 0, 'name': u'86zu29oou8', 'pattern': {'HOST': u'1fichier.com', 'ID2': u'86zu29oou8', 'ID1': None}}
19.08.2015 07:59:17 DEBUG     HOSTER OneFichierCom[126]: Previous file info: {}
19.08.2015 07:59:17 INFO      HOSTER OneFichierCom[126]: File name: 86zu29oou8
19.08.2015 07:59:17 INFO      HOSTER OneFichierCom[126]: File size: Unknown
19.08.2015 07:59:17 INFO      HOSTER OneFichierCom[126]: File status: queued
19.08.2015 07:59:17 INFO      HOSTER OneFichierCom[126]: Looking for direct download link...
19.08.2015 07:59:17 DEBUG     HOSTER OneFichierCom[126]: Redirect #0 to: https://1fichier.com/?86zu29oou8
19.08.2015 07:59:17 DEBUG     HOSTER OneFichierCom[126]: LOAD URL https://1fichier.com/?86zu29oou8 | cookies=True | get={} | req=None | decode=True | multipart=False | post={} | ref=True | just_header=True
19.08.2015 07:59:17 DEBUG     HOSTER OneFichierCom[126]: Redirect #1 to: https://a-9.1fichier.com/s25134576
19.08.2015 07:59:17 DEBUG     HOSTER OneFichierCom[126]: LOAD URL https://a-9.1fichier.com/s25134576 | cookies=True | get={} | req=None | decode=True | multipart=False | post={} | ref=True | just_header=True
19.08.2015 07:59:19 INFO      HOSTER OneFichierCom[126]: Direct download link detected
19.08.2015 07:59:19 INFO      HOSTER OneFichierCom[126]: Downloading file...
19.08.2015 07:59:19 DEBUG     HOSTER OneFichierCom[126]: DOWNLOAD URL https://a-9.1fichier.com/s25134576 | cookies=True | get={} | disposition=True | post={} | ref=True
19.08.2015 07:59:20 INFO      HOSTER OneFichierCom[126]: Checking file...
19.08.2015 07:59:20 DEBUG     HOSTER OneFichierCom[126]: Using default check rules...
19.08.2015 07:59:20 WARNING   HOSTER OneFichierCom[126]: Check result: Html file | Waiting 1 minute and retry
19.08.2015 07:59:20 INFO      HOSTER OneFichierCom[126]: WAIT 60 seconds
19.08.2015 07:59:20 DEBUG     HOSTER OneFichierCom[126]: Previous waitUntil: 0.000000
19.08.2015 07:59:20 INFO      HOSTER OneFichierCom[126]: RECONNECT disabled
19.08.2015 07:59:20 DEBUG     HOSTER OneFichierCom[126]: Previous wantReconnect: True
19.08.2015 07:59:20 WARNING   HOSTER OneFichierCom[126]: Ignore reconnection due logged account
```

curl : 

```
curl 7.26.0 (arm-unknown-linux-gnueabihf) libcurl/7.26.0 OpenSSL/1.0.1e zlib/1.2.7 libidn/1.25 libssh2/1.4.2 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtmp rtsp scp sftp smtp smtps telnet tftp 
Features: Debug GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP
```

OS : Raspberry Rasbian 7

```
greg@serveur-pi ~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 7 (wheezy)"
NAME="Raspbian GNU/Linux"
VERSION_ID="7"
VERSION="7 (wheezy)"
ID=raspbian
ID_LIKE=debian
ANSI_COLOR="1;31"
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `module/plugins/hoster/OneFichierCom.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 
3 import re
4 
5 from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
6 
7 
8 class OneFichierCom(SimpleHoster):
9     __name__    = "OneFichierCom"
10     __type__    = "hoster"
11     __version__ = "0.88"
12     __status__  = "testing"
13 
14     __pattern__ = r'https?://(?:www\.)?(?:(?P<ID1>\w+)\.)?(?P<HOST>1fichier\.com|alterupload\.com|cjoint\.net|d(es)?fichiers\.com|dl4free\.com|megadl\.fr|mesfichiers\.org|piecejointe\.net|pjointe\.com|tenvoi\.com)(?:/\?(?P<ID2>\w+))?'
15     __config__  = [("use_premium", "bool", "Use premium account if available", True)]
16 
17     __description__ = """1fichier.com hoster plugin"""
18     __license__     = "GPLv3"
19     __authors__     = [("fragonib", "fragonib[AT]yahoo[DOT]es"),
20                        ("the-razer", "daniel_ AT gmx DOT net"),
21                        ("zoidberg", "zoidberg@mujmail.cz"),
22                        ("imclem", None),
23                        ("stickell", "l.stickell@yahoo.it"),
24                        ("Elrick69", "elrick69[AT]rocketmail[DOT]com"),
25                        ("Walter Purcaro", "vuolter@gmail.com"),
26                        ("Ludovic Lehmann", "ludo.lehmann@gmail.com")]
27 
28 
29     COOKIES     = [("1fichier.com", "LG", "en")]
30 
31     NAME_PATTERN    = r'>File\s*Name :</td>\s*<td.*>(?P<N>.+?)<'
32     SIZE_PATTERN    = r'>Size :</td>\s*<td.*>(?P<S>[\d.,]+) (?P<U>[\w^_]+)'
33     OFFLINE_PATTERN = r'File not found !\s*<'
34 
35     WAIT_PATTERN = r'>You must wait \d+ minutes'
36 
37 
38     def setup(self):
39         self.multiDL        = self.premium
40         self.resume_download = True
41 
42 
43     def handle_free(self, pyfile):
44         id = self.info['pattern']['ID1'] or self.info['pattern']['ID2']
45         url, inputs = self.parse_html_form('action="https://1fichier.com/\?%s' % id)
46 
47         if not url:
48             self.fail(_("Download link not found"))
49 
50         if "pass" in inputs:
51             inputs['pass'] = self.get_password()
52 
53         inputs['submit'] = "Download"
54 
55         self.download(url, post=inputs)
56 
57 
58     def handle_premium(self, pyfile):
59         self.download(pyfile.url, post={'dl': "Download", 'did': 0})
60 
61 
62 getInfo = create_getInfo(OneFichierCom)
63
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py
--- a/module/plugins/hoster/OneFichierCom.py
+++ b/module/plugins/hoster/OneFichierCom.py
@@ -2,13 +2,14 @@
 
 import re
 
+from module.network.RequestFactory import getURL as get_url
 from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
 
 
 class OneFichierCom(SimpleHoster):
     __name__    = "OneFichierCom"
     __type__    = "hoster"
-    __version__ = "0.88"
+    __version__ = "0.89"
     __status__  = "testing"
 
     __pattern__ = r'https?://(?:www\.)?(?:(?P<ID1>\w+)\.)?(?P<HOST>1fichier\.com|alterupload\.com|cjoint\.net|d(es)?fichiers\.com|dl4free\.com|megadl\.fr|mesfichiers\.org|piecejointe\.net|pjointe\.com|tenvoi\.com)(?:/\?(?P<ID2>\w+))?'
@@ -28,6 +29,8 @@
 
     COOKIES     = [("1fichier.com", "LG", "en")]
 
+    DIRECT_LINK = True
+
     NAME_PATTERN    = r'>File\s*Name :</td>\s*<td.*>(?P<N>.+?)<'
     SIZE_PATTERN    = r'>Size :</td>\s*<td.*>(?P<S>[\d.,]+) (?P<U>[\w^_]+)'
     OFFLINE_PATTERN = r'File not found !\s*<'
@@ -40,7 +43,61 @@
         self.resume_download = True
 
 
+    @classmethod
+    def get_info(cls, url="", html=""):
+        redirect = url
+        for i in xrange(10):
+            try:
+                headers = dict(re.findall(r"(?P<name>.+?): (?P<value>.+?)\r?\n", get_url(redirect, just_header=True).lower()))
+                if 'location' in headers and headers['location']:
+                    redirect = headers['location']
+                else:
+                    if 'content-type' in headers and headers['content-type'] == "application/octet-stream":
+                        if "filename=" in headers.get('content-disposition'):
+                            name = dict(_i.split("=") for _i in map(str.strip, headers['content-disposition'].split(";"))[1:]['filename'].strip("\"'")
+                        else:
+                            name = url
+
+                        info = {'name'  : name,
+                                'size'  : long(headers.get('content-length')),
+                                'status': 3,
+                                'url'   : url}
+
+                    else:
+                        info = super(OneFichierCom, cls).get_info(url, html)
+
+                    break
+
+            except Exception, e:
+                info = {'status' : 8,
+                        'error'  : e.message}
+
+        else:
+            info = {'status' : 8,
+                    'error'    : _("Too many redirects")}
+
+        return info
+
+
+    def handle_direct(self, pyfile):
+        redirect = pyfile.url
+        for i in xrange(self.get_config("maxredirs", plugin="UserAgentSwitcher")):
+
+            headers = self.load(redirect, just_header=True)
+            if 'location' in headers and headers['location']:
+                self.log_debug("Redirect #%d to: %s" % (i, redirect))
+                redirect = headers['location']
+            else:
+                if 'content-type' in headers and headers['content-type'] == "application/octet-stream":
+                    self.link = pyfile.url
+                break
+        else:
+            self.fail(_("Too many redirects"))
+
+
     def handle_free(self, pyfile):
+        self.check_errors()
+
         id = self.info['pattern']['ID1'] or self.info['pattern']['ID2']
         url, inputs = self.parse_html_form('action="https://1fichier.com/\?%s' % id)

{"golden_diff": "diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py\n--- a/module/plugins/hoster/OneFichierCom.py\n+++ b/module/plugins/hoster/OneFichierCom.py\n@@ -2,13 +2,14 @@\n \n import re\n \n+from module.network.RequestFactory import getURL as get_url\n from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo\n \n \n class OneFichierCom(SimpleHoster):\n     __name__    = \"OneFichierCom\"\n     __type__    = \"hoster\"\n-    __version__ = \"0.88\"\n+    __version__ = \"0.89\"\n     __status__  = \"testing\"\n \n     __pattern__ = r'https?://(?:www\\.)?(?:(?P<ID1>\\w+)\\.)?(?P<HOST>1fichier\\.com|alterupload\\.com|cjoint\\.net|d(es)?fichiers\\.com|dl4free\\.com|megadl\\.fr|mesfichiers\\.org|piecejointe\\.net|pjointe\\.com|tenvoi\\.com)(?:/\\?(?P<ID2>\\w+))?'\n@@ -28,6 +29,8 @@\n \n     COOKIES     = [(\"1fichier.com\", \"LG\", \"en\")]\n \n+    DIRECT_LINK = True\n+\n     NAME_PATTERN    = r'>File\\s*Name :</td>\\s*<td.*>(?P<N>.+?)<'\n     SIZE_PATTERN    = r'>Size :</td>\\s*<td.*>(?P<S>[\\d.,]+) (?P<U>[\\w^_]+)'\n     OFFLINE_PATTERN = r'File not found !\\s*<'\n@@ -40,7 +43,61 @@\n         self.resume_download = True\n \n \n+    @classmethod\n+    def get_info(cls, url=\"\", html=\"\"):\n+        redirect = url\n+        for i in xrange(10):\n+            try:\n+                headers = dict(re.findall(r\"(?P<name>.+?): (?P<value>.+?)\\r?\\n\", get_url(redirect, just_header=True).lower()))\n+                if 'location' in headers and headers['location']:\n+                    redirect = headers['location']\n+                else:\n+                    if 'content-type' in headers and headers['content-type'] == \"application/octet-stream\":\n+                        if \"filename=\" in headers.get('content-disposition'):\n+                            name = dict(_i.split(\"=\") for _i in map(str.strip, headers['content-disposition'].split(\";\"))[1:]['filename'].strip(\"\\\"'\")\n+                        else:\n+                            name = url\n+\n+                        info = {'name'  : name,\n+                                'size'  : long(headers.get('content-length')),\n+                                'status': 3,\n+                                'url'   : url}\n+\n+                    else:\n+                        info = super(OneFichierCom, cls).get_info(url, html)\n+\n+                    break\n+\n+            except Exception, e:\n+                info = {'status' : 8,\n+                        'error'  : e.message}\n+\n+        else:\n+            info = {'status' : 8,\n+                    'error'    : _(\"Too many redirects\")}\n+\n+        return info\n+\n+\n+    def handle_direct(self, pyfile):\n+        redirect = pyfile.url\n+        for i in xrange(self.get_config(\"maxredirs\", plugin=\"UserAgentSwitcher\")):\n+\n+            headers = self.load(redirect, just_header=True)\n+            if 'location' in headers and headers['location']:\n+                self.log_debug(\"Redirect #%d to: %s\" % (i, redirect))\n+                redirect = headers['location']\n+            else:\n+                if 'content-type' in headers and headers['content-type'] == \"application/octet-stream\":\n+                    self.link = pyfile.url\n+                break\n+        else:\n+            self.fail(_(\"Too many redirects\"))\n+\n+\n     def handle_free(self, pyfile):\n+        self.check_errors()\n+\n         id = self.info['pattern']['ID1'] or self.info['pattern']['ID2']\n         url, inputs = self.parse_html_form('action=\"https://1fichier.com/\\?%s' % id)\n", "issue": "[OneFichierCom]Non restricted file\nHello, i try to download little files on 1fichier( like this : ) but i cannot\n\n```\nff^[^[^[^[^[^[19.08.2015 07:59:13 INFO      Added package Nonrestricted file containing 1 links\n19.08.2015 07:59:13 DEBUG     Run Info Fetching for OneFichierCom\n19.08.2015 07:59:14 INFO      Download starts: https://1fichier.com/?86zu29oou8\n19.08.2015 07:59:14 DEBUG     HOOK UserAgentSwitcher: Use custom user-agent string: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0\n19.08.2015 07:59:14 DEBUG     HOOK UserAgentSwitcher: Use custom user-agent string: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0\n19.08.2015 07:59:14 DEBUG     HOSTER OneFichierCom[126]: PROCESS URL https://1fichier.com/?86zu29oou8 | PLUGIN VERSION 0.88\n19.08.2015 07:59:14 INFO      HOSTER OneFichierCom[126]: Updating file info...\nTraceback (most recent call last):\n  File \"/usr/share/pyload/module/network/HTTPRequest.py\", line 279, in write\n    raise Exception(\"Loaded Url exceeded limit\")\nException: Loaded Url exceeded limit\n19.08.2015 07:59:15 DEBUG     Finished Info Fetching for OneFichierCom\nTraceback (most recent call last):\n  File \"/usr/share/pyload/module/network/HTTPRequest.py\", line 279, in write\n    raise Exception(\"Loaded Url exceeded limit\")\nException: Loaded Url exceeded limit\n19.08.2015 07:59:17 DEBUG     HOSTER OneFichierCom[126]: File info: {'status': 3, 'url': u'https://1fichier.com/?86zu29oou8', 'size': 0, 'name': u'86zu29oou8', 'pattern': {'HOST': u'1fichier.com', 'ID2': u'86zu29oou8', 'ID1': None}}\n19.08.2015 07:59:17 DEBUG     HOSTER OneFichierCom[126]: Previous file info: {}\n19.08.2015 07:59:17 INFO      HOSTER OneFichierCom[126]: File name: 86zu29oou8\n19.08.2015 07:59:17 INFO      HOSTER OneFichierCom[126]: File size: Unknown\n19.08.2015 07:59:17 INFO      HOSTER OneFichierCom[126]: File status: queued\n19.08.2015 07:59:17 INFO      HOSTER OneFichierCom[126]: Looking for direct download link...\n19.08.2015 07:59:17 DEBUG     HOSTER OneFichierCom[126]: Redirect #0 to: https://1fichier.com/?86zu29oou8\n19.08.2015 07:59:17 DEBUG     HOSTER OneFichierCom[126]: LOAD URL https://1fichier.com/?86zu29oou8 | cookies=True | get={} | req=None | decode=True | multipart=False | post={} | ref=True | just_header=True\n19.08.2015 07:59:17 DEBUG     HOSTER OneFichierCom[126]: Redirect #1 to: https://a-9.1fichier.com/s25134576\n19.08.2015 07:59:17 DEBUG     HOSTER OneFichierCom[126]: LOAD URL https://a-9.1fichier.com/s25134576 | cookies=True | get={} | req=None | decode=True | multipart=False | post={} | ref=True | just_header=True\n19.08.2015 07:59:19 INFO      HOSTER OneFichierCom[126]: Direct download link detected\n19.08.2015 07:59:19 INFO      HOSTER OneFichierCom[126]: Downloading file...\n19.08.2015 07:59:19 DEBUG     HOSTER OneFichierCom[126]: DOWNLOAD URL https://a-9.1fichier.com/s25134576 | cookies=True | get={} | disposition=True | post={} | ref=True\n19.08.2015 07:59:20 INFO      HOSTER OneFichierCom[126]: Checking file...\n19.08.2015 07:59:20 DEBUG     HOSTER OneFichierCom[126]: Using default check rules...\n19.08.2015 07:59:20 WARNING   HOSTER OneFichierCom[126]: Check result: Html file | Waiting 1 minute and retry\n19.08.2015 07:59:20 INFO      HOSTER OneFichierCom[126]: WAIT 60 seconds\n19.08.2015 07:59:20 DEBUG     HOSTER OneFichierCom[126]: Previous waitUntil: 0.000000\n19.08.2015 07:59:20 INFO      HOSTER OneFichierCom[126]: RECONNECT disabled\n19.08.2015 07:59:20 DEBUG     HOSTER OneFichierCom[126]: Previous wantReconnect: True\n19.08.2015 07:59:20 WARNING   HOSTER OneFichierCom[126]: Ignore reconnection due logged account\n```\n\ncurl : \n\n```\ncurl 7.26.0 (arm-unknown-linux-gnueabihf) libcurl/7.26.0 OpenSSL/1.0.1e zlib/1.2.7 libidn/1.25 libssh2/1.4.2 librtmp/2.3\nProtocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtmp rtsp scp sftp smtp smtps telnet tftp \nFeatures: Debug GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP\n```\n\nOS : Raspberry Rasbian 7\n\n```\ngreg@serveur-pi ~ $ cat /etc/os-release\nPRETTY_NAME=\"Raspbian GNU/Linux 7 (wheezy)\"\nNAME=\"Raspbian GNU/Linux\"\nVERSION_ID=\"7\"\nVERSION=\"7 (wheezy)\"\nID=raspbian\nID_LIKE=debian\nANSI_COLOR=\"1;31\"\nHOME_URL=\"http://www.raspbian.org/\"\nSUPPORT_URL=\"http://www.raspbian.org/RaspbianForums\"\nBUG_REPORT_URL=\"http://www.raspbian.org/RaspbianBugs\"\n```\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\nimport re\n\nfrom module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo\n\n\nclass OneFichierCom(SimpleHoster):\n    __name__    = \"OneFichierCom\"\n    __type__    = \"hoster\"\n    __version__ = \"0.88\"\n    __status__  = \"testing\"\n\n    __pattern__ = r'https?://(?:www\\.)?(?:(?P<ID1>\\w+)\\.)?(?P<HOST>1fichier\\.com|alterupload\\.com|cjoint\\.net|d(es)?fichiers\\.com|dl4free\\.com|megadl\\.fr|mesfichiers\\.org|piecejointe\\.net|pjointe\\.com|tenvoi\\.com)(?:/\\?(?P<ID2>\\w+))?'\n    __config__  = [(\"use_premium\", \"bool\", \"Use premium account if available\", True)]\n\n    __description__ = \"\"\"1fichier.com hoster plugin\"\"\"\n    __license__     = \"GPLv3\"\n    __authors__     = [(\"fragonib\", \"fragonib[AT]yahoo[DOT]es\"),\n                       (\"the-razer\", \"daniel_ AT gmx DOT net\"),\n                       (\"zoidberg\", \"zoidberg@mujmail.cz\"),\n                       (\"imclem\", None),\n                       (\"stickell\", \"l.stickell@yahoo.it\"),\n                       (\"Elrick69\", \"elrick69[AT]rocketmail[DOT]com\"),\n                       (\"Walter Purcaro\", \"vuolter@gmail.com\"),\n                       (\"Ludovic Lehmann\", \"ludo.lehmann@gmail.com\")]\n\n\n    COOKIES     = [(\"1fichier.com\", \"LG\", \"en\")]\n\n    NAME_PATTERN    = r'>File\\s*Name :</td>\\s*<td.*>(?P<N>.+?)<'\n    SIZE_PATTERN    = r'>Size :</td>\\s*<td.*>(?P<S>[\\d.,]+) (?P<U>[\\w^_]+)'\n    OFFLINE_PATTERN = r'File not found !\\s*<'\n\n    WAIT_PATTERN = r'>You must wait \\d+ minutes'\n\n\n    def setup(self):\n        self.multiDL        = self.premium\n        self.resume_download = True\n\n\n    def handle_free(self, pyfile):\n        id = self.info['pattern']['ID1'] or self.info['pattern']['ID2']\n        url, inputs = self.parse_html_form('action=\"https://1fichier.com/\\?%s' % id)\n\n        if not url:\n            self.fail(_(\"Download link not found\"))\n\n        if \"pass\" in inputs:\n            inputs['pass'] = self.get_password()\n\n        inputs['submit'] = \"Download\"\n\n        self.download(url, post=inputs)\n\n\n    def handle_premium(self, pyfile):\n        self.download(pyfile.url, post={'dl': \"Download\", 'did': 0})\n\n\ngetInfo = create_getInfo(OneFichierCom)\n", "path": "module/plugins/hoster/OneFichierCom.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\nimport re\n\nfrom module.network.RequestFactory import getURL as get_url\nfrom module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo\n\n\nclass OneFichierCom(SimpleHoster):\n    __name__    = \"OneFichierCom\"\n    __type__    = \"hoster\"\n    __version__ = \"0.89\"\n    __status__  = \"testing\"\n\n    __pattern__ = r'https?://(?:www\\.)?(?:(?P<ID1>\\w+)\\.)?(?P<HOST>1fichier\\.com|alterupload\\.com|cjoint\\.net|d(es)?fichiers\\.com|dl4free\\.com|megadl\\.fr|mesfichiers\\.org|piecejointe\\.net|pjointe\\.com|tenvoi\\.com)(?:/\\?(?P<ID2>\\w+))?'\n    __config__  = [(\"use_premium\", \"bool\", \"Use premium account if available\", True)]\n\n    __description__ = \"\"\"1fichier.com hoster plugin\"\"\"\n    __license__     = \"GPLv3\"\n    __authors__     = [(\"fragonib\", \"fragonib[AT]yahoo[DOT]es\"),\n                       (\"the-razer\", \"daniel_ AT gmx DOT net\"),\n                       (\"zoidberg\", \"zoidberg@mujmail.cz\"),\n                       (\"imclem\", None),\n                       (\"stickell\", \"l.stickell@yahoo.it\"),\n                       (\"Elrick69\", \"elrick69[AT]rocketmail[DOT]com\"),\n                       (\"Walter Purcaro\", \"vuolter@gmail.com\"),\n                       (\"Ludovic Lehmann\", \"ludo.lehmann@gmail.com\")]\n\n\n    COOKIES     = [(\"1fichier.com\", \"LG\", \"en\")]\n\n    DIRECT_LINK = True\n\n    NAME_PATTERN    = r'>File\\s*Name :</td>\\s*<td.*>(?P<N>.+?)<'\n    SIZE_PATTERN    = r'>Size :</td>\\s*<td.*>(?P<S>[\\d.,]+) (?P<U>[\\w^_]+)'\n    OFFLINE_PATTERN = r'File not found !\\s*<'\n\n    WAIT_PATTERN = r'>You must wait \\d+ minutes'\n\n\n    def setup(self):\n        self.multiDL        = self.premium\n        self.resume_download = True\n\n\n    @classmethod\n    def get_info(cls, url=\"\", html=\"\"):\n        redirect = url\n        for i in xrange(10):\n            try:\n                headers = dict(re.findall(r\"(?P<name>.+?): (?P<value>.+?)\\r?\\n\", get_url(redirect, just_header=True).lower()))\n                if 'location' in headers and headers['location']:\n                    redirect = headers['location']\n                else:\n                    if 'content-type' in headers and headers['content-type'] == \"application/octet-stream\":\n                        if \"filename=\" in headers.get('content-disposition'):\n                            name = dict(_i.split(\"=\") for _i in map(str.strip, headers['content-disposition'].split(\";\"))[1:]['filename'].strip(\"\\\"'\")\n                        else:\n                            name = url\n\n                        info = {'name'  : name,\n                                'size'  : long(headers.get('content-length')),\n                                'status': 3,\n                                'url'   : url}\n\n                    else:\n                        info = super(OneFichierCom, cls).get_info(url, html)\n\n                    break\n\n            except Exception, e:\n                info = {'status' : 8,\n                        'error'  : e.message}\n\n        else:\n            info = {'status' : 8,\n                    'error'    : _(\"Too many redirects\")}\n\n        return info\n\n\n    def handle_direct(self, pyfile):\n        redirect = pyfile.url\n        for i in xrange(self.get_config(\"maxredirs\", plugin=\"UserAgentSwitcher\")):\n\n            headers = self.load(redirect, just_header=True)\n            if 'location' in headers and headers['location']:\n                self.log_debug(\"Redirect #%d to: %s\" % (i, redirect))\n                redirect = headers['location']\n            else:\n                if 'content-type' in headers and headers['content-type'] == \"application/octet-stream\":\n                    self.link = pyfile.url\n                break\n        else:\n            self.fail(_(\"Too many redirects\"))\n\n\n    def handle_free(self, pyfile):\n        self.check_errors()\n\n        id = self.info['pattern']['ID1'] or self.info['pattern']['ID2']\n        url, inputs = self.parse_html_form('action=\"https://1fichier.com/\\?%s' % id)\n\n        if not url:\n            self.fail(_(\"Download link not found\"))\n\n        if \"pass\" in inputs:\n            inputs['pass'] = self.get_password()\n\n        inputs['submit'] = \"Download\"\n\n        self.download(url, post=inputs)\n\n\n    def handle_premium(self, pyfile):\n        self.download(pyfile.url, post={'dl': \"Download\", 'did': 0})\n\n\ngetInfo = create_getInfo(OneFichierCom)\n", "path": "module/plugins/hoster/OneFichierCom.py"}]}