mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-12 14:13:38 +00:00
d97bb7174d
Change improve provider title processing. Change improve handling erroneous JSON responses. Change improve find show with unicode characters. Change improve result for providers Omgwtf, SpeedCD, Transmithenet, Zoogle. Change validate .torrent files that contain optional header data. Fix case where an episode status was not restored on failure. Add raise log error if no wanted qualities are found. Change add un/pw to Config/Media providers/Options for BTN API graceful fallback (can remove Api key for security). Change only download torrent once when using blackhole. Add Cloudflare module 1.6.8 (be0a536) to mitigate CloudFlare (IUAM) access validator. Add Js2Py 0.43 (c1442f1) Cloudflare dependency. Add pyjsparser 2.4.5 (cd5b829) Js2Py dependency.
73 lines
1.3 KiB
Python
73 lines
1.3 KiB
Python
from StringIO import StringIO
|
|
from constants import *
|
|
from bs4 import BeautifulSoup
|
|
from js2py.base import *
|
|
try:
|
|
import lxml
|
|
def parse(source):
|
|
return BeautifulSoup(source, 'lxml')
|
|
except:
|
|
def parse(source):
|
|
return BeautifulSoup(source)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
x = '''<table>
|
|
<tbody>
|
|
<tr>
|
|
<td>Shady Grove</td>
|
|
<td>Aeolian</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Over the River, Charlie</td>
|
|
<td>Dorian</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>'''
|
|
|
|
|
|
|
|
class DOM(PyJs):
|
|
prototype = ObjectPrototype
|
|
def __init__(self):
|
|
self.own = {}
|
|
|
|
def readonly(self, name, val):
|
|
self.define_own_property(name, {'writable':False, 'enumerable':False, 'configurable':False, 'value': Js(val)})
|
|
|
|
|
|
|
|
# DOMStringList
|
|
|
|
class DOMStringListPrototype(DOM):
|
|
Class = 'DOMStringListPrototype'
|
|
|
|
def contains(element):
|
|
return element.to_string().value in this._string_list
|
|
|
|
def item(index):
|
|
return this._string_list[index.to_int()] if 0<=index.to_int()<len(this._string_list) else index.null
|
|
|
|
|
|
class DOMStringList(DOM):
|
|
Class = 'DOMStringList'
|
|
prototype = compose_prototype(DOMStringListPrototype)
|
|
def __init__(self, _string_list):
|
|
self.own = {}
|
|
|
|
self._string_list = _string_list
|
|
|
|
|
|
# NameList
|
|
|
|
class NameListPrototype(DOM):
|
|
|
|
|
|
|
|
|
|
|
|
|