Browse Source

Don't load full html inside description field. fixes #192

tags/build/2.0.0.pre1
Ruud 13 years ago
parent
commit
229157e862
  1. 2
      couchpotato/core/providers/nzb/mysterbin/main.py
  2. 8
      couchpotato/core/providers/nzb/nzbclub/main.py
  3. 9
      couchpotato/core/providers/nzb/nzbindex/main.py

2
couchpotato/core/providers/nzb/mysterbin/main.py

@ -67,7 +67,7 @@ class Mysterbin(NZBProvider):
description = ''
if result.find('a', text = 'View NFO'):
description = toUnicode(self.getCache('mysterbin.%s' % myster_id, self.urls['nfo'] % myster_id, timeout = 25920000))
description = toUnicode(self.getCache('mysterbin.%s' % myster_id, self.urls['nfo'] % myster_id, cache_timeout = 25920000))
new = {
'id': myster_id,

8
couchpotato/core/providers/nzb/nzbclub/main.py

@ -1,3 +1,4 @@
from BeautifulSoup import BeautifulSoup
from couchpotato.core.event import fireEvent
from couchpotato.core.helpers.encoding import toUnicode, tryUrlencode
from couchpotato.core.helpers.rss import RSS
@ -57,7 +58,10 @@ class NZBClub(NZBProvider, RSS):
size = enclosure['length']
date = self.getTextElement(nzb, "pubDate")
description = toUnicode(self.getCache('nzbclub.%s' % nzbclub_id, self.getTextElement(nzb, "link"), timeout = 25920000))
full_description = self.getCache('nzbclub.%s' % nzbclub_id, self.getTextElement(nzb, "link"), cache_timeout = 25920000)
html = BeautifulSoup(full_description)
nfo_pre = html.find('pre', attrs = {'class':'nfo'})
description = toUnicode(nfo_pre.text) if nfo_pre else ''
new = {
'id': nzbclub_id,
@ -73,7 +77,7 @@ class NZBClub(NZBProvider, RSS):
}
new['score'] = fireEvent('score.calculate', new, movie, single = True)
if 'ARCHIVE inside ARCHIVE' in description:
if 'ARCHIVE inside ARCHIVE' in full_description:
log.info('Wrong: Seems to be passworded files: %s' % new['name'])
continue

9
couchpotato/core/providers/nzb/nzbindex/main.py

@ -1,3 +1,4 @@
from BeautifulSoup import BeautifulSoup
from couchpotato.core.event import fireEvent
from couchpotato.core.helpers.encoding import toUnicode, tryUrlencode
from couchpotato.core.helpers.rss import RSS
@ -62,9 +63,11 @@ class NzbIndex(NZBProvider, RSS):
try:
description = self.getTextElement(nzb, "description")
if ' nfo' in description.lower():
nfo_url = re.search('href="(?P<nfo>.+)"', description).group('nfo')
description = toUnicode(self.getCache('nzbindex.%s' % nzbindex_id, nfo_url, timeout = 25920000))
if '/nfo/' in description.lower():
nfo_url = re.search('href=\"(?P<nfo>.+)\" ', description).group('nfo')
full_description = self.getCache('nzbindex.%s' % nzbindex_id, url = nfo_url, cache_timeout = 25920000)
html = BeautifulSoup(full_description)
description = toUnicode(html.find('pre', attrs = {'id':'nfo0'}).text)
except:
pass

Loading…
Cancel
Save