| 1336 |
rajveer |
1 |
Price Analyser
|
|
|
2 |
It's basically a information retrieval and extraction tool. In our case this information is price and other features for a phone from different suppliers.
|
|
|
3 |
The tool can also be used for comparison between the two supplier for a same phone.
|
|
|
4 |
Brief description of its working:
|
|
|
5 |
With the help of Turbogears2.0 forms are prepared for specifying certain parameters which would be helpful in which web page we want to retrieve
|
|
|
6 |
and from that web page what we want to retrieve. These values are dumped into database.
|
|
|
7 |
|
|
|
8 |
Now using Scrapy and Xpaths specifed as parameters in the forms, various information about the phones are captured and dumped into the database.
|
|
|
9 |
|
|
|
10 |
Google charting API's are used for comparison and graphical viewing pleasure.
|
|
|
11 |
|
|
|
12 |
The software also provides querying and searching functionality(a basic search engine functionality). Lucene is used for embedding this feature
|
|
|
13 |
into our application.
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
Detailled description:
|
|
|
18 |
Forms part:
|
|
|
19 |
VIEW
|
|
|
20 |
path to files : home/gaurav/code/TG2TEST/src/wiki20/templates
|
|
|
21 |
codedata_forms.html: Give us the link for individual forms
|
|
|
22 |
input_form.html : Form for a particular supplier, supplier depends on the link choosen in the codedata_forms.html
|
|
|
23 |
|
|
|
24 |
MODEL
|
|
|
25 |
path to files : home/gaurav/code/TG2TEST/src/wiki20/widgets
|
|
|
26 |
babuchak_form.py : Structure of the form for babuchak, contains the parameters that needs to be taken as input from the user
|
|
|
27 |
indiaplaza_form.py : Structure of the form for indiaplaza, contains the parameters that needs to be taken as input from the user
|
|
|
28 |
infibeam_form.py : Structure of the form for infibeam, contains the parameters that needs to be taken as input from the user
|
|
|
29 |
mobilestore_form.py : Structure of the form for mobilestore, contains the parameters that needs to be taken as input from the user
|
|
|
30 |
naaptol_form.py : Structure of the form for naaptol, contains the parameters that needs to be taken as input from the user
|
|
|
31 |
univercell_form.py : Structure of the form for univercell, contains the parameters that needs to be taken as input from the user
|
|
|
32 |
|
|
|
33 |
CONTROLLER
|
|
|
34 |
path to files : home/gaurav/code/TG2TEST/src/wiki20/controllers
|
|
|
35 |
root.py : All the processing part is done here, input is taken here, on submit this input is saved in database.
|
|
|
36 |
There are two type of methods:
|
|
|
37 |
1) form_infibeam : To create the structure it calls the template and pass it the values present in DB as default values
|
|
|
38 |
2) save_infibeam : Take the values given by user, store it in DB and then then show the template for taking input again.
|
|
|
39 |
Same template is used for both the type of methods.
|
|
|
40 |
Scrapy:
|
|
|
41 |
Here individual spiders are written for each supplier, for some extra scripts are also needed because the number of pages they have for information
|
|
|
42 |
is variable. These include infibeam, indiaplaza and mobilestore. These scripts are places in home/gaurav/code named runinfibeam, runindiaplaza and
|
|
|
43 |
runmobstore respectively.
|
|
|
44 |
|
|
|
45 |
******************************************INFIBEAM**********************************************************************************
|
|
|
46 |
|
|
|
47 |
Documentation for script runinfibeam.py
|
|
|
48 |
This is the script called by consetup.py
|
|
|
49 |
First it will run the spider for infibeam dynamically (i.e for determining no of pages)
|
|
|
50 |
Then, it will generate the csv file
|
|
|
51 |
@param path to the folder in which spider-projects reside (:/home/gaurav/code) but start with pathsep
|
|
|
52 |
|
|
|
53 |
Documentation for class infi_spider
|
|
|
54 |
This spider collects the information for the individual phones
|
|
|
55 |
and store them in table datastore_datadefinition_infibeam_data
|
|
|
56 |
|
|
|
57 |
Documentation for class infibeam_data
|
|
|
58 |
It represents database table for infibeam, it stores
|
|
|
59 |
name = name of the phone
|
|
|
60 |
shown_price = price offered by infibeam
|
|
|
61 |
final_price = price which one has to pay,
|
|
|
62 |
final_price = shown_price + taxes + ship-price
|
|
|
63 |
|
|
|
64 |
Documentation for method add_infiphone
|
|
|
65 |
This method is used to add a phone in infibeam's table
|
|
|
66 |
|
|
|
67 |
Documentation for method get_all_infibeam_data
|
|
|
68 |
This method is used to retrieve all the phones in infibeam's table
|
|
|
69 |
|
|
|
70 |
Documentation of various parameters
|
|
|
71 |
Xpath1 = Give us section for individual phone
|
|
|
72 |
Xpath2 = Give us name for individual phone
|
|
|
73 |
Xpath3 = Give us quoted price for individual phone
|
|
|
74 |
vatplustax = to get final price from quoted price
|
|
|
75 |
Removelist = To filer the prices so as to make them integer for eg remove ',' or 'Rs'
|
|
|
76 |
URL = The start url for the supplier from this page we start crawling
|
|
|
77 |
homepage = Homepage for the supplier
|
|
|
78 |
referer = For some suppliers, the spiders were unable to fetch the data without setting this field, I set it to google/search
|
|
|
79 |
domainname = Name by which this spider is known outside, passed as an argument when calling this spider
|
|
|
80 |
|
|
|
81 |
**************************************************************************************************************************************
|
|
|
82 |
|
|
|
83 |
|
|
|
84 |
******************************************INDIAPLAZA**********************************************************************************
|
|
|
85 |
|
|
|
86 |
Documentation for script runindiaplaza.py
|
|
|
87 |
This is the script called by consetup.py
|
|
|
88 |
First it will run the spiders for indiaplaza dynamically (i.e for determining no of pages)
|
|
|
89 |
Then, it will generate the csv file
|
|
|
90 |
@param path to the folder in which spider-projects reside (:/home/gaurav/code) but start with pathsep
|
|
|
91 |
|
|
|
92 |
Documentation for class indiaplaza_spider
|
|
|
93 |
This spider collects the url for the individual phones
|
|
|
94 |
and store them in table datastore_datadefinition_indiaplaza_data.
|
|
|
95 |
|
|
|
96 |
Documentation for class indiaplaza_extra
|
|
|
97 |
This spider collects all the information for the individual phones
|
|
|
98 |
and store them in table datastore_datadefinition_indiaplaza_items.
|
|
|
99 |
|
|
|
100 |
Documentation for class indiaplaza_data
|
|
|
101 |
It represents database table for indiaplaza, it stores
|
|
|
102 |
v_name = name of the vendor
|
|
|
103 |
v_site = url of the vendor
|
|
|
104 |
|
|
|
105 |
Documentation for class indiaplaza_items
|
|
|
106 |
It represents database table for indiaplaza, it stores
|
|
|
107 |
p_name = name of the phone
|
|
|
108 |
p_shown_price = price offered by indiaplaza
|
|
|
109 |
p_final_price = price which one has to pay,
|
|
|
110 |
p_final_price = p_shown_price + taxes + ship-price
|
|
|
111 |
p_guaranteeinfo = duaration of guarantee and whether guarantee is from vendor or manufacturer
|
|
|
112 |
p_shipinfo = how much time would be taken for shipping
|
|
|
113 |
|
|
|
114 |
Documentation for method add_ipbasic
|
|
|
115 |
This method is used to add a url for phone in indiaplaza's table
|
|
|
116 |
|
|
|
117 |
Documentation for method get_all_ipbasic
|
|
|
118 |
This method is used to retrieve all phone-urls in indiaplaza's table
|
|
|
119 |
|
|
|
120 |
Documentation for method add_ipextra
|
|
|
121 |
This method is used to add a phone in indiaplaza's table
|
|
|
122 |
|
|
|
123 |
Documentation for method get_all_indiaplaza_phones
|
|
|
124 |
This method is used to retrieve all the phones in indiaplaza's table
|
|
|
125 |
|
|
|
126 |
Documentation of various parameters
|
|
|
127 |
Xpath1 = Give us section for individual phone
|
|
|
128 |
Xpath2 = Give us name of individual phone
|
|
|
129 |
Xpath3 = Give us url of individual phone
|
|
|
130 |
Url1 = To get full url for individual phones
|
|
|
131 |
Xpath4 = Give us name for individual phone
|
|
|
132 |
Xpath5 = Give us quoted-price for individual phone
|
|
|
133 |
Xpath6 = Give us ship-price for individual phone
|
|
|
134 |
Xpath7 = Give us ship_price for individual phone, if not gettable form xpath6
|
|
|
135 |
Xpath8 = Give us guarantee-info for individual phone
|
|
|
136 |
Xpath9 = Give us guarantee-info for individual phone, if not gettable form xpath8
|
|
|
137 |
Xpath10 = Give us ship-info for individual phone
|
|
|
138 |
Removelist = To filer the prices so as to make them integer for eg remove ',' or 'Rs'
|
|
|
139 |
URL = The start url for the supplier from this page we start crawling
|
|
|
140 |
homepage = Homepage for the supplier
|
|
|
141 |
referer = For some suppliers, the spiders were unable to fetch the data without setting this field, I set it to google/search
|
|
|
142 |
domainname = Name by which the first spider is known outside, passed as an argument when calling this spider
|
|
|
143 |
domainname1 = Name by which the second spider is known outside, passed as an argument when calling this spider
|
|
|
144 |
var1 = To check for free shipping
|
|
|
145 |
|
|
|
146 |
**************************************************************************************************************************************
|
|
|
147 |
|
|
|
148 |
******************************************MOBILESTORE**********************************************************************************
|
|
|
149 |
|
|
|
150 |
Documentation for script runmobstore.py
|
|
|
151 |
This is the script called by consetup.py
|
|
|
152 |
First it will run the spider for mobilestore dynamically (i.e for determining no of pages)
|
|
|
153 |
Then, it will generate the csv file
|
|
|
154 |
@param path to the folder in which spider-projects reside (:/home/gaurav/code) but start with pathsep
|
|
|
155 |
|
|
|
156 |
Documentation for class mobilestore_spider0
|
|
|
157 |
This spider collects the information for the individual phones
|
|
|
158 |
and store them in table datastore_datadefinition_themobilestorephones_new
|
|
|
159 |
|
|
|
160 |
Documentation for class themobilestorephones_new
|
|
|
161 |
It represents database table for themobilestore, it stores
|
|
|
162 |
name = name of the phone
|
|
|
163 |
shown_price = price offered by themobilestore
|
|
|
164 |
final_price = price which one has to pay,
|
|
|
165 |
final_price = shown_price + taxes + ship-price
|
|
|
166 |
extra_info = whether phone can be bought or not
|
|
|
167 |
|
|
|
168 |
Documentation for method add_new_mobstorephone_new
|
|
|
169 |
This method is used to add a phone in themobilestore's table
|
|
|
170 |
|
|
|
171 |
Documentation for method get_allmobstorephone_new
|
|
|
172 |
This method is used to retrieve all the phones in themobilestore's table
|
|
|
173 |
|
|
|
174 |
Documentation of various parameters
|
|
|
175 |
Xpath3 = Give us name for individual phone
|
|
|
176 |
Xpath4 = Give us price for individual phone
|
|
|
177 |
Xpath5 = Give us name for individual phone, if its not gettable from xpath3
|
|
|
178 |
Xpath6 = Give us name for individual phone, if its not gettable from xpath3 and xpath5
|
|
|
179 |
Xpath7 = to check that the phone can be bought or not
|
|
|
180 |
Xpath8 = to check that the item is mobile phone
|
|
|
181 |
url1 and url2 = used for getting actual start urls
|
|
|
182 |
homepage = Homepage for the supplier
|
|
|
183 |
referer = For some suppliers, the spiders were unable to fetch the data without setting this field, I set it to google/search
|
|
|
184 |
domainname0 = Name by which this spider is known outside, passed as an argument when calling this spider
|
|
|
185 |
|
|
|
186 |
**************************************************************************************************************************************
|
|
|
187 |
|
|
|
188 |
******************************************UNIVERCELL**********************************************************************************
|
|
|
189 |
|
|
|
190 |
Documentation for class vendor_links
|
|
|
191 |
This spider collects the url for the individual vendors
|
|
|
192 |
and store them in table datastore_datadefinition_univercell_data.
|
|
|
193 |
|
|
|
194 |
Documentation for class univercell_price
|
|
|
195 |
This spider collects the information for the individual phones
|
|
|
196 |
and store them in table datastore_datadefinition_univercell_items
|
|
|
197 |
|
|
|
198 |
Documentation for class univercell_data
|
|
|
199 |
It represents database table for univercell, it stores
|
|
|
200 |
v_name = name of the vendor
|
|
|
201 |
v_site = url of the vendor
|
|
|
202 |
|
|
|
203 |
Documentation for class univercell_items
|
|
|
204 |
It represents database table for univercell, it stores
|
|
|
205 |
p_title = name of the phone
|
|
|
206 |
p_shown_price = price offered by univercell
|
|
|
207 |
p_final_price = price which one has to pay,
|
|
|
208 |
p_final_price = p_shown_price + taxes + ship-price
|
|
|
209 |
|
|
|
210 |
Documentation for method add_univervendor
|
|
|
211 |
This method is used to add a vendor in univercell's table
|
|
|
212 |
|
|
|
213 |
Documentation for method get_all_univervendor
|
|
|
214 |
This method is used to retrieve all the vendors in univercell's table
|
|
|
215 |
|
|
|
216 |
Documentation for method add_univerphone
|
|
|
217 |
This method is used to add a phone in univercell's table
|
|
|
218 |
|
|
|
219 |
Documentation for method get_all_univercell_phones
|
|
|
220 |
This method is used to retrieve all the phones in univercell's table
|
|
|
221 |
|
|
|
222 |
Documentation of various parameters
|
|
|
223 |
Xpath1 = Give us section for individual vendors
|
|
|
224 |
Xpath2 = Give us name for individual vendors
|
|
|
225 |
Xpath3 = Give us url for individual vendors
|
|
|
226 |
Url1 = To get full url for individual vendors
|
|
|
227 |
var1,var2,var3 and var4 are used to get proper url
|
|
|
228 |
Xpath4 = Give us section for individual phone
|
|
|
229 |
Xpath5 = Give us name for individual phone
|
|
|
230 |
Xpath6 = Give us quoted-price for individual phone
|
|
|
231 |
vatplustax = Give us final_price for individual phone on adding with quoted-price
|
|
|
232 |
Removelist = To filer the prices so as to make them integer for eg remove ',' or 'Rs'
|
|
|
233 |
URL = The start url for the supplier from this page we start crawling
|
|
|
234 |
homepage = Homepage for the supplier
|
|
|
235 |
referer = For some suppliers, the spiders were unable to fetch the data without setting this field, I set it to google/search
|
|
|
236 |
domainname = Name by which the first spider is known outside, passed as an argument when calling this spider
|
|
|
237 |
domainname1 = Name by which the second spider is known outside, passed as an argument when calling this spider
|
|
|
238 |
Url1 = To get full url for individual vendor
|
|
|
239 |
|
|
|
240 |
**************************************************************************************************************************************
|
|
|
241 |
|
|
|
242 |
******************************************BABUCHAK**********************************************************************************
|
|
|
243 |
|
|
|
244 |
Documentation for class babuchak1
|
|
|
245 |
This spider collects the url for the individual vendors
|
|
|
246 |
and store them in table datastore_datadefinition_babuchak_urls.
|
|
|
247 |
|
|
|
248 |
Documentation for class babuchak2
|
|
|
249 |
This spider collects the url for the individual phones
|
|
|
250 |
and store them in table datastore_datadefinition_babuchak_phoneurls.
|
|
|
251 |
|
|
|
252 |
Documentation for class babuchak3
|
|
|
253 |
This spider collects the information for the individual phones
|
|
|
254 |
and store them in table datastore_datadefinition_babuchak_phones.
|
|
|
255 |
|
|
|
256 |
Documentation for class babuchak_urls
|
|
|
257 |
It represents database table for babuchak, it stores
|
|
|
258 |
url = url for the vendors
|
|
|
259 |
no_pages = number of pages for individual vendor
|
|
|
260 |
|
|
|
261 |
Documentation for class babuchak_phoneurls
|
|
|
262 |
It represents database table for babuchak, it stores
|
|
|
263 |
url = url for the individual phones
|
|
|
264 |
|
|
|
265 |
Documentation for class babuchak_phones
|
|
|
266 |
It represents database table for babuchak, it stores
|
|
|
267 |
name = name of the phone
|
|
|
268 |
shown_price = price offered by babuchak
|
|
|
269 |
final_price = price which one has to pay,
|
|
|
270 |
final_price = shown_price + taxes + ship-price
|
|
|
271 |
|
|
|
272 |
Documentation for method add_babuchakurl
|
|
|
273 |
This method is used to add a url for vendor in babuchak's table
|
|
|
274 |
|
|
|
275 |
Documentation for method get_allbabuchakurls
|
|
|
276 |
This method is used to retrieve all the vendor-urls in babuchak's table
|
|
|
277 |
|
|
|
278 |
Documentation for method add_babuchakphoneurl
|
|
|
279 |
This method is used to add a url for phone in babuchak's table
|
|
|
280 |
|
|
|
281 |
Documentation for method get_allbabuchakphoneurls
|
|
|
282 |
This method is used to retrieve all the phone-urls in babuchak's table
|
|
|
283 |
|
|
|
284 |
Documentation for method add_babuchakphone
|
|
|
285 |
This method is used to add a phone in babuchak's table
|
|
|
286 |
|
|
|
287 |
Documentation for method get_allbabuchakphones
|
|
|
288 |
This method is used to retrieve all the phone in babuchak's table
|
|
|
289 |
|
|
|
290 |
Documentation of various parameters
|
|
|
291 |
Xpath1 = Give us section for individual vendors
|
|
|
292 |
Xpath2 = Give us no of pages for individual vendors
|
|
|
293 |
Xpath3 = Give us url for individual vendors
|
|
|
294 |
Url1 = To get full url for individual vendors
|
|
|
295 |
Xpath4 = Give us url for individual phone
|
|
|
296 |
Url2 = To get full url for individual vendors
|
|
|
297 |
Xpath5 = Give us name for individual phone
|
|
|
298 |
Xpath6 = Give us quoted-price for individual phone
|
|
|
299 |
Xpath7 = Give us final_price for individual phone
|
|
|
300 |
Removelist = To filer the prices so as to make them integer for eg remove ',' or 'Rs'
|
|
|
301 |
URL = The start url for the supplier from this page we start crawling
|
|
|
302 |
homepage = Homepage for the supplier
|
|
|
303 |
referer = For some suppliers, the spiders were unable to fetch the data without setting this field, I set it to google/search
|
|
|
304 |
domainname = Name by which the first spider is known outside, passed as an argument when calling this spider
|
|
|
305 |
domainname1 = Name by which the second spider is known outside, passed as an argument when calling this spider
|
|
|
306 |
domainname2 = Name by which the third spider is known outside, passed as an argument when calling this spider
|
|
|
307 |
|
|
|
308 |
**************************************************************************************************************************************
|
|
|
309 |
|
|
|
310 |
******************************************NAAPTOL**********************************************************************************
|
|
|
311 |
|
|
|
312 |
Documentation for class naaptol_spider
|
|
|
313 |
This spider collects the url for the individual phones
|
|
|
314 |
and store them in table datastore_datadefinition_naaptol_urls.
|
|
|
315 |
|
|
|
316 |
Documentation for class naaptol_price
|
|
|
317 |
Since the urls collected in the previous spider for naaptol.com
|
|
|
318 |
are redirected to get the data for individual phones.
|
|
|
319 |
Some are of the form "http://www.naaptol.com/features/10417-Fly-E300.html"
|
|
|
320 |
while others are of the form "http://www.naaptol.com/price/10417-Fly-E300.html".
|
|
|
321 |
So to make data extraction symmetric, this spider will accomplish 2 tasks
|
|
|
322 |
First, for the urls conatining 'features' it collects the information for the
|
|
|
323 |
individual phones and store them in table datastore_datadefinition_naaptol_phones
|
|
|
324 |
for the ones conatining 'prices' in the url, a new url having 'price' repalced
|
|
|
325 |
with 'features' is framed and stored in the table datastore_datadefinition_morenaaptol_urls.
|
|
|
326 |
|
|
|
327 |
Documentation for class naaptol_price
|
|
|
328 |
Spider collects the information for the individual phones and store them in table
|
|
|
329 |
datastore_datadefinition_naaptol_phones
|
|
|
330 |
|
|
|
331 |
Documentation for class naaptolurls
|
|
|
332 |
It represents database table for naaptol, it stores
|
|
|
333 |
url = url of the phones, which we got from sitemap.xml
|
|
|
334 |
|
|
|
335 |
Documentation for class naaptolurls
|
|
|
336 |
It represents database table for naaptol, it stores
|
|
|
337 |
url = url of the phones, here urls are the ones which are redirected
|
|
|
338 |
and contained 'price' but before storing 'price' is replaced by 'features'
|
|
|
339 |
|
|
|
340 |
Documentation for class naaptolphones
|
|
|
341 |
It represents database table for naaptol, it stores
|
|
|
342 |
name = name of the phone,
|
|
|
343 |
range = price range for each phone
|
|
|
344 |
range is in one of the 3 forms, i.e
|
|
|
345 |
range = a to b
|
|
|
346 |
range = a
|
|
|
347 |
range = a(approx)
|
|
|
348 |
here a,b are integers
|
|
|
349 |
|
|
|
350 |
Documentation for class ntonlinesp
|
|
|
351 |
It represents database table for naaptol, it stores
|
|
|
352 |
nid = id of the phone in naaptolphones
|
|
|
353 |
name = name of the onlinesupplier,
|
|
|
354 |
price = price offered by the supplier for the phone
|
|
|
355 |
|
|
|
356 |
Documentation for class ntofflinesp
|
|
|
357 |
It represents database table for naaptol, it stores
|
|
|
358 |
nid = id of the phone in naaptolphones
|
|
|
359 |
name = name of the offlinesupplier,
|
|
|
360 |
price = price offered by the supplier for the phone
|
|
|
361 |
|
|
|
362 |
Documentation for method add_naaptolurl
|
|
|
363 |
This method is used to add a url for phone in naaptol's table
|
|
|
364 |
These are taken from sitemap.xml
|
|
|
365 |
|
|
|
366 |
Documentation for method get_allnaaptolurls
|
|
|
367 |
This method is used to retrieve all the url for phones in naaptol's table
|
|
|
368 |
|
|
|
369 |
Documentation for method add_morenaaptolurl
|
|
|
370 |
This method is used to add a url for phone in naaptol's table
|
|
|
371 |
These are the urls generated by replacing 'price' with 'features'
|
|
|
372 |
which were redirected
|
|
|
373 |
|
|
|
374 |
Documentation for method get_allmorenaaptolurls
|
|
|
375 |
This method is used to retrieve all the extra urls for phones in naaptol's table
|
|
|
376 |
|
|
|
377 |
Documentation for method add_new_naaptolphone
|
|
|
378 |
This method is used to add a phone in naaptol's table
|
|
|
379 |
|
|
|
380 |
Documentation for method get_naaptolphone
|
|
|
381 |
This method is used to retrieve a phone in naaptol's table
|
|
|
382 |
given its name and range
|
|
|
383 |
|
|
|
384 |
Documentation for method get_allnaaptolphones
|
|
|
385 |
This method is used to retrieve all the phone in naaptol's table
|
|
|
386 |
|
|
|
387 |
Documentation for method add_new_ntonlinesp
|
|
|
388 |
This method is used to add a online-supplier for a particular phone
|
|
|
389 |
in naaptol's table
|
|
|
390 |
|
|
|
391 |
Documentation for method get_allntonlinesp
|
|
|
392 |
This method is used to retrieve all the online-suppliers in naaptol's table
|
|
|
393 |
|
|
|
394 |
Documentation for method get_allntonlinespbynid
|
|
|
395 |
This method is used to retrieve all the online-supplier for a particular phone
|
|
|
396 |
in naaptol's table given the id of phone in naaptolphones
|
|
|
397 |
|
|
|
398 |
Documentation for method add_new_ntofflinesp
|
|
|
399 |
This method is used to add a offline-supplier for a particular phone
|
|
|
400 |
in naaptol's table
|
|
|
401 |
|
|
|
402 |
Documentation for method get_allntofflinesp
|
|
|
403 |
This method is used to retrieve all the offline-suppliers in naaptol's table
|
|
|
404 |
|
|
|
405 |
Documentation for method get_allntolinespbynid
|
|
|
406 |
This method is used to retrieve all the offline-supplier for a particular phone
|
|
|
407 |
in naaptol's table given the id of phone in naaptolphones
|
|
|
408 |
|
|
|
409 |
Documentation of various parameters
|
|
|
410 |
Xpath1 = Give us url for individual phones
|
|
|
411 |
chklist1 = elements in chk_list are specific to this site for determining valid sites
|
|
|
412 |
Xpath2 = Give us price-range for individual phone
|
|
|
413 |
Xpath3 = Give us price-range for individual phone, if unable to retrieve from xpath2
|
|
|
414 |
Xpath4 = Give us number of onlinesellers for a particular phone
|
|
|
415 |
Xpath5 = Give us price for a particular phone offered by onlinesellers
|
|
|
416 |
Xpath6 and Xpath7 = Give us name of onlinesellers for a particular phone
|
|
|
417 |
Xpath8 = Give us number of offlinesellers for a particular phone
|
|
|
418 |
Xpath9 = Give us price for a particular phone offered by offlinesellers
|
|
|
419 |
Xpath10 = Give us name of offlinesellers for a particular phone
|
|
|
420 |
Removelist = To filer the prices so as to make them integer for eg remove ',' or 'Rs'
|
|
|
421 |
chklist2 = contains what needs to be replaced, presently it conatains 'price'
|
|
|
422 |
part = contains 'features'
|
|
|
423 |
URL = The start url for the supplier from this page we start crawling
|
|
|
424 |
homepage = Homepage for the supplier
|
|
|
425 |
referer = For some suppliers, the spiders were unable to fetch the data without setting this field, I set it to google/search
|
|
|
426 |
domainname = Name by which the first spider is known outside, passed as an argument when calling this spider
|
|
|
427 |
domainname1 = Name by which the second spider is known outside, passed as an argument when calling this spider
|
|
|
428 |
domainname2 = Name by which the third spider is known outside, passed as an argument when calling this spider
|
|
|
429 |
|
|
|
430 |
**************************************************************************************************************************************
|
|
|
431 |
|
|
|
432 |
******************************************SUPPLIERS**********************************************************************************
|
|
|
433 |
|
|
|
434 |
Documentation for class suppliers
|
|
|
435 |
It represents database table for suppliers, it stores
|
|
|
436 |
name = name of the supplier
|
|
|
437 |
site = url of the supplier
|
|
|
438 |
last_crawled = date of the last run for this supplier
|
|
|
439 |
This table spans all the suppliers in our database
|
|
|
440 |
|
|
|
441 |
Documentation for method add_suppliers
|
|
|
442 |
This method is used to add a supplier in supplier's table
|
|
|
443 |
|
|
|
444 |
Documentation for method get_all_suppliers
|
|
|
445 |
This method is used to retrieve all the suppliers from the supplier's table
|
|
|
446 |
|
|
|
447 |
Documentation for method get_suppId
|
|
|
448 |
This method is used to retrieve id of the supplier given his name
|
|
|
449 |
from the supplier's table
|
|
|
450 |
|
|
|
451 |
Documentation for method get_supp_byId
|
|
|
452 |
This method is used to retrieve a supplier given his id
|
|
|
453 |
from the supplier's table
|
|
|
454 |
|
|
|
455 |
Documentation for method get_suppbyName
|
|
|
456 |
This method is used to retrieve a supplier given his name
|
|
|
457 |
from the supplier's table
|
|
|
458 |
|
|
|
459 |
Documentation for method get_suppbySite
|
|
|
460 |
This method is used to retrieve a supplier given his url
|
|
|
461 |
from the supplier's table
|
|
|
462 |
|
|
|
463 |
**************************************************************************************************************************************
|
|
|
464 |
|
|
|
465 |
******************************************MODELS**********************************************************************************
|
|
|
466 |
|
|
|
467 |
Documentation for class models
|
|
|
468 |
It represents database table for models, it stores
|
|
|
469 |
brand = name of the brand for a particular phone
|
|
|
470 |
model = name of the model for a particular phone
|
|
|
471 |
This table spans all the phones-models in our database
|
|
|
472 |
|
|
|
473 |
Documentation for method add_models
|
|
|
474 |
This method is used to add a model in model's table
|
|
|
475 |
|
|
|
476 |
Documentation for method get_all_models
|
|
|
477 |
This method is used to retrieve all the model from the model's table
|
|
|
478 |
|
|
|
479 |
Documentation for method get_modId
|
|
|
480 |
This method is used to retrieve the id of a model
|
|
|
481 |
given its name from the model's table
|
|
|
482 |
|
|
|
483 |
Documentation for method get_modId
|
|
|
484 |
This method is used to retrieve a model given its id from the model's table
|
|
|
485 |
|
|
|
486 |
Documentation for method get_modId
|
|
|
487 |
This method is used to retrieve a model given its name from the model's table
|
|
|
488 |
|
|
|
489 |
Documentation for method get_modId
|
|
|
490 |
This method is used to retrieve a model given its brand-name from the model's table
|
|
|
491 |
|
|
|
492 |
**************************************************************************************************************************************
|
|
|
493 |
|
|
|
494 |
******************************************PRICES**********************************************************************************
|
|
|
495 |
|
|
|
496 |
Documentation for class prices
|
|
|
497 |
It represents database table for prices, it stores
|
|
|
498 |
supplier_id = id of the supplier who is selling this phone, from suppliers table
|
|
|
499 |
mobile_id = id of the model of this phone, from models table
|
|
|
500 |
quoted_price = price of the phone as offered by the supplier
|
|
|
501 |
final_price = price one has to pay to buy this phone, i.e
|
|
|
502 |
it includes vat, tax and shippping charges
|
|
|
503 |
extra_info = extra-info about this phone
|
|
|
504 |
This table spans all the phones in our database
|
|
|
505 |
|
|
|
506 |
Documentation for method add_prices
|
|
|
507 |
This method is used to add all the info for a phone in prices's table
|
|
|
508 |
|
|
|
509 |
Documentation for method get_all_prices
|
|
|
510 |
This method is used to retrieve all the info for all the phones in prices's table
|
|
|
511 |
|
|
|
512 |
Documentation for method get_prbyId
|
|
|
513 |
This method is used to retrieve all the info for a phone given its id in prices's table
|
|
|
514 |
|
|
|
515 |
Documentation for method get_prbySid
|
|
|
516 |
This method is used to retrieve all the info for a phone in prices's table
|
|
|
517 |
given its supplier-id
|
|
|
518 |
|
|
|
519 |
Documentation for method get_prbySid
|
|
|
520 |
This method is used to retrieve all the info for a phone in prices's table
|
|
|
521 |
given its model-id
|
|
|
522 |
|
|
|
523 |
Documentation for method get_prbySid
|
|
|
524 |
This method is used to retrieve all the info for a phone in prices's table
|
|
|
525 |
given its model-name
|
|
|
526 |
|
|
|
527 |
**************************************************************************************************************************************
|
|
|
528 |
|
|
|
529 |
******************************************GUARANTEE and SHIPINFO**********************************************************************
|
|
|
530 |
|
|
|
531 |
Documentation for class guarantee_info
|
|
|
532 |
It represents database table for guarantee_info, it stores
|
|
|
533 |
mid = id of the phone in models table
|
|
|
534 |
guaranteeinfo = duaration of guarantee and whether guarantee is from vendor or manufacturer
|
|
|
535 |
shipinfo = how much time would be taken for shipping.
|
|
|
536 |
This table spans all the phones in our database
|
|
|
537 |
|
|
|
538 |
Documentation for method add_gs_info
|
|
|
539 |
This method is used to add guarantee and ship info for a phone
|
|
|
540 |
|
|
|
541 |
Documentation for method get_all_gs_info
|
|
|
542 |
This method is used to retrieve guarantee and ship info for all the phones
|
|
|
543 |
|
|
|
544 |
Documentation for method get_gs_bymid
|
|
|
545 |
This method is used to retrieve guarantee and ship info for a phones
|
|
|
546 |
given its phone-id
|
|
|
547 |
|
|
|
548 |
**************************************************************************************************************************************
|
|
|
549 |
|
|
|
550 |
******************************************extra_vars**********************************************************************************
|
|
|
551 |
|
|
|
552 |
Documentation for class extra_vars
|
|
|
553 |
It represents database table for extra_vars, it stores
|
|
|
554 |
var = name of the variable
|
|
|
555 |
val = value of the variable
|
|
|
556 |
desc = description of the variable
|
|
|
557 |
For some suppliers the number of pages to be crawled is not fixed,
|
|
|
558 |
for them variables are created and based on the value of the variable
|
|
|
559 |
number of the pages to be crawled is determined dynamically
|
|
|
560 |
|
|
|
561 |
Documentation for method set_extra_vars
|
|
|
562 |
This method is used to add a variable for a particular supplier.
|
|
|
563 |
Some suppliers has no fixed count of number of pages on which they have data
|
|
|
564 |
so to deal with that this function is used to set variables.
|
|
|
565 |
|
|
|
566 |
Documentation for method get_extra_vars
|
|
|
567 |
This method is used to retrieve a variable's value given its name
|
|
|
568 |
|
|
|
569 |
**************************************************************************************************************************************
|
|
|
570 |
|
|
|
571 |
******************************************CRAWL**********************************************************************************
|
|
|
572 |
|
|
|
573 |
Documentation for class crawl
|
|
|
574 |
It represents database table for crawl, it stores
|
|
|
575 |
crawled_date = date of crawling
|
|
|
576 |
On each new crawl a new entry is made
|
|
|
577 |
Reason for creating this table is for retaining past data for comparison
|
|
|
578 |
|
|
|
579 |
Documentation for method add_newcrawler
|
|
|
580 |
This method is used to add a new crawlid in crawl's table
|
|
|
581 |
|
|
|
582 |
Documentation for method get_latestcrawler
|
|
|
583 |
This method is used to get the latest crawler from the crawl's table
|
|
|
584 |
|
|
|
585 |
Documentation for method get_latestcrawlerid
|
|
|
586 |
This method is used to get the latest crawler-id from the crawl's table
|
|
|
587 |
|
|
|
588 |
**************************************************************************************************************************************
|
|
|
589 |
|
|
|
590 |
******************************************OTHERS**************************************************************************************
|
|
|
591 |
Documentation for class Datahelper
|
|
|
592 |
This class contains various methods to access the database tables
|
|
|
593 |
|
|
|
594 |
Documentation for method init
|
|
|
595 |
Before using all the tables described in this module, one has to call this method
|
|
|
596 |
|
|
|
597 |
Documentation for method initxy
|
|
|
598 |
It calls a method init() so that when one needs to access the helper methods of
|
|
|
599 |
this class to access database, the database tables are in the scope
|
|
|
600 |
|
|
|
601 |
**************************************************************************************************************************************
|
|
|
602 |
|
|
|
603 |
******************************************code_words**********************************************************************************
|
|
|
604 |
|
|
|
605 |
Documentation for class code_words
|
|
|
606 |
It represents database table for code_words used for parameters taken from forms, it stores
|
|
|
607 |
key = name of the parameter
|
|
|
608 |
value = the value of the parameter
|
|
|
609 |
description = information about the parameter, for what purpose its stored
|
|
|
610 |
|
|
|
611 |
Documentation for method init
|
|
|
612 |
Before using all the tables described in this module, one has to call this method
|
|
|
613 |
|
|
|
614 |
Documentation for method initialize_table
|
|
|
615 |
It calls a method init() so that when one needs to access the helper methods of
|
|
|
616 |
this class to access database, the database tables are in the scope
|
|
|
617 |
|
|
|
618 |
Documentation for method set_code_word
|
|
|
619 |
This method is used to set a code_word through input from form
|
|
|
620 |
|
|
|
621 |
Documentation for method get_code_word_byId
|
|
|
622 |
This method is used to retrieve a code_word given its id
|
|
|
623 |
|
|
|
624 |
Documentation for method get_code_word
|
|
|
625 |
This method is used to retrieve the value of a code_word given its key i.e name
|
|
|
626 |
|
|
|
627 |
Documentation for method get_allcode_words
|
|
|
628 |
This method is used to retrieve all the code_words given the key i.e name
|
|
|
629 |
|
|
|
630 |
Documentation for method get_code_word_byKey
|
|
|
631 |
This method is used to retrieve the code_word given its key i.e name
|
|
|
632 |
|
|
|
633 |
|
|
|
634 |
**************************************************************************************************************************************
|