Skip to content

Instantly share code, notes, and snippets.

@ronaldgreeff
Created October 7, 2019 15:59
Show Gist options
  • Save ronaldgreeff/6db23e4924b82fc89f9e5dd5c9415cba to your computer and use it in GitHub Desktop.
Save ronaldgreeff/6db23e4924b82fc89f9e5dd5c9415cba to your computer and use it in GitHub Desktop.
function util__is_valid(value) {
var re;
re = /^[a-zA-Z][a-zA-Z0-9\-_]+$/;
return value && re.test(value);
};
function util__element(element, is_name_only) {
var c, classes, data, name, _i, _len, _ref;
name = element.tagName.toLowerCase();
if (is_name_only) {
return name;
}
classes = [];
_ref = element.classList;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
c = _ref[_i];
if (util__is_valid(c)) {
classes.push(c);
}
}
data = {
name: name,
id: util__is_valid(element.id) ? element.id : '',
classes: classes.sort()
};
return data
};
function util__path(element, is_name_only) {
var path;
path = [];
while (element) {
if (element === document.body) {
break;
}
path.splice(0, 0, util__element(element, is_name_only));
element = element.parentElement;
}
return path;
};
function util__bound(element) {
var bound, rect, scrollLeft, scrollTop;
scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
rect = element.getBoundingClientRect();
bound = {
width: rect.width,
height: rect.height,
left: rect.left + scrollLeft,
top: rect.top + scrollTop
};
return bound;
};
function util__computed(element) {
var computed, data, defaults, key, _i, _len;
defaults = document.defaultView.getComputedStyle(document.body);
computed = document.defaultView.getComputedStyle(element);
data = {};
for (_i = 0, _len = computed.length; _i < _len; _i++) {
key = computed[_i];
if (key === 'width' || key === 'height' || key === 'top' || key === 'left' || key === 'right' || key === 'bottom') {
continue;
}
if (key.charAt(0) === '-') {
continue;
}
if (computed[key] === defaults[key]) {
continue;
}
data[key] = computed[key];
}
return data;
};
// Extractors //////////////////////////////////////////////////////////////////////////
function extractor__extract_meta() {
var data, meta_tags, titles;
titles = (function () {
var _i, _len, _ref, _results;
_ref = document.querySelectorAll('title');
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
title = _ref[_i];
_results.push(title.innerText);
}
return _results;
})();
meta_tags = (function () {
var _i, _len, _ref, _results;
_results = {}
_meta_tags = document.getElementsByTagName('meta');
for (_i=0, _len=_meta_tags.length; _i<_len; _i++) {
_ref = _meta_tags[_i].attributes
if (_ref.length > 1) {
_kval = _ref[0].value
if (_kval in _results) {
_results[_kval + '_' + _i] = _ref[1].value
} else {
_results[_kval] = _ref[1].value
};
};
};
return _results;
})();
data = {
url: window.location.href,
titles: titles,
meta_tags: meta_tags
};
return data;
};
function extractor__extract_body () {
var body, computed, key, _i, _len, _ref;
computed = {};
_ref = document.defaultView.getComputedStyle(document.body);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
key = _ref[_i];
if (key.charAt(0) === '-') {
continue;
}
computed[key] = document.defaultView.getComputedStyle(document.body)[key];
}
body = {
scroll: {
top: document.documentElement.scrollTop || document.body.scrollTop,
left: document.documentElement.scrollLeft || document.body.scrollLeft
},
bound: util__bound(document.body),
computed: computed
};
return body;
};
function extractor__extract_texts() {
var bound, computed, node, text, texts, walker;
texts = [];
walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT, null, false);
while (text = walker.nextNode()) {
if (!(text.nodeValue.trim().length > 0)) {
continue;
}
node = text.parentElement;
bound = util__bound(node);
if (!(bound.width * bound.height > 0)) {
continue;
}
while (node) {
computed = document.defaultView.getComputedStyle(node);
if (parseInt(computed.width) * parseInt(computed.height) > 0) {
break;
}
node = node.parentElement;
}
if (!node) {
continue;
}
if (node.__spider) {
node.__spider.text.push(text.nodeValue);
continue
}
node.__spider = {
element: util__element(node),
path: util__path(node, true),
selector: util__path(node),
text: [text.nodeValue],
html: node.innerHTML,
bound: util__bound(node),
computed: util__computed(node)
};
texts.push(node.__spider);
node.style.border = '1px solid red';
}
return texts;
};
function extractor__extract_links() {
var link, _i, _len, _ref, _results;
_ref = document.querySelectorAll('a[href]');
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
link = _ref[_i];
_results.push(link.href);
}
return _results
};
function extractor__extract_images() {
var bound, images, node, _i, _len, _ref;
images = [];
_ref = document.querySelectorAll('img[src]');
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
node = _ref[_i];
bound = util__bound(node);
if (!(bound.width * bound.height > 0)) {
continue;
}
images.push({
src: node.src,
element: util__element(node),
path: util__path(node, true),
selector: util__path(node),
bound: bound,
computed: util__computed(node)
});
}
return images;
};
function extract() {
var data
data = extractor__extract_meta();
data['body'] = extractor__extract_body();
data['texts'] = extractor__extract_texts();
data['links'] = extractor__extract_links();
data['images'] = extractor__extract_images();
return data
};
return extract();
land = ["skip-link","skip-link","notificationCloseBtn","shipToMessage","synthetix_link","2 departmentButton anchorDataToggle","3 departmentButton anchorDataToggle","4 departmentButton anchorDataToggle","5 departmentButton anchorDataToggle","spanacce","algolia-ac-title","algolia-ac-title","algolia-ac-link","algolia-ac-link","algolia-ac-link","cu-ribbon--text","cu-ribbon--text","cu-ribbon--text","cu-ribbon--text","cu-ribbon--text","slick-prev slick-arrow","sml","slick-next slick-arrow","cust-text-contrain","sml","show_all","show_all","show_all"
]
search = ["skip-link","skip-link","notificationCloseBtn","shipToMessage","synthetix_link","2 departmentButton anchorDataToggle","3 departmentButton anchorDataToggle","4 departmentButton anchorDataToggle","5 departmentButton anchorDataToggle","spanacce","algolia-ac-title","algolia-ac-title","algolia-ac-link","algolia-ac-link","algolia-ac-link","cu-ribbon--text","cu-ribbon--text","cu-ribbon--text","cu-ribbon--text","cu-ribbon--text","current","toggle","spanacce","spanacce","title","spanacce","default_facet title","spanacce","facetCountContainer","facetCountContainer","facetCountContainer","spanacce","facetCountContainer","spanacce","facetCountContainer","facetCountContainer","facetCountContainer","spanacce","facetCountContainer","spanacce","facetCountContainer","facetCountContainer","facetCountContainer","spanacce","facetCountContainer","spanacce","facetCountContainer","facetCountContainer","facetCountContainer","spanacce","facetCountContainer","spanacce","default_facet title","spanacce","facetbutton","facetCountContainer","facetCountContainer","facetCountContainer","spanacce","facetCountContainer","spanacce","facetbutton","facetCountContainer","facetCountContainer","facetCountContainer","spanacce","facetCountContainer","spanacce","facetbutton","facetCountContainer","facetCountContainer","facetCountContainer","spanacce","facetCountContainer","spanacce","spanacce","spanacce","default_facet title","spanacce","facetbutton","facetCountContainer","facetCountContainer","facetCountContainer","spanacce","facetCountContainer","spanacce","facetbutton","facetCountContainer","facetCountContainer","facetCountContainer","spanacce","facetCountContainer","spanacce","title","spanacce","showing_products","showing_products","showing_products","showing_products","dijitReset dijitInline dijitSelectLabel dijitValidationTextBoxLabel orderBySelectLabel ","dijitReset dijitInline dijitSelectLabel dijitValidationTextBoxLabel dijitSearchResultSelectSizeLabel ","product_offer_notify","product_name_link product_view_gtm","product_rating","product_price","price","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_rating","product_price","price","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_rating","product_price","price","button secondary product_view_gtm viewcolor_gtm","product_offer_notify","product_name_link product_view_gtm","product_rating","product_price","price","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_rating","product_price","price","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_rating","product_price","price","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_rating","product_price","price","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_rating","product_price","price","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_rating","product_price","price","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","current_state","rrTitleContainer","rrRatingContainer","product_price","product_ppu ","rrTitleContainer","rrRatingContainer","product_price","product_ppu ","rrTitleContainer","rrRatingContainer","product_price","product_ppu ","rrTitleContainer","rrRatingContainer","product_price","product_ppu ","rrTitleContainer","rrRatingContainer","product_price","product_ppu ","rrTitleContainer","rrRatingContainer","product_price","product_ppu ","rrTitleContainer","rrRatingContainer","product_price","product_ppu ","rrTitleContainer","rrRatingContainer","product_price","product_ppu ","show_all","show_all","show_all"
]
prod_1 = ["skip-link","skip-link","notificationCloseBtn","shipToMessage","synthetix_link","2 departmentButton anchorDataToggle","3 departmentButton anchorDataToggle","4 departmentButton anchorDataToggle","5 departmentButton anchorDataToggle","spanacce","algolia-ac-title","algolia-ac-title","algolia-ac-link","algolia-ac-link","algolia-ac-link","cu-ribbon--text","cu-ribbon--text","cu-ribbon--text","cu-ribbon--text","cu-ribbon--text","current","product_offer_notify","bv-rating-stars bv-rating-stars-off","bv-rating-stars-on bv-rating-stars","bv-off-screen","bv-rating-ratio-count","bv-rating-ratio-count","bv-rating-ratio-count","price price_redesign","productid productid_redesign","saving saving_redesign","was_price was_price_redesign","qty_errorMax qty_errorMax_redesign","quantity_label","button_text","findStore","show_all","product_offer_notify","rrTitleContainer","rrRatingContainer","product_price","product_offer_notify","rrTitleContainer","rrRatingContainer","product_price","product_offer_notify","rrTitleContainer","rrRatingContainer","product_price","product_offer_notify","rrTitleContainer","rrRatingContainer","product_price","product_offer_notify","rrTitleContainer","rrRatingContainer","product_price","product_ppu ","product_offer_notify","rrTitleContainer","rrRatingContainer","product_price","product_ppu ","product_offer_notify","rrTitleContainer","rrRatingContainer","product_price","product_offer_notify","rrTitleContainer","rrRatingContainer","product_price","product_ppu ","product_offer_notify","rrTitleContainer","rrRatingContainer","product_price","product_offer_notify","rrTitleContainer","rrRatingContainer","product_price","product_offer_notify","rrTitleContainer","rrRatingContainer","product_price","product_offer_notify","rrTitleContainer","rrRatingContainer","product_price","bv-action-bar-header","bv-write-review bv-focusable bv-submission-button","bv-off-screen","bv-content-title","bv-histogram-filter-helper","bv-inline-histogram-ratings-star","bv-inline-histogram-ratings-star","bv-off-screen","bv-inline-histogram-ratings-score","bv-off-screen","bv-focusable bv-off-screen","bv-inline-histogram-ratings-star","bv-inline-histogram-ratings-star","bv-off-screen","bv-inline-histogram-ratings-score","bv-off-screen","bv-focusable bv-off-screen","bv-inline-histogram-ratings-star","bv-inline-histogram-ratings-star","bv-off-screen","bv-inline-histogram-ratings-score","bv-off-screen","bv-focusable bv-off-screen","bv-inline-histogram-ratings-star","bv-inline-histogram-ratings-star","bv-off-screen","bv-inline-histogram-ratings-score","bv-off-screen","bv-focusable bv-off-screen","bv-inline-histogram-ratings-star","bv-inline-histogram-ratings-star","bv-off-screen","bv-inline-histogram-ratings-score","bv-off-screen","bv-focusable bv-off-screen","bv-content-title","bv-secondary-rating-summary-id bv-td","bv-rating-stars bv-rating-stars-off","bv-rating-stars bv-rating-stars-on","bv-secondary-rating-summary-rating","bv-content-pagination-pages-current","bv-dropdown-target","bv-dropdown-title","bv-dropdown-arrow","bv-off-screen","bv-filter-control-icon","bv-off-screen","bv-rating bv-rating-stars bv-rating-stars-off","bv-rating-max bv-rating-stars bv-rating-stars-on","bv-off-screen","bv-content-reference-data bv-content-author-name","bv-content-reference-data bv-content-author-name","bv-content-title","bv-content-data-recommend-no","bv-content-data-recommend-no","bv-content-data-recommend-no","bv-content-data-recommend-no","bv-badge-syndicated","bv-rating bv-rating-stars bv-rating-stars-off","bv-rating-max bv-rating-stars bv-rating-stars-on","bv-off-screen","bv-content-reference-data bv-content-author-name","bv-content-reference-data bv-content-author-name","bv-content-title","bv-content-data-recommend-yes","bv-content-data-recommend-yes","bv-content-data-recommend-yes","bv-content-data-recommend-yes","bv-badge-syndicated","bv-rating bv-rating-stars bv-rating-stars-off","bv-rating-max bv-rating-stars bv-rating-stars-on","bv-off-screen","bv-content-reference-data bv-content-author-name","bv-content-reference-data bv-content-author-name","bv-content-title","bv-content-data-recommend-yes","bv-content-data-recommend-yes","bv-content-data-recommend-yes","bv-content-data-recommend-yes","bv-badge-syndicated","bv-rating bv-rating-stars bv-rating-stars-off","bv-rating-max bv-rating-stars bv-rating-stars-on","bv-off-screen","bv-content-reference-data bv-content-author-name","bv-content-reference-data bv-content-author-name","bv-content-title","bv-content-data-recommend-yes","bv-content-data-recommend-yes","bv-content-data-recommend-yes","bv-content-data-recommend-yes","bv-badge-syndicated","bv-rating bv-rating-stars bv-rating-stars-off","bv-rating-max bv-rating-stars bv-rating-stars-on","bv-off-screen","bv-content-reference-data bv-content-author-name","bv-content-reference-data bv-content-author-name","bv-content-title","bv-content-data-product-questions","bv-content-data-product-questions","bv-content-data-recommend-yes","bv-content-data-recommend-yes","bv-content-data-recommend-yes","bv-content-data-recommend-yes","bv-badge-syndicated","bv-content-btn bv-content-btn-pages bv-content-btn-pages-load-more bv-focusable","show_all","show_all","show_all"
]
prod_2 = ["skip-link","skip-link","notificationCloseBtn","shipToMessage","synthetix_link","2 departmentButton anchorDataToggle","3 departmentButton anchorDataToggle","4 departmentButton anchorDataToggle","5 departmentButton anchorDataToggle","spanacce","algolia-ac-title","algolia-ac-title","algolia-ac-link","algolia-ac-link","algolia-ac-link","cu-ribbon--text","cu-ribbon--text","cu-ribbon--text","cu-ribbon--text","cu-ribbon--text","current","toggle","spanacce","spanacce","title","spanacce","default_facet title","spanacce","facetCountContainer","facetCountContainer","facetCountContainer","spanacce","facetCountContainer","spanacce","default_facet title","spanacce","facetbutton","facetCountContainer","facetCountContainer","facetCountContainer","spanacce","facetCountContainer","spanacce","facetbutton","facetCountContainer","facetCountContainer","facetCountContainer","spanacce","facetCountContainer","spanacce","facetbutton","facetCountContainer","facetCountContainer","facetCountContainer","spanacce","facetCountContainer","spanacce","facetbutton","facetCountContainer","facetCountContainer","facetCountContainer","spanacce","facetCountContainer","spanacce","facetbutton","facetCountContainer","facetCountContainer","facetCountContainer","spanacce","facetCountContainer","spanacce","spanacce","spanacce","default_facet title","spanacce","facetbutton","facetCountContainer","facetCountContainer","facetCountContainer","spanacce","facetCountContainer","spanacce","facetbutton","facetCountContainer","facetCountContainer","facetCountContainer","spanacce","facetCountContainer","spanacce","facetbutton","facetCountContainer","facetCountContainer","facetCountContainer","spanacce","facetCountContainer","spanacce","showing_products","showing_products","showing_products","showing_products","dijitReset dijitInline dijitSelectLabel dijitValidationTextBoxLabel orderBySelectLabel ","dijitReset dijitInline dijitSelectLabel dijitValidationTextBoxLabel dijitSearchResultSelectSizeLabel ","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","product_stockComingSoon","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","product_stockComingSoon","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","product_stockComingSoon","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_rating","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","product_offer_notify","product_name_link product_view_gtm","product_price","product_savePrice","qty_errorMax qty_errorMax_redesign","quantity_label desktop","button primary primary_redesign","current_state","rrTitleContainer","rrRatingContainer","product_price","product_ppu ","rrTitleContainer","rrRatingContainer","product_price","product_ppu ","rrTitleContainer","rrRatingContainer","product_price","product_ppu ","rrTitleContainer","rrRatingContainer","product_price","product_ppu ","rrTitleContainer","rrRatingContainer","product_price","product_ppu ","rrTitleContainer","rrRatingContainer","product_price","product_ppu ","rrTitleContainer","rrRatingContainer","product_price","product_ppu ","product_offer_notify","rrTitleContainer","rrRatingContainer","product_price","product_ppu ","show_all","show_all","show_all"
]
def too_common(l):
s = set()
for i in l:
if not s:
s = set(i)
else:
x = set(i)
s = s.intersection(x)
return s
common_land_search = set(land).intersection(set(search))
common_prod = set(prod_1).intersection(set(prod_2))
tc = too_common([land, search, prod_1, prod_2,])
clean = (common_prod.difference(common_land_search))
print('clean i l p1 p2 s')
for i in clean:
l = land.count(i)
p1 = prod_1.count(i)
p2 = prod_2.count(i)
s = search.count(i)
print('{} {} {} {} {}'.format(i, l, s, p1, p2))
print('\ndirty i l p1 p2 s')
for i in tc:
l = land.count(i)
p1 = prod_1.count(i)
p2 = prod_2.count(i)
s = search.count(i)
print('{} {} {} {} {}'.format(i, l, s, p1, p2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment