Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slowed down crawler even more #233

Merged
merged 1 commit into from
May 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions dataPipelines/gc_scrapy/gc_scrapy/spiders/hasc_spider.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from datetime import datetime
from dataPipelines.gc_scrapy.gc_scrapy.utils import dict_to_sha256_hex_digest, get_pub_date

# only scrape witness statements
# 193 documents

class HASCSpider(GCSpider):
name = "HASC" # Crawler name
Expand All @@ -18,15 +20,15 @@ class HASCSpider(GCSpider):

randomly_delay_request = True
rotate_user_agent = True

custom_settings = {
**GCSpider.custom_settings,
"DOWNLOAD_DELAY": 1, # Wait at least 1 second between requests
"AUTOTHROTTLE_ENABLED": True,
"AUTOTHROTTLE_START_DELAY": 1,
"AUTOTHROTTLE_MAX_DELAY": 10,
"CONCURRENT_REQUESTS_PER_DOMAIN": 2,
"AUTOTHROTTLE_START_DELAY": 10,
"AUTOTHROTTLE_MAX_DELAY": 60,
"CONCURRENT_REQUESTS_PER_DOMAIN": 1,
}

def parse(self, _):
pages_parser_map = [
(f"{self.base_url}/hearings", self.recursive_parse_hearings),
Expand Down Expand Up @@ -67,8 +69,8 @@ def parse_hearings_table_page(self, response):
print(e)

def extract_doc_name_from_url(self, url):
doc_name = url.split('/')[-1].split('.')[0]
doc_name = doc_name.replace('%', '_').replace('-', '')
doc_name = url.split('/')[-1]
doc_name = doc_name.replace('.pdf', '').replace('%', '_').replace('.', '').replace('-', '')
return doc_name

def parse_hearing_detail_page(self, response):
Expand Down
Loading