Преглед изворни кода

Adding hambleton scraper in php to see if it works :-)

master
duncan.parkes пре 16 година
родитељ
комит
e446ff93e0
5 измењених фајлова са 61 додато и 9 уклоњено
  1. +50
    -0
      docs/scrapers/hambleton.php
  2. +2
    -2
      python_scrapers/AcolnetParser.py
  3. +1
    -1
      python_scrapers/ApplicationSearchServletParser.py
  4. +5
    -3
      python_scrapers/PublicAccess.py
  5. +3
    -3
      python_scrapers/WAM.py

+ 50
- 0
docs/scrapers/hambleton.php Прегледај датотеку

@@ -0,0 +1,50 @@
<?php

//Includes
require_once('config.php');
require_once('application.php');

//build date url
$current_date = getdate();
$day = $current_date['mday'] -5;
$month = $current_date['mon'];
$year = $current_date['year'];

//if any get params were passed, overwrite the default date
if (isset($_GET['day'])){
$day = $_GET['day'];
}
if (isset($_GET['month'])){
$month = $_GET['month'];
}
if (isset($_GET['year'])){
$year = $_GET['year'];
}

//search url
$search_url = "http://planning.hambleton.gov.uk/publicaccess/tdc/DcApplication/application_searchresults.aspx?searchtype=WEEKLY&selWeeklyListRange=#daterange&weektype=VAL";
$date_range = "{$day}%2F{$month}%2F{$year}%7C{$day}%2F{$month}%2F{$year}";
$search_url = str_replace("#daterange", $date_range, $search_url);
//comment and info urls
$info_url_base = "http://planning.hambleton.gov.uk/publicaccess/tdc/DcApplication/application_detailview.aspx?caseno=";
$comment_url_base = "http://planning.hambleton.gov.uk/publicaccess/tdc/DcApplication/application_comments_entryform.aspx?caseno=";
//grab urls
$applications = scrape_applications_publicaccess($search_url, $info_url_base, $comment_url_base);

//smarty
$smarty = new Smarty;
$smarty->force_compile = true;
$smarty->compile_dir = SMARTY_COMPILE_DIRECTORY;
$smarty->template_dir = "../templates";
$smarty->assign("authority_name", "Hambleton District Council");
$smarty->assign("authority_short_name", "Hambleton");
if (sizeof($applications) > 0){
$smarty->assign("applications", $applications);
}
$smarty->display("xml.tpl");

?>

+ 2
- 2
python_scrapers/AcolnetParser.py Прегледај датотеку

@@ -333,11 +333,11 @@ if __name__ == '__main__':
#parser = AcolnetParser("Babergh", "Babergh", "http://planning.babergh.gov.uk/dcdatav2//acolnetcgi.gov?ACTION=UNWRAP&RIPNAME=Root.pgesearch")
#parser = AcolnetParser("Basingstoke", "Basingstoke", "http://planning.basingstoke.gov.uk/DCOnline2/acolnetcgi.exe?ACTION=UNWRAP&RIPNAME=Root.pgesearch")
#parser = BassetlawParser("Bassetlaw", "Bassetlaw", "http://www.bassetlaw.gov.uk/planning/acolnetcgi.gov?ACTION=UNWRAP&RIPNAME=Root.pgesearch")
parser = AcolnetParser("Bolton", "Bolton", "http://www.planning.bolton.gov.uk/DCOnlineV2/acolnetcgi.exe?ACTION=UNWRAP&RIPNAME=Root.pgesearch")
#parser = AcolnetParser("Bolton", "Bolton", "http://www.planning.bolton.gov.uk/DCOnlineV2/acolnetcgi.exe?ACTION=UNWRAP&RIPNAME=Root.pgesearch")
#parser = BridgnorthParser("Bridgnorth", "Bridgnorth", "http://www2.bridgnorth-dc.gov.uk/planning/acolnetcgi.gov?ACTION=UNWRAP&RIPNAME=Root.PgeSearch")
#parser = AcolnetParser("Bury", "Bury", "http://e-planning.bury.gov.uk/DCWebPages/acolnetcgi.gov?ACTION=UNWRAP&RIPNAME=Root.pgesearch")
#parser = CanterburyParser("Canterbury", "Canterbury", "http://planning.canterbury.gov.uk/scripts/acolnetcgi.exe?ACTION=UNWRAP&RIPNAME=Root.pgesearch")
#parser = BoltonLikeParser("Carlisle", "Carlisle", "http://planning.carlisle.gov.uk/acolnet/acolnetcgi.gov?ACTION=UNWRAP&RIPNAME=Root.pgesearch")
parser = BoltonLikeParser("Carlisle", "Carlisle", "http://planning.carlisle.gov.uk/acolnet/acolnetcgi.gov?ACTION=UNWRAP&RIPNAME=Root.pgesearch")
#parser = AcolnetParser("Croydon", "Croydon", "http://planning.croydon.gov.uk/DCWebPages/acolnetcgi.gov?ACTION=UNWRAP&RIPNAME=Root.pgesearch")
#parser = AcolnetParser("Derby", "Derby", "http://eplanning.derby.gov.uk/acolnet/planningpages02/acolnetcgi.exe?ACTION=UNWRAP&RIPNAME=Root.pgesearch")
#parser = AcolnetParser("East Lindsey", "East Lindsey", "http://www.e-lindsey.gov.uk/planning/AcolnetCGI.exe?ACTION=UNWRAP&RIPNAME=Root.pgesearch", "AcolnetParser")


+ 1
- 1
python_scrapers/ApplicationSearchServletParser.py Прегледај датотеку

@@ -501,4 +501,4 @@ if __name__ == "__main__":
#parser = EalingSearchParser("Ealing", "Ealing", "http://www.pam.ealing.gov.uk")
parser = HaringeySearchParser("Haringey", "Haringey", "http://www.planningservices.haringey.gov.uk")
#parser = DenbighshireSearchParser("Denbighshire", "Denbighshire", "http://planning.denbighshire.gov.uk")
print parser.getResults(3,3,2008)
print parser.getResults(20,5,2008)

+ 5
- 3
python_scrapers/PublicAccess.py Прегледај датотеку

@@ -351,9 +351,11 @@ class PublicAccessPropertyPageParser(HTMLParser.HTMLParser):

if __name__ == '__main__':
day = 20
month = 11
year = 2007
month = 5
year = 2008

parser = PublicAccessParser("East Northants", "East Northants", "http://publicaccesssrv.east-northamptonshire.gov.uk/PublicAccess/tdc/", True)
#parser = PublicAccessParser("East Northants", "East Northants", "http://publicaccesssrv.east-northamptonshire.gov.uk/PublicAccess/tdc/", True)
#parser = PublicAccessParser("Cherwell District Council", "Cherwell", "http://cherweb.cherwell-dc.gov.uk/publicaccess/tdc/", False)
parser = PublicAccessParser("Hambleton District Council", "Hambleton", "http://planning.hambleton.gov.uk/publicaccess/tdc/", True)
print parser.getResults(day, month, year)

+ 3
- 3
python_scrapers/WAM.py Прегледај датотеку

@@ -168,12 +168,12 @@ if __name__ == '__main__':
#parser = WAMParser("Barking and Dagenham", "Barking and Dagenham", "http://idoxwam.lbbd.gov.uk:8081/WAM/pas/searchApplications.do", debug=True)
#parser = BraintreeParser("Braintree", "Braintree", "http://planningapp.braintree.gov.uk/WAM1/weeklyApplications.do", debug=True)
# Camden
#parser = WAMParser("Castle Point", "Castle Point", "http://wam.castlepoint.gov.uk/WAM/pas/searchApplications.do")#, debug=True)
parser = WAMParser("Castle Point", "Castle Point", "http://wam.castlepoint.gov.uk/WAM/pas/searchApplications.do")#, debug=True)
#Chichester - Done as PublicAccess
#parser = BraintreeParser("Colchester", "Colchester", "http://www.planning.colchester.gov.uk/WAM/weeklyApplications.do", debug=True)
#parser = WAMParser("East Lothian", "East Lothian", "http://www.planning.eastlothian.gov.uk/WAM/pas/searchApplications.do", debug=True)
#parser = BraintreeParser("North Somerset", "North Somerset", "http://wam.n-somerset.gov.uk/MULTIWAM/weeklyApplications.do", debug=True)
parser = WAMParser("Nottingham", "Nottingham", "http://plan4.nottinghamcity.gov.uk/WAM/pas/searchApplications.do", debug=True)
#parser = WAMParser("Nottingham", "Nottingham", "http://plan4.nottinghamcity.gov.uk/WAM/pas/searchApplications.do", debug=True)
#parser = PooleParser("Poole long", "Poole", "http://wam.boroughofpoole.com/WAM/pas/searchApplications.do", debug=True)
#parser = WAMParser("Rother long", "Rother", "http://www.planning.rother.gov.uk/WAM/pas/searchApplications.do", debug=True)
#parser = BraintreeParser("South Gloucestershire", "South Gloucestershire", "http://planning.southglos.gov.uk/WAM/pas/WeeklyApplications.do", debug=True)
@@ -181,7 +181,7 @@ if __name__ == '__main__':
#parser = BraintreeParser("Tower Hamlets", "Tower Hamlets", "http://194.201.98.213/WAM/weeklyApplications.do", debug=True)
#parser = WAMParser("Westminster", "Westminster", "http://idocs.westminster.gov.uk:8080/WAM/search/pas/index.htm", debug=True)

print parser.getResults(22,3,2008)
print parser.getResults(20,5,2008)

# Left to fix



Loading…
Откажи
Сачувај