-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAudit.py
More file actions
155 lines (133 loc) · 4.56 KB
/
Audit.py
File metadata and controls
155 lines (133 loc) · 4.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
from run_through_urls import scrape_details
from run_through_urls import scrape_faster
class get_scrapped_data:
def __init__(self, filename):
get_scrapped_data.filename = filename
get_scrapped_data.get_data = scrape_faster(get_scrapped_data.filename)
@staticmethod
def duplicate_titles():
duplicate_title_pages = []
flipped = {}
dict_titles = get_scrapped_data.get_data[0]
print(dict_titles)
for key, value in dict_titles.items():
if value is not None:
if value not in flipped:
flipped[value] = [key]
else:
flipped[value].append(key)
for key, value in flipped.items():
if len(value) > 1:
duplicate_title_pages.append(value)
else:
pass
return duplicate_title_pages
@staticmethod
def duplicate_meta_descriptions():
duplicate_md_pages = []
flipped = {}
dict_md = get_scrapped_data.get_data[1]
for key, value in dict_md.items():
if value is not None:
if value not in flipped:
flipped[value] = [key]
else:
flipped[value].append(key)
for key, value in flipped.items():
if len(value) > 1:
duplicate_md_pages.append(value)
else:
pass
return duplicate_md_pages
@staticmethod
def get_missing_descriptions():
missing_descriptions = []
dict_missing = get_scrapped_data.get_data[1]
for key, value in dict_missing.items():
if value is None:
missing_descriptions.append(key)
else:
pass
return missing_descriptions
@staticmethod
def get_titles_with_less_content():
low_titles = []
dict_low_titles = get_scrapped_data.get_data[0]
for key, value in dict_low_titles.items():
if value is not None:
if len(value) <= 10:
low_titles.append(key)
print(value)
return low_titles
@staticmethod
def get_meta_des_with_less_content():
low_meta = []
dict_low_meta = get_scrapped_data.get_data[1]
for key, value in dict_low_meta.items():
if value is not None:
if len(str(value)) <= 30:
low_meta.append(key)
return low_meta
@staticmethod
def get_missing_titles():
missing_titles = []
dict_missing = get_scrapped_data.get_data[0]
for key, value in dict_missing.items():
if value is None:
missing_titles.append(key)
else:
pass
return missing_titles
@staticmethod
def get_missing_h1():
missing_h1 = []
dict_missing = get_scrapped_data.get_data[2]
print(dict_missing)
for key, value in dict_missing.items():
if len(value) == 0:
missing_h1.append(key)
return missing_h1
@staticmethod
def get_duplicate_h1():
duplicate_h1 = []
flipped = {}
dict_h1 = get_scrapped_data.get_data[2]
for key, value in dict_h1.items():
if len(value) !=0:
for item in value:
if item not in flipped:
flipped[item] = [key]
else:
flipped[item].append(key)
for key, value in flipped.items():
if len(value) > 1:
duplicate_h1.append(value)
else:
pass
print(duplicate_h1)
return duplicate_h1
@staticmethod
def get_missing_canonicals():
missing_canonicals = []
dict_canonicals = get_scrapped_data.get_data[3]
for key, value in dict_canonicals.items():
if value is None:
missing_canonicals.append(key)
return missing_canonicals
@staticmethod
def improper_canonicals():
improper = []
dict_canonicals = get_scrapped_data.get_data[3]
for key, value in dict_canonicals.items():
if value is not None:
if value != key:
improper.append(key)
return improper
@staticmethod
def missing_viewports():
missing_viewports = []
dict_missing_v = get_scrapped_data.get_data[4]
for key, value in dict_missing_v.items():
if value is False:
missing_viewports.append(key)
return missing_viewports