<commit_before># coding=utf-8

# Transcript Downloader
# Downloads from a specified list of URLs
# Then saves them all to disk

from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
import json
import os


class MySpider(BaseSpider):
    # Name the spider as required by scrapy
    name = "download"
    
    # Set a download delay of 5 seconds.
    # This makes the downloads take longer, but it's kinder on the UCSB servers.
    download_delay = 5

    # Import the list of URLs to download from - this comes from our earlier file.
    start_urls = ['http://www.presidency.ucsb.edu/debates.php']
    
    # Once again, the allowed domain is set.
    allowed_domains = ['ucsb.edu']
    
    # parse method, run every time the spider is run
    def parse(self, response):
        hxs = HtmlXPathSelector(response)
        
        # The only purpose of the following code is to give the files sensible names.
        
        # Extract the date of the debate
        date = hxs.select("//span[@class='docdate']/text()").extract()
        for date in date:
            debateDate = date
            break

        # Extract the name description of the debate
        name = hxs.select("//span[@class='paperstitle']/text()").extract()
        for name in name:
            debateName = name
            break<commit_msg>compatibility for others to clone github repo<commit_after># coding=utf-8

# Transcript Downloader
# Downloads from a specified list of URLs
# Then saves them all to disk

from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
import json
import os


class MySpider(BaseSpider):
    # Name the spider as required by scrapy
    name = "download"
    
    # Set a download delay of 5 seconds.
    # This makes the downloads take longer, but it's kinder on the UCSB servers.
    download_delay = 5

    # Import the list of URLs to download from - this comes from our earlier file.
    with file('urls.json', 'r') as f:
        start_urls = json.load(f)
    
    # Once again, the allowed domain is set.
    allowed_domains = ['ucsb.edu']
    
    # parse method, run every time the spider is run
    def parse(self, response):
        hxs = HtmlXPathSelector(response)
        
        # The only purpose of the following code is to give the files sensible names.
        
        # Extract the date of the debate
        date = hxs.select("//span[@class='docdate']/text()").extract()
        for date in date:
            debateDate = date
            break

        # Extract the name description of the debate
        name = hxs.select("//span[@class='paperstitle']/text()").extract()
        for name in name:
            debateName = name
            break
{'fraction_non_alphanumeric': 0.07827359180687637, 'fraction_numerical': 0.0021945866861741038, 'mean_word_length': 2.4489281210592684, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '367539', 'n_tokens_mistral': 774, 'n_tokens_neox': 745, 'n_words': 302}