-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscraper.py
466 lines (463 loc) · 27.8 KB
/
scraper.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
import scraperwiki
bodycode = '' # all
url1 = 'http://discovery.nationalarchives.gov.uk/results/r/'
# the second part of the url is a variable - see below
url3 = '?_aq=*&_d='
url4 = bodycode
url5 = '_cs=D%7CC&_advtxt=*&_ps=60'
for i in range(100):
url2 = str(i+1)
url = url1 + url2 + url3 + url4 + url5
html = scraperwiki.scrape(url)
import lxml.html
root = lxml.html.fromstring(html)
anchors = root.cssselect('a.linkTitle')
for a in anchors:
var1 = a.text
var2 = var1.replace(' ','+')
var3 = a.attrib['href']
var4 = var3.replace('/results/r/','',1)
line = '*{{URI|' + var1 + '|' + var2 + '|' + var4 + '}}'
# uri = a.href
record = { "a" : line}
scraperwiki.sqlite.save(["a"], record) # save the records one by one
print "No.of pages scraped:", (i + 1)
#------------------------------------------------------------------------------------------
#Alternative public bodies to search
#bodycode = 'A' # Alienation Office
#bodycode = 'AB' # UK Atomic Energy Authority
#bodycode = 'ACT' # Government Actuary's Department
#bodycode = 'ADM' # Admiralty, Navy, Royal Marines, and Coastguard
#bodycode = 'AE' # Royal Commission on Historical Monuments (England)
#bodycode = 'AF' # Parliamentary Boundary Commissions for England and Wales
#bodycode = 'AH' # Location of Offices Bureau
#bodycode = 'AHDB' # Agriculture and Horticulture Development Board
#bodycode = 'AIR' # Air Ministry and Royal Air Force records
#bodycode = 'AJ' # Consumer Council
#bodycode = 'AK' # County Courts
#bodycode = 'AM' # Parliamentary Counsel's Office
#bodycode = 'AN' # British Transport Commission and the British Railways Board
#bodycode = 'AO' # National Audit Office and predecessors
#bodycode = 'AP' # Irish Sailors and Soldiers Land Trust
#bodycode = 'AR' # The Wallace Collection
#bodycode = 'ASSI' # Justices of Assize, Gaol Delivery, Oyer and Terminer, and Nisi Prius
#bodycode = 'AST' # Unemployment Assistance Boards
#bodycode = 'AT' # Various departments for environment, transport, communities, and local government
#bodycode = 'AVIA' # Ministry of Aviation
#bodycode = 'AW' # British European Airways and British Overseas Airways Corporation
#bodycode = 'AX' # Local Government Boundary Commission for England
#bodycode = 'AY' # Various Research Institutes and Councils
#bodycode = 'B' # Bankruptcy and debt relief courts
#bodycode = 'BA' # Civil Service Department
#bodycode = 'BC' # Law Commission
#bodycode = 'BD' # Welsh Office
#bodycode = 'BE' # Iron and Steel Corporation
#bodycode = 'BF' # Pensions Appeal Tribunals
#bodycode = 'BH' # Hudson's Bay Company Archives
#bodycode = 'BIS' # Department for Business, Innovation and Skills
#bodycode = 'BJ' # Meteorological Office
#bodycode = 'BK' # National Dock Labour Corporation and National Dock Labour Board
#bodycode = 'BL' # Council on Tribunals and successors
#bodycode = 'BLK' # Business Link
#bodycode = 'BM' # Disabled Persons Employment Corporation Ltd and Remploy Ltd
#bodycode = 'BN' # Department of Health and Social Security
#bodycode = 'BP' # The Royal Fine Art Commission
#bodycode = 'BPC' # British Potato Council
#bodycode = 'BR' # British Transport Docks Board
#bodycode = 'BS' # Records of defunct temporary bodies
#bodycode = 'BT' # Board of Trade and successors
#bodycode = 'BV' # Parole Board
#bodycode = 'BW' # British Council
#bodycode = 'BX' # Coal Industry Social Welfare Organisation
#bodycode = 'BY' # National Portrait Gallery
#bodycode = 'C' # Chancery, the Wardrobe, Royal Household, Exchequer and various commissions
#bodycode = 'CA' # Countryside Agency and successors
#bodycode = 'CAB' # Cabinet Office
#bodycode = 'CABE' # Commission for Architecture and the Built Environment
#bodycode = 'CAOG' # Crown Agents for Overseas Governments and Administrations
#bodycode = 'CB' # National Playing Fields Association
#bodycode = 'CCW' # Consumer Council for Water
#bodycode = 'CD' # Cinematograph films
#bodycode = 'CE' # British Museum
#bodycode = 'CEF' # Centre for Environment, Fisheries and Aquaculture Science (Cefas)
#bodycode = 'CES' # UK Commission for Employment and Skills and related bodies
#bodycode = 'CF' # National Health Service hospitals
#bodycode = 'CHAR' # Charity Commissioners and Charity Commission
#bodycode = 'CHES' # Palatinate of Chester, including the county of Flint
#bodycode = 'CJ' # Northern Ireland Office
#bodycode = 'CK' # Commission for Racial Equality and predecessors
#bodycode = 'CL' # Certification Office for Trade Unions and Employers' Associations
#bodycode = 'CLG' # Department of Communities and Local Government
#bodycode = 'CM' # Property Services Agency
#bodycode = 'CN' # Photographic prints and negatives extracted from various record series
#bodycode = 'CO' # Colonial Office, Commonwealth and Foreign and Commonwealth Offices
#bodycode = 'COAL' # National Coal Board and predecessors, and related bodies
#bodycode = 'COPY' # Copyright Office and Stationers' Company
#bodycode = 'COU' # National Parks Commission and the Countryside Commission
#bodycode = 'CP' # Court of Common Pleas
#bodycode = 'CPS' # Crown Prosecution Service
#bodycode = 'CRES' # The Crown Estate and predecessors
#bodycode = 'CRIM' # Central Criminal Court
#bodycode = 'CSC' # Civil Service Commission
#bodycode = 'CSPR' # Civil Service Pay Research Unit
#bodycode = 'CT' # National Insurance Commissioners and the Social Security Commissioners
#bodycode = 'CUST' # Boards of Customs, Excise, and Customs and Excise, and HM Revenue and Customs
#bodycode = 'CV' # Value Added Tax Tribunals
#bodycode = 'CW' # Advisory, Conciliation and Arbitration Service
#bodycode = 'CWG' # Commonwealth War Graves Commission
#bodycode = 'CX' # Price Commission
#bodycode = 'CY' # Royal Commission on Environmental Pollution
#bodycode = 'D' # Rural Development Commission and predecessors
#bodycode = 'DB' # Council for National Academic Awards
#bodycode = 'DC' # London Museum
#bodycode = 'DD' # Local Government Boundary Commission for Wales
#bodycode = 'DEFE' # Ministry of Defence
#bodycode = 'DEL' # High Court of Delegates
#bodycode = 'DF' # Natural History Museum
#bodycode = 'DFT' # Department for Transport
#bodycode = 'DG' # International Organisations
#bodycode = 'DGOV' # Directgov
#bodycode = 'DH' # Records of the British Library and the British Museum Library
#bodycode = 'DJ' # Post Office Users' National Council
#bodycode = 'DK' # National Ports Council
#bodycode = 'DL' # Duchy of Lancaster
#bodycode = 'DM' # Occupational Pensions Board
#bodycode = 'DN' # Public Health Laboratory Service Board
#bodycode = 'DO' # Dominions Office, and Commonwealth Relations and Foreign and Commonwealth Offices
#bodycode = 'DPP' # Director of Public Prosecutions
#bodycode = 'DR' # Civil Aviation Authority
#bodycode = 'DSA' # Driving Standards Agency
#bodycode = 'DSIR' # Department of Scientific and Industrial Research
#bodycode = 'DT' # General Nursing Council for England and Wales
#bodycode = 'DURH' # Palatinate of Durham
#bodycode = 'DV' # Central Midwives Board
#bodycode = 'DVLA' # Driver and Vehicle Licensing Agency
#bodycode = 'DW' # Council for the Training of Health Visitors
#bodycode = 'DX' # Panel of Assessors for District Nurse Training
#bodycode = 'DY' # Joint Board of Clinical Nursing Studies
#bodycode = 'E' # Exchequer, Office of First Fruits and Tenths, and the Court of Augmentations
#bodycode = 'EA' # National Council, and Council, for Educational Technology
#bodycode = 'EB' # Commission on Museums and Galleries
#bodycode = 'EC' # Electoral Commission
#bodycode = 'ECCL' # Ecclesiastical Commission
#bodycode = 'ECG' # Export Credit Guarantee Department
#bodycode = 'ED' # Department of Education and Science
#bodycode = 'EF' # Health and Safety Commission and Executive
#bodycode = 'EG' # Department of Energy
#bodycode = 'EH' # Pay Board
#bodycode = 'EJ' # Schools Council for Curriculum and Examinations
#bodycode = 'EL' # Council for the Encouragement of Music and the Arts and Arts Council of Great Britain
#bodycode = 'EM' # Special Commissioners of Income Tax
#bodycode = 'EN' # Imperial War Museum
#bodycode = 'EP' # Reviewing Committee on the Export of Works of Art
#bodycode = 'ER' # Standing Civilian Courts
#bodycode = 'ES' # Atomic Weapons Establishment
#bodycode = 'ET' # Manpower Services Commission
#bodycode = 'EV' # Science and Engineering Research Council
#bodycode = 'EW' # Department of Economic Affairs
#bodycode = 'EXT' # Documents and objects extracted from various record series
#bodycode = 'EY' # Social Science Research Council
#bodycode = 'F' # Forestry Commission
#bodycode = 'FA' # Office of Gas Supply (OFGAS)
#bodycode = 'FB' # Central Bureau for Educational Visits and Exchanges
#bodycode = 'FCO' # Foreign and Commonwealth Office and predecessors
#bodycode = 'FD' # Medical Research Council
#bodycode = 'FEC' # Forfeited Estates Commission
#bodycode = 'FERA' # Food and Environment Research Agency
#bodycode = 'FG' # National Economic Development Council and National Economic Development Office
#bodycode = 'FH' # National Bus Company
#bodycode = 'FJ' # Commission for the New Towns
#bodycode = 'FK' # Office of the Secretary of State for Local Government and Regional Planning
#bodycode = 'FL' # Adult Literacy Resource Agency
#bodycode = 'FM' # Historic Buildings and Monuments Commission for England (English Heritage)
#bodycode = 'FN' # Pilotage Commission
#bodycode = 'FO' # Foreign Office
#bodycode = 'FP' # Health Education Council and Health Education Authority
#bodycode = 'FR' # Legal Aid Board, the Legal Services Commission, and predecessors
#bodycode = 'FS' # Registry of Friendly Societies
#bodycode = 'FT' # Nature Conservancy, the Nature Conservancy Council and English Nature
#bodycode = 'FV' # Department of Trade and Industry, 1970-1974
#bodycode = 'FW' # National Curriculum Council
#bodycode = 'FY' # Potato Marketing Boards
#bodycode = 'GCDA' # Government Car and Despatch Agency
#bodycode = 'GEO' # Government Equalities Office
#bodycode = 'GFM' # Copies of captured records of the German, Italian and Japanese Governments.
#bodycode = 'GIRO' # National Girobank and Predecessors
#bodycode = 'GT' # General Teaching Council for England
#bodycode = 'GUK' # Records of GOV.UK
#bodycode = 'HA' # Natural Environment Research Council
#bodycode = 'HB' # Office of Electricity Regulation
#bodycode = 'HCA' # High Court of Admiralty and colonial Vice-Admiralty courts
#bodycode = 'HD' # Secret Intelligence Service
#bodycode = 'HE' # English National Board for Nursing, Midwifery and Health Visiting
#bodycode = 'HF' # Ministry of Technology
#bodycode = 'HK' # Museums Association
#bodycode = 'HLG' # Ministry of Housing and Local Government
#bodycode = 'HMC' # Royal Commission on Historical Manuscripts
#bodycode = 'HN' # Central Computer and Telecommunications Agency
#bodycode = 'HO' # Home Office
#bodycode = 'HP' # National Radiological Protection Board
#bodycode = 'HR' # Marshall Aid Commemoration Commission
#bodycode = 'HS' # Special Operations Executive
#bodycode = 'HT' # Commission for Local Administration in England
#bodycode = 'HV' # Crown Estate Paving Commission
#bodycode = 'HW' # Government Communications Headquarters (GCHQ)
#bodycode = 'HWA' # Highways Agency
#bodycode = 'HX' # Civil Service Occupational Health Service and Civil Service Occupational Health and Safety Agency
#bodycode = 'HY' # Intervention Board for Agricultural Produce
#bodycode = 'IBS' # Reserved for forthcoming transfer
#bodycode = 'ILB' # Reserved for forthcoming transfer
#bodycode = 'IND' # Indexes to various series
#bodycode = 'INF' # Central Office of Information
#bodycode = 'IPSA' # Independent Parliamentary Standards Authority
#bodycode = 'IR' # Boards of Stamps, Taxes, Excise, Stamps and Taxes, and Inland Revenue
#bodycode = 'J' # Supreme Court of Judicature
#bodycode = 'JA' # Department of Health
#bodycode = 'JB' # Department for Work and Pensions
#bodycode = 'JC' # Office of Water Services (Ofwat) and the Water Services Regulation Authority
#bodycode = 'JD' # Monopolies and Mergers Commission
#bodycode = 'JE' # Office of the National Lottery
#bodycode = 'JF' # Department of Prices and Consumer Protection
#bodycode = 'JH' # Ministry of Land and Natural Resources
#bodycode = 'JK' # Office of Her Majesty's Chief Inspector of Schools in Wales
#bodycode = 'JL' # Curriculum Council for Wales and the Curriculum and Assessment Authority for Wales
#bodycode = 'JM' # Further Education and Higher Education Funding Councils for Wales
#bodycode = 'JN' # Committee on Standards in Public Life and related bodies
#bodycode = 'JP' # The Adjudicators Office
#bodycode = 'JR' # Office of the Rail Regulator
#bodycode = 'JS' # Further Education Funding Council for England
#bodycode = 'JT' # Local Government Commission for England
#bodycode = 'JUST' # Records of itinerant justices and other court records
#bodycode = 'JV' # Milk Marketing Board
#bodycode = 'JW' # Metrication Board
#bodycode = 'JX' # Data Protection Registrar and Successors
#bodycode = 'JY' # Civil Service College
#bodycode = 'KA' # Office of Passenger Rail Franchising
#bodycode = 'KB' # Court of King's Bench
#bodycode = 'KC' # School Examinations and Assessment Council
#bodycode = 'KD' # Coal Authority
#bodycode = 'KE' # Royal Air Force Museum
#bodycode = 'KF' # Inquiry into Exports of Defence Equipment to Iraq and Related Prosecutions (Scott Inquiry)
#bodycode = 'KH' # Special Educational Needs Tribunal
#bodycode = 'KJ' # Government Property Lawyers
#bodycode = 'KL' # Funding Agency for Schools
#bodycode = 'KM' # Food Standards Agency
#bodycode = 'KN' # United Kingdom Central Council for Nursing, Midwifery and Health Visiting
#bodycode = 'KP' # Advisory Committee on Legal Education and Conduct
#bodycode = 'KR' # Joint Nature Conservation Committee
#bodycode = 'KS' # Radiocommunications Agency
#bodycode = 'KT' # Office for Standards in Education
#bodycode = 'KV' # Security Service
#bodycode = 'KW' # Royal Parks Agency
#bodycode = 'KX' # Historic Royal Palaces Agency
#bodycode = 'KY' # National Council for Vocational Qualifications
#bodycode = 'LAB' # Departments responsible for labour and employment matters
#bodycode = 'LAR' # Land Registry
#bodycode = 'LB' # Combined Tax Tribunal
#bodycode = 'LC' # Lord Chamberlain and other officers of the Royal Household
#bodycode = 'LCO' # Lord Chancellor's Office
#bodycode = 'LD' # Office of Fair Trading
#bodycode = 'LE' # The Court Service and Successors
#bodycode = 'LEO' # Lyons Inquiry into Local Government
#bodycode = 'LF' # Office of Telecommunications (Oftel)
#bodycode = 'LH' # Women's National Commission
#bodycode = 'LJ' # Council for the Central Laboratory of the Research Councils
#bodycode = 'LK' # Police Complaints Authority and Police Complaints Board
#bodycode = 'LM' # Department of Transport
#bodycode = 'LN' # Building Societies Commission
#bodycode = 'LO' # Law Officers' Department
#bodycode = 'LOC' # London 2012 Organising Committee of the Olympic and Paralympic Games (LOCOG)
#bodycode = 'LP' # Department of the Environment, Transport and the Regions
#bodycode = 'LR' # Office of the Auditors of Land Revenue
#bodycode = 'LRRO' # Land Revenue Records and Enrolments
#bodycode = 'LS' # Lord Steward, the Board of Green Cloth
#bodycode = 'LSIS' # Learning and Skills Improvement Service
#bodycode = 'LT' # Lands Tribunal
#bodycode = 'LV' # Friendly Societies Commission
#bodycode = 'LX' # Contributions Agency
#bodycode = 'LY' # Child Maintenance and Enforcement Commission
#bodycode = 'MAF' # Agriculture, Fisheries and Food Departments
#bodycode = 'MCA' # Maritime and Coastguard Agency
#bodycode = 'MEPO' # Metropolitan Police Office
#bodycode = 'MF' # Maps and plans extracted to flat storage from various departments
#bodycode = 'MFC' # Maps and plans extracted to flat storage from various departments formerly held at the Public Record Office, Chancery Lane
#bodycode = 'MFQ' # Maps and plans extracted to flat storage from various departments held at the Public Record Office, Kew
#bodycode = 'MH' # Ministry of Health
#bodycode = 'MHRA' # Medicines and Healthcare Products Regulatory Agency
#bodycode = 'MINT' # Royal Mint
#bodycode = 'MJ' # Ministry of Justice
#bodycode = 'MM' # Millennium Commission
#bodycode = 'MONW' # Royal Commission on Ancient and Historical Monuments in Wales and Monmouthshire
#bodycode = 'MPA' # Chancery: maps and plans extracted to flat storage
#bodycode = 'MPAA' # Chancery: maps and plans extracted to extra large flat storage
#bodycode = 'MPB' # Exchequer: maps and plans extracted to flat storage
#bodycode = 'MPBB' # Exchequer: maps and plans extracted to extra large flat storage
#bodycode = 'MPC' # Duchy of Lancaster: maps and plans extracted to flat storage
#bodycode = 'MPCC' # Duchy of Lancaster: maps and plans extracted to extra large flat storage
#bodycode = 'MPD' # Treasury: maps and plans extracted to flat storage
#bodycode = 'MPDD' # Treasury: maps and plans extracted to extra large flat storage
#bodycode = 'MPE' # Land Revenue Records and Enrolments: maps and plans extracted to flat storage
#bodycode = 'MPEE' # Land Revenue Records and Enrolments: maps and plans extracted to extra large flat storage
#bodycode = 'MPF' # State Paper Office: maps and plans extracted to flat storage
#bodycode = 'MPFF' # State Paper Office: maps and plans extracted to extra large flat storage
#bodycode = 'MPG' # Colonial Office: maps and plans extracted to flat storage
#bodycode = 'MPGG' # Colonial Office: maps and plans extracted to extra large flat storage
#bodycode = 'MPH' # War Office: maps and plans extracted to flat storage
#bodycode = 'MPHH' # War Office: maps and plans extracted to extra large flat storage
#bodycode = 'MPI' # Maps and plans extracted to flat storage from records of departments not assigned an individual map extract prefix
#bodycode = 'MPII' # Maps and plans extracted to extra large flat storage from records of departments not assigned an individual map prefix
#bodycode = 'MPK' # Foreign Office: maps and plans extracted to flat storage
#bodycode = 'MPKK' # Foreign Office: maps and plans extracted to extra large flat storage
#bodycode = 'MPL' # Court of Common Pleas: maps and plans extracted to flat storage
#bodycode = 'MPLL' # Court of Common Pleas: maps and plans extracted to extra large flat storage
#bodycode = 'MPM' # Flat maps and drawings of special interest
#bodycode = 'MPN' # Court of King's Bench: maps and plans extracted to flat storage
#bodycode = 'MPNN' # Court of King's Bench: maps and plans extracted to extra large flat storage
#bodycode = 'MPO' # Forestry Commission maps and plans
#bodycode = 'MPP' # Cabinet Office flat maps
#bodycode = 'MPQ' # Privy Council: maps and plans extracted to flat storage
#bodycode = 'MPQQ' # Privy Council: maps and plans extracted to extra large flat storage
#bodycode = 'MPR' # RAIL flat maps
#bodycode = 'MPS' # British Transport Historical Record Office: maps, plans and surveys
#bodycode = 'MPT' # British Transport Commission: maps and plans extracted to flat storage
#bodycode = 'MPZ' # Maps and plans extracted from records of various departments
#bodycode = 'MR' # Maps and plans extracted to rolled storage from various departments
#bodycode = 'MRC' # Maps and plans extracted to rolled storage from various departments formerly held at the Public Record Office, Chancery Lane
#bodycode = 'MRQ' # Maps and plans extracted to rolled storage from various departments held at the Public Record Office, Kew
#bodycode = 'MT' # Ministries of Transport and related bodies
#bodycode = 'MUN' # Ministry of Munitions and successors
#bodycode = 'NATS' # Ministry of National Service
#bodycode = 'NB' # Benefits Agency
#bodycode = 'NC' # National Lottery Charities Board and the Community Fund
#bodycode = 'NDO' # National Debt Office
#bodycode = 'NE' # Central Council for Education and Training in Social Work
#bodycode = 'NF' # Registry of Trade Unions and Employers Associations
#bodycode = 'NG' # National Gallery
#bodycode = 'NH' # Countryside Council for Wales
#bodycode = 'NIA' # National Insurance Audit Department
#bodycode = 'NICO' # National Incomes Commission
#bodycode = 'NJ' # Office of Manpower Economics
#bodycode = 'NK' # Department of Trade and Industry (1983-2007)
#bodycode = 'NL' # Independent Commission on the Voting System
#bodycode = 'NMM' # National Maritime Museum
#bodycode = 'NOMS' # National Offender Management Service
#bodycode = 'NP' # Office of the President of Social Security Appeal Tribunals, Medical Appeal Tribunals and Vaccine Damage Tribunals and Independent Tribunal Service
#bodycode = 'NPL' # National Physical Laboratory
#bodycode = 'NR' # Central Rail Users Consultative Committee
#bodycode = 'NSC' # National Savings Committee, the Post Office Savings Department and the Department for National Savings
#bodycode = 'NT' # Inquiry into the Matters Arising from the Death of Stephen Lawrence
#bodycode = 'NV' # Department for Education and Employment
#bodycode = 'NW' # Interception of Communications Act Commissioner
#bodycode = 'NX' # Security Service Act Commissioner
#bodycode = 'NY' # Intelligence Services Act Commissioner
#bodycode = 'OBS' # Obsolete lists and indexes
#bodycode = 'OCM' # Ofcom (the Office of Communications)
#bodycode = 'OD' # Department of Technical Co-operation, and successive Overseas Development bodies
#bodycode = 'OLD' # Olympic Lottery Distributor
#bodycode = 'OPG' # Office of the Public Guardian
#bodycode = 'OS' # Ordnance Survey of Great Britain
#bodycode = 'OSA' # Office of the Schools Adjudicator
#bodycode = 'PALA' # Records of the Palace Court
#bodycode = 'PB' # Teacher Training Agency and Successors
#bodycode = 'PC' # Privy Council
#bodycode = 'PCAP' # Judicial Committee of the Privy Council
#bodycode = 'PCOM' # Prison Commission and Home Office Prison Department
#bodycode = 'PD' # New Millennium Experience Company
#bodycode = 'PEV' # Court of the Honour of Peveril
#bodycode = 'PF' # Department for Culture, Media and Sport
#bodycode = 'PH' # Central Council for Education and Training in Social Work
#bodycode = 'PHSO' # Parliamentary and Health Service Ombudsman
#bodycode = 'PIN' # Ministry of Pensions and National Insurance
#bodycode = 'PITA' # Inquiry into Human Tissue Analysis in UK Nuclear Facilities (Redfern Inquiry)
#bodycode = 'PJ' # Department of Trade, 1974-1983
#bodycode = 'PL' # Palatinate of Lancaster
#bodycode = 'PMG' # Paymaster General's Office and predecessors
#bodycode = 'PN' # Inquiry into BSE
#bodycode = 'POST' # Royal Mail Group plc and predecessors
#bodycode = 'POWE' # Ministry of Power
#bodycode = 'PP' # Keeper of the Privy Purse
#bodycode = 'PREM' # Prime Minister's Office
#bodycode = 'PRIS' # King's Bench, Fleet, and Marshalsea prisons
#bodycode = 'PRO' # Domestic Records of the Public Record Office, Gifts, Deposits, Notes and Transcripts
#bodycode = 'PROB' # Prerogative Court of Canterbury
#bodycode = 'PSO' # Keeper of the Privy Seal
#bodycode = 'PT' # Public Trustee Office
#bodycode = 'PV' # Department of Industry (1974-1983)
#bodycode = 'PWLB' # Loan Commissioners and the Public Works Loan Board
#bodycode = 'PX' # Postal Services Commission
#bodycode = 'PY' # Office of Gas and Electricity Markets (OFGEM)
#bodycode = 'QAB' # Queen Anne's Bounty
#bodycode = 'QAPS' # Archive Production Services: material sent off-site for storage
#bodycode = 'QLIB' # Resource Centre and Library stores material sent off-site for storage
#bodycode = 'QLX' # List and Index Society store material sent off-site for storage
#bodycode = 'QPR' # Pipe Roll Society stock sent off-site for storage
#bodycode = 'RAIL' # Pre-nationalisation railway companies, pre-nationalisation canal and related companies
#bodycode = 'RB' # Adult Learning Inspectorate
#bodycode = 'RC' # Learning and Skills Council
#bodycode = 'RD' # Environment Agency
#bodycode = 'RECO' # Ministry of Reconstruction
#bodycode = 'REQ' # Court of Requests
#bodycode = 'RF' # Insolvency Service
#bodycode = 'RG' # General Register Office, Social Survey Department, and Office of Population Censuses and Surveys
#bodycode = 'RGO' # Royal Greenwich Observatory
#bodycode = 'RH' # Department for Children, Schools and Families and Successor
#bodycode = 'RJ' # Department created in anticipation of records to be transferred
#bodycode = 'RM' # Royal Botanic Gardens, Kew
#bodycode = 'RP' # Radio Authority
#bodycode = 'RS' # Records originally intended for this code are now in JT
#bodycode = 'RT' # Commission for Africa
#bodycode = 'RV' # Report of the Committee of Privy Counsellors appointed to consider authorised procedures for the interrogation of persons suspected of terrorism (Parker Inquiry)
#bodycode = 'RW' # The National Archives
#bodycode = 'SA' # Commission for Judicial Appointments and Successors
#bodycode = 'SB' # The Pensions Regulator
#bodycode = 'SC' # Special Collections: records of various departments, arranged according to type
#bodycode = 'SCOT' # Scottish Administration
#bodycode = 'SD' # Zahid Mubarek Inquiry
#bodycode = 'SE' # Chemical Regulations Directorate
#bodycode = 'SF' # Statistics Commission
#bodycode = 'SH' # Equal Opportunities Commission
#bodycode = 'SJ' # Gas and Electricity Consumer Council (Energywatch)
#bodycode = 'SK' # Consumer Council for Postal Services (PostWatch)
#bodycode = 'SL' # Inquests into the deaths of Diana, Princess of Wales, and Emad El-Din Mohamed Abdel Moneim Fayed
#bodycode = 'SLC' # Student Loans Company Ltd
#bodycode = 'SO' # Signet Office
#bodycode = 'SP' # State Paper Office, including papers of the Secretaries of State up to 1782
#bodycode = 'SR' # Department for Business, Enterprise and Regulatory Reform
#bodycode = 'ST' # Department for Innovation, Universities and Skills
#bodycode = 'STAC' # Court of Star Chamber and of other courts
#bodycode = 'STAT' # Stationery Office
#bodycode = 'SU' # Department of Energy and Climate Change
#bodycode = 'SUPP' # Ministry of Supply and successors and the Ordnance Board
#bodycode = 'SW' # Natural England
#bodycode = 'T' # HM Treasury
#bodycode = 'TCB' # Post Office telegraph and telephone service
#bodycode = 'TCC' # Post Office Corporation (Telecommunications Division)
#bodycode = 'TCD' # British Telecommunications (public corporation)
#bodycode = 'TCK' # Private collections of telecommunications related records held by BT Archives
#bodycode = 'TG' # Tate Gallery
#bodycode = 'TITH' # Tithe Commission and successors
#bodycode = 'TR' # Tribunals Service
#bodycode = 'TS' # Treasury Solicitor and HM Procurator General's Department
#bodycode = 'TV' # Television Authority and the Independent Broadcasting Authority
#bodycode = 'UGC' # Higher Education Funding Council for England
#bodycode = 'UKTI' # UK Trade & Investment (UKTI)
#bodycode = 'VC' # The Victoria Climbie Inquiry
#bodycode = 'VCA' # Vehicle Certification Agency
#bodycode = 'VL' # Central Veterinary Laboratory and Veterinary Laboratories Agency
#bodycode = 'VOSA' # Vehicle and Operator Services Agency
#bodycode = 'WA' # National Assembly for Wales
#bodycode = 'WALE' # Legal Records Relating to Wales
#bodycode = 'WARD' # Court of Wards and Liveries
#bodycode = 'WM' # National Weights and Measures Laboratory
#bodycode = 'WO' # War Office, Armed Forces, Judge Advocate General, and related bodies
#bodycode = 'WORK' # Office of Works and successors
#bodycode = 'ZBOX' # Unfinished and unpublished texts, calendars and finding aids
#bodycode = 'ZHC' # Publications of the House of Commons
#bodycode = 'ZHL' # Publications of the House of Lords
#bodycode = 'ZJ' # London Gazettes
#bodycode = 'ZLIB' # British Transport Historical Records Office: publications
#bodycode = 'ZMAP' # Maps and plans formerly held by the Public Record Office Library
#bodycode = 'ZOS' # Publications of the Ordnance Survey of Great Britain
#bodycode = 'ZPER' # British Transport Historical Records Office library: periodicals
#bodycode = 'ZSPC' # British Transport Historical Records Office library: publications
#bodycode = 'ZWEB' # Regularly Archived Government Websites