<commit_before>import urllib2
import urllib
from bs4 import BeautifulSoup
import os
import requests



def download(url, filepath):
    page=urllib2.urlopen(url)

    soup=BeautifulSoup(page)
    
    finalurl=soup.find("div", {"id": "comic"}).contents[1].get("src")

    image=urllib.urlopen(finalurl)

    if image.headers.maintype=="image":

        buf=image.read()

        print "Image stored to "+filepath

        download=file(filepath,"wb")

        download.write(buf)

        download.close()
        image.close()

base="https://xkcd.com/"
path='C:\\Users\\Aditya\\Desktop\\Work\\xkcd\\'

for i in range(191,1446):
    
    tempurl=base+str(i)+"/"
    temppath=path+str(i)+".png"
    download(tempurl,temppath)<commit_msg>Removed some imports, add feature that askes the user for input<commit_after>import urllib2
import urllib
from bs4 import BeautifulSoup



print "Enter from which xkcd comic onwards should be downloaded"
start=int(raw_input())
print "Enter till which xkcd comic should be downloaded (latest is 1445)"
end=int(raw_input())

def download(url, filepath):
    page=urllib2.urlopen(url)

    soup=BeautifulSoup(page)
    
    finalurl=soup.find("div", {"id": "comic"}).contents[1].get("src")

    image=urllib.urlopen(finalurl)

    if image.headers.maintype=="image":

        buf=image.read()

        print "Image stored to "+filepath

        download=file(filepath,"wb")

        download.write(buf)

        download.close()
        image.close()

base="https://xkcd.com/"
#change the path here, to whereever you want the directory to be
path='C:\\Users\\Aditya\\Desktop\\Work\\xkcd\\'

for i in range(start,end+1):
    
    tempurl=base+str(i)+"/"
    temppath=path+str(i)+".png"
    download(tempurl,temppath)
{'fraction_non_alphanumeric': 0.14416475972540047, 'fraction_numerical': 0.011441647597254004, 'mean_word_length': 3.4846153846153847, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4339781', 'n_tokens_mistral': 632, 'n_tokens_neox': 595, 'n_words': 125}