<commit_before>from scrapy.spider import Spider
from scrapy.selector import Selector

from CabuKcgCrawler.items import CabukcgcrawlerItem

import io,json

class CabuKcgCrawlerDistrict(Spider):
    name = "District"
    allowed_domains = ["gov.tw"]
    start_urls = [
        "http://cabu.kcg.gov.tw/cabu2/statis61B3.aspx"
    ]

    def parse(self, response):
    	sel = Selector(response)
    	items = []

    	districts = sel.xpath('//select[@id="ddlArea"]/option/@value').extract()

    	for district in districts:
    		print district

    	return None<commit_msg>crawl village<commit_after>from scrapy.spider import Spider
from scrapy.selector import Selector

from CabuKcgCrawler.items import CabukcgcrawlerItem

import io,json,scrapy

class CabuKcgCrawlerDistrict(Spider):
    name = "District"
    allowed_domains = ["gov.tw"]
    start_urls = [
        "http://cabu.kcg.gov.tw/cabu2/statis61B3.aspx"
    ]

    districts = []

    def parse(self, response):
    	sel = Selector(response)

    	districts = sel.xpath('//select[@id="ddlArea"]/option/@value').extract()

    	for district in districts:
    		print district

    	return scrapy.FormRequest.from_response(
    		response,
    		formdata={'ddlArea': districts[2], 'LinkButton1': ''},
    		callback=self.after_login
      )

    def after_login(self, response):
    	sel = Selector(response)

    	villages = sel.xpath('//select[@id="ddlLi"]/option/@value').extract()

    	for village in villages:
    		print village

    	return None
{'fraction_non_alphanumeric': 0.11885790172642763, 'fraction_numerical': 0.006640106241699867, 'mean_word_length': 3.2691218130311617, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2259957', 'n_tokens_mistral': 544, 'n_tokens_neox': 514, 'n_words': 96}