If you are in a hurry, and just want to use an Item Exporter to output scraped
data see the Feed exports. Otherwise, if you want to know how
Item Exporters work or need more custom functionality (not covered by the
default exports), continue reading below.

In order to use an Item Exporter, you must instantiate it with its required
args. Each Item Exporter requires different arguments, so check each exporter
documentation to be sure, in Built-in Item Exporters reference. After you have
instantiated you exporter, you have to:

1. call the method start_exporting() in order to
signal the beginning of the exporting process

This is the (abstract) base class for all Item Exporters. It provides
support for common features used by all (concrete) Item Exporters, such as
defining what fields to export, whether to export empty fields, or which
encoding to use.

Return the serialized value for the given field. You can override this
method (in your custom Item Exporters) if you want to control how a
particular field or value will be serialized/exported.

By default, this method looks for a serializer declared in the item
field and returns the result of applying
that serializer to the value. If no serializer is found, it returns the
value unchanged except for unicode values which are encoded to
str using the encoding declared in the encoding attribute.

Signal the end of the exporting process. Some exporters may use this to
generate some required footer (for example, the
XmlItemExporter). You must always call this method after you
have no more items to export.

The encoding that will be used to encode unicode values. This only
affects unicode values (which are always serialized to str using this
encoding). Other value types are passed unchanged to the specific
serialization library.

Exports Items in CSV format to the given file-like object. If the
fields_to_export attribute is set, it will be used to define the
CSV columns and their order. The export_empty_fields attribute has
no effect on this exporter.

Parameters:

file – the file-like object to use for exporting the data.

include_headers_line (str) – If enabled, makes the exporter output a header
line with the field names taken from
BaseItemExporter.fields_to_export or the first exported item fields.

join_multivalued – The char (or chars) that will be used for joining
multi-valued fields, if found.

The additional keyword arguments of this constructor are passed to the
BaseItemExporter constructor, and the leftover arguments to the
csv.writer constructor, so you can use any csv.writer constructor
argument to customize this exporter.

Exports Items in JSON format to the specified file-like object, writing all
objects as a list of objects. The additional constructor arguments are
passed to the BaseItemExporter constructor, and the leftover
arguments to the JSONEncoder constructor, so you can use any
JSONEncoder constructor argument to customize this exporter.

JSON is very simple and flexible serialization format, but it
doesn’t scale well for large amounts of data since incremental (aka.
stream-mode) parsing is not well supported (if at all) among JSON parsers
(on any language), and most of them just parse the entire object in
memory. If you want the power and simplicity of JSON with a more
stream-friendly format, consider using JsonLinesItemExporter
instead, or splitting the output in multiple chunks.

Exports Items in JSON format to the specified file-like object, writing one
JSON-encoded item per line. The additional constructor arguments are passed
to the BaseItemExporter constructor, and the leftover arguments to
the JSONEncoder constructor, so you can use any JSONEncoder
constructor argument to customize this exporter.