源码;
# -*- coding: utf-8 -*-# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import pymysql
class AutoqsbkPipeline(object):
    def process_item(self, item, spider):
        coon=pymysql.connect(host="localhost",user="root",passwd="123456",db="qsbk")
        content1=item["content"][0].encode("utf-8")
        link1=item["link"][0].encode("utf-8")
        print(content1)
        sql="insert into qsbkspider(content,link) values ('"+content1+"','"+link1+"')"
        coon.query(sql)
        coon.close()
        return item
错误:
# -*- coding: utf-8 -*-# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import pymysql
class AutoqsbkPipeline(object):
    def process_item(self, item, spider):
        coon=pymysql.connect(host="localhost",user="root",passwd="123456",db="qsbk")
        content1=item["content"][0].encode("utf-8")
        link1=item["link"][0].encode("utf-8")
        print(content1)
        sql="insert into qsbkspider(content,link) values ('"+content1+"','"+link1+"')"
        coon.query(sql)
        coon.close()
        return item
错误;
raceback (most recent call last):
  File "/Library/Python/2.7/site-packages/twisted/internet/defer.py", line 575, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/Users/wmf979825017/kachehone/autoqsbk/autoqsbk/pipelines.py", line 15, in process_item
    coon.query(sql)
  File "/Users/wmf979825017/Library/Python/2.7/lib/python/site-packages/pymysql/connections.py", line 856, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/Users/wmf979825017/Library/Python/2.7/lib/python/site-packages/pymysql/connections.py", line 1057, in _read_query_result
    result.read()
  File "/Users/wmf979825017/Library/Python/2.7/lib/python/site-packages/pymysql/connections.py", line 1340, in read
    first_packet = self.connection._read_packet()
  File "/Users/wmf979825017/Library/Python/2.7/lib/python/site-packages/pymysql/connections.py", line 1014, in _read_packet
    packet.check_error()
  File "/Users/wmf979825017/Library/Python/2.7/lib/python/site-packages/pymysql/connections.py", line 393, in check_error
    err.raise_mysql_exception(self._data)
  File "/Users/wmf979825017/Library/Python/2.7/lib/python/site-packages/pymysql/err.py", line 107, in raise_mysql_exception
    raise errorclass(errno, errval)
DataError: (1406, u"Data too long for column 'content' at row 1")