summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster
diff options
context:
space:
mode:
authorGravatar fragonib <devnull@localhost> 2011-05-02 16:13:24 +0200
committerGravatar fragonib <devnull@localhost> 2011-05-02 16:13:24 +0200
commit85e725dc5a381c53b80b0c479de5b21416fbd3fd (patch)
tree1559e737614024d8f73c8f24ddb3d60bdec87806 /module/plugins/hoster
parentServeral Plugins: Clean up (diff)
downloadpyload-85e725dc5a381c53b80b0c479de5b21416fbd3fd.tar.xz
BitshareCom: I18N issues, HTTPRequest: Prevent follow redirection with just_header
Diffstat (limited to 'module/plugins/hoster')
-rw-r--r--module/plugins/hoster/BitshareCom.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py
index d811c02a4..fa822493b 100644
--- a/module/plugins/hoster/BitshareCom.py
+++ b/module/plugins/hoster/BitshareCom.py
@@ -1,22 +1,27 @@
# -*- coding: utf-8 -*-
from __future__ import with_statement
-from module.network.RequestFactory import getURL
from module.plugins.Hoster import Hoster
from module.plugins.ReCaptcha import ReCaptcha
import re
+
def getInfo(urls):
result = []
for url in urls:
# Get file info html
- # @TODO: Force responses in english language so current patterns will be right
- html = getURL(url)
+ req = pyreq.getRequest(BitshareCom.__name__)
+ req.cj.setCookie(BitshareCom.HOSTER_DOMAIN, "language_selection", "EN")
+ html = req.load(url)
+ req.close()
+
+ # Check online
if re.search(BitshareCom.FILE_OFFLINE_PATTERN, html):
result.append((url, 0, 1, url))
+ continue
# Name
name1 = re.search(BitshareCom.__pattern__, url).group('name')
@@ -42,9 +47,11 @@ class BitshareCom(Hoster):
__version__ = "0.3"
__description__ = """Bitshare.Com File Download Hoster"""
__author_name__ = ("paul", "king", "fragonib")
+ __author_mail__ = ("", "", "fragonib[AT]yahoo[DOT]es")
+ HOSTER_DOMAIN = "bitshare.com"
FILE_OFFLINE_PATTERN = r'''(>We are sorry, but the requested file was not found in our database|>Error - File not available<|The file was deleted either by the uploader, inactivity or due to copyright claim)'''
- FILE_INFO_PATTERN = r'<h1>.*\s(?P<name>.+?)\s-\s(?P<size>\d+)\s(?P<units>..)yte</h1>'
+ FILE_INFO_PATTERN = r'<h1>Downloading\s(?P<name>.+?)\s-\s(?P<size>\d+)\s(?P<units>..)yte</h1>'
FILE_AJAXID_PATTERN = r'var ajaxdl = "(.*?)";'
CAPTCHA_KEY_PATTERN = r"http://api\.recaptcha\.net/challenge\?k=(.*?) "
@@ -55,15 +62,13 @@ class BitshareCom(Hoster):
self.pyfile = pyfile
- # Force responses language
- self.req.cj.setCookie("bitshare.com", "language_selection", "EN")
-
# File id
m = re.match(self.__pattern__, self.pyfile.url)
self.file_id = max(m.group('id1'), m.group('id2'))
self.log.debug("%s: File id is [%s]" % (self.__name__, self.file_id))
# Load main page
+ self.req.cj.setCookie(self.HOSTER_DOMAIN, "language_selection", "EN")
self.html = self.load(self.pyfile.url, ref=False, utf8=True, cookies=True)
# Check offline