2 -- Copyright (C) 2010-2012 Toni Gundogdu <legatvs@gmail.com>
4 -- This file is part of libquvi-scripts <http://quvi.sourceforge.net/>.
6 -- This program is free software: you can redistribute it and/or
7 -- modify it under the terms of the GNU Affero General Public
8 -- License as published by the Free Software Foundation, either
9 -- version 3 of the License, or (at your option) any later version.
11 -- This program is distributed in the hope that it will be useful,
12 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
13 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 -- GNU Affero General Public License for more details.
16 -- You should have received a copy of the GNU Affero General
17 -- Public License along with this program. If not, see
18 -- <http://www.gnu.org/licenses/>.
23 -- (q)uvi.(f)etch (o)ption
24 M
.qfo_from_charset
= 0x0 -- Convert (to UTF-8) from this charset
25 M
.qfo_user_agent
= 0x1 -- Set user-agent string value
26 M
.qfo_cookie
= 0x2 -- Set an arbitrary cookie
27 M
.qfo_type
= 0x3 -- Fetch type (see qft_*)
29 -- (q)uvi.(f)etch (t)ype
32 M
.qft_url
= 0x2 -- default
40 Instructs the library to convert from this charset to UTF-8. Using this
41 option may be required with the websites that use a specific (non-UTF8)
44 The purpose of this option is to make sure that the data is encoded to
45 unicode (UTF-8) before any of it is parsed and returned to the
46 application using libquvi.
48 By default, libquvi converts the data which is in the encoding used for
49 the strings by the C runtime in the current locale into UTF-8. IF this
50 fails, and the 'from charset' option is set, the library will then try
51 to convert to UTF-8 using the 'from charset' value.
55 When set, the arbitrary cookie will be used with the quvi.fetch .
56 The cookies are handled by libcurl, look up the CURLOPT_COOKIE
57 description for details. If you must define >1 cookies, use the
58 following format: "foo=1; bar=2;" .
62 local C = require 'quvi/const'
64 local p = quvi.fetch(URL, {[C.qfo_cookie] = 'foo=1'})
65 local p = quvi.fetch(URL, {[C.qfo_type] = C.qft_config})
68 [C.qfo_cookie] = 'foo=1; bar=2;',
69 [C.qfo_type] = C.qft_config
71 local p = quvi.fetch(URL, t)
76 -- vim: set ts=2 sw=2 tw=72 expandtab: