1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
"""
XPath selectors
Two backends are currently available: libxml2 and lxml
To select the backend explicitly use the SELECTORS_BACKEND variable in your
project. Otherwise, libxml2 will be tried first. If libxml2 is not available,
lxml will be used.
"""
from scrapy.conf import settings
if settings['SELECTORS_BACKEND'] == 'lxml':
from scrapy.selector.lxmlsel import *
elif settings['SELECTORS_BACKEND'] == 'libxml2':
from scrapy.selector.libxml2sel import *
elif settings['SELECTORS_BACKEND'] == 'dummy':
from scrapy.selector.dummysel import *
else:
try:
import libxml2
except ImportError:
try:
import lxml
except ImportError:
from scrapy.selector.dummysel import *
else:
from scrapy.selector.lxmlsel import *
else:
from scrapy.selector.libxml2sel import *
|