예제 #1
0
    def parse(self, response: scrapy.Request) -> scrapy.FormRequest:
        """
        Load the page with parameters for getting table size
        :param response: Object of page
        :type response: scrapy.Request
        :return: Content of page in scrapy.FormRequest object
        :rtype: scrapy.FormRequest
        """

        yield scrapy.FormRequest(
            url=response.url,
            formdata={
                "ctl00$cphMainContent$txtLCEndDate$dateInput":
                f"{CURRENT_YEAR}-12-31-00-00-00",
                "ctl00$cphMainContent$txtLCSTartDate$dateInput":
                f"{CURRENT_YEAR}-01-01-00-00-00",
                "ctl00$cphMainContent$ddlLCDocumentType$vddlDropDown":
                "101627",
                "ctl00$cphMainContent$btnSearchLC":
                "Search Land Court",
                '__VIEWSTATE':
                response.css('input#__VIEWSTATE::attr(value)').extract_first(),
                '__EVENTARGUMENT':
                f"Page$1",
                "__EVENTTARGET":
                "ctl00$cphMainContent$gvSearchResults",
            },
            callback=self.format_row_data)
예제 #2
0
    def parse(self, response: scrapy.Request) -> scrapy.FormRequest:
        """
        Start scraping for all pages / rows
        :param response: Page
        :type response: scrapy.Request
        :return: Page request
        :rtype: scrapy.FormRequest
        """

        yield scrapy.FormRequest(
            url=response.url,
            formdata={
                "ctl00$cphMainContent$txtLCEndDate$dateInput":
                f"{CURRENT_YEAR}-12-31-00-00-00",
                "ctl00$cphMainContent$txtLCSTartDate$dateInput":
                f"{CURRENT_YEAR}-01-01-00-00-00",
                "ctl00$cphMainContent$ddlLCDocumentType$vddlDropDown":
                "101627",
                "ctl00$cphMainContent$btnSearchLC":
                "Search Land Court",
                '__VIEWSTATE':
                response.css('input#__VIEWSTATE::attr(value)').extract_first(),
            },
            callback=self.get_pages)