<commit_before>from django.shortcuts import render, redirect
from django.http import Http404
from crawler.models import *
from searcher import views


import json
import urllib2
import logging

depth=0

def crawl(request):
    video_url_to_crawl = request.GET.get('video_url_to_crawl', '')
    global depth
    depth = request.GET.get('depth', '')
    if not (video_url_to_crawl=="" and depth==""):
        if not depth.isdigit():
            return render(request, 'searcher/error.html', {'error_message':'Please enter a number in the crawling depth field between 0 and 50!'})
        depth=int(depth)
        if depth not in xrange(1, 5):
            return render(request, 'searcher/error.html', {'error_message':'The server is not powerful enough to handle such a depth! Please enter a number in the crawling depth field between 1 and 4'})
        video_url=video_url_to_crawl.replace('%3A',':').replace('%2F','/')
        if 'dailymotion.com' in video_url:
            parse_video(video_url)
            return redirect('/video/'+video_url.split('_')[0].split('/')[-1])
        elif 'youtube.com' in video_url:
            parse_video(video_url)
            return redirect('/video/'+video_url.split('=')[1].split('&')[0])
        else:
            return render(request, 'searcher/error.html', {'error_message':'The URL you provided is not a youtube or dailymotion video, please try again!'})
    return render(request, 'searcher/search.html')
<commit_msg>Some minor changes to prevent connection timeout error<commit_after>from django.shortcuts import render, redirect
from django.http import Http404
from crawler.models import *
from searcher import views


import json
import urllib2
import logging

depth=0

def crawl(request):
    video_url_to_crawl = request.GET.get('video_url_to_crawl', '')
    global depth
    depth = request.GET.get('depth', '')
    if not (video_url_to_crawl=="" and depth==""):
        if not depth.isdigit():
            return render(request, 'searcher/error.html', {'error_message':'Please enter a number in the crawling depth field between 0 and 50!'})
        depth=int(depth)
        if depth not in xrange(1, 4):
            return render(request, 'searcher/error.html', {'error_message':'The server is not powerful enough to handle such a depth! Please enter a number in the crawling depth field between 1 and 3'})
        video_url=video_url_to_crawl.replace('%3A',':').replace('%2F','/')
        if 'dailymotion.com' in video_url:
            parse_video(video_url)
            return redirect('/video/'+video_url.split('_')[0].split('/')[-1])
        elif 'youtube.com' in video_url:
            parse_video(video_url)
            return redirect('/video/'+video_url.split('=')[1].split('&')[0])
        else:
            return render(request, 'searcher/error.html', {'error_message':'The URL you provided is not a youtube or dailymotion video, please try again!'})
    return render(request, 'searcher/search.html')

{'fraction_non_alphanumeric': 0.1281618887015177, 'fraction_numerical': 0.012141652613827993, 'mean_word_length': 3.507598784194529, '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': '6463026', 'n_tokens_mistral': 916, 'n_tokens_neox': 881, 'n_words': 257}