text stringlengths 1 93.6k |
|---|
url)
|
pos = match.end()
|
url = url[pos:]
|
num_dots = [x.start() for x in re.finditer(r'\.', url)]
|
if len(num_dots) <= 3:
|
return 1
|
elif len(num_dots) == 4:
|
return 0
|
else:
|
return -1
|
def domain_registration_length(domain):
|
expiration_date = domain.expiration_date
|
today = time.strftime('%Y-%m-%d')
|
today = datetime.strptime(today, '%Y-%m-%d')
|
registration_length = 0
|
# Some domains do not have expiration dates. This if condition makes sure that the expiration date is used only
|
# when it is present.
|
if expiration_date:
|
registration_length = abs((expiration_date - today).days)
|
return -1 if registration_length / 365 <= 1 else 1
|
def favicon(wiki, soup, domain):
|
for head in soup.find_all('head'):
|
for head.link in soup.find_all('link', href=True):
|
dots = [x.start() for x in re.finditer(r'\.', head.link['href'])]
|
return 1 if wiki in head.link['href'] or len(dots) == 1 or domain in head.link['href'] else -1
|
return 1
|
def https_token(url):
|
match = re.search(http_https, url)
|
if match and match.start() == 0:
|
url = url[match.end():]
|
match = re.search('http|https', url)
|
return -1 if match else 1
|
def request_url(wiki, soup, domain):
|
i = 0
|
success = 0
|
for img in soup.find_all('img', src=True):
|
dots = [x.start() for x in re.finditer(r'\.', img['src'])]
|
if wiki in img['src'] or domain in img['src'] or len(dots) == 1:
|
success = success + 1
|
i = i + 1
|
for audio in soup.find_all('audio', src=True):
|
dots = [x.start() for x in re.finditer(r'\.', audio['src'])]
|
if wiki in audio['src'] or domain in audio['src'] or len(dots) == 1:
|
success = success + 1
|
i = i + 1
|
for embed in soup.find_all('embed', src=True):
|
dots = [x.start() for x in re.finditer(r'\.', embed['src'])]
|
if wiki in embed['src'] or domain in embed['src'] or len(dots) == 1:
|
success = success + 1
|
i = i + 1
|
for i_frame in soup.find_all('i_frame', src=True):
|
dots = [x.start() for x in re.finditer(r'\.', i_frame['src'])]
|
if wiki in i_frame['src'] or domain in i_frame['src'] or len(dots) == 1:
|
success = success + 1
|
i = i + 1
|
try:
|
percentage = success / float(i) * 100
|
except:
|
return 1
|
if percentage < 22.0:
|
return 1
|
elif 22.0 <= percentage < 61.0:
|
return 0
|
else:
|
return -1
|
def url_of_anchor(wiki, soup, domain):
|
i = 0
|
unsafe = 0
|
for a in soup.find_all('a', href=True):
|
# 2nd condition was 'JavaScript ::void(0)' but we put JavaScript because the space between javascript and ::
|
# might not be
|
# there in the actual a['href']
|
if "#" in a['href'] or "javascript" in a['href'].lower() or "mailto" in a['href'].lower() or not (
|
wiki in a['href'] or domain in a['href']):
|
unsafe = unsafe + 1
|
i = i + 1
|
# print a['href']
|
try:
|
percentage = unsafe / float(i) * 100
|
except:
|
return 1
|
if percentage < 31.0:
|
return 1
|
# return percentage
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.