-
-
Save dayAlone/a4b343b887729582969d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
// Import categories | |
$.get('http://ru.russellhobbs.com/russell-hobbs-products/', (data) => { | |
$(data).find('#dsnestCat li').each((key, el)=> { | |
let $el = $(el); | |
let $img = $el.find('img'); | |
if ($img) { | |
let result = { | |
name: $img.attr('alt'), | |
image: $img.attr('src'), | |
short_description: $el.find('p').text() | |
}; | |
$.get($el.find('a').attr('href'), (data) => { | |
result.description = $(data).find('.dsCATtxt').html(); | |
result.line = data.match(/#dsContentMaskB"\).css\({'background-image':'url\((.*?)\)'}\);/)[1]; | |
}); | |
$.post('/catalog/category/add/', result); | |
} | |
}); | |
}); | |
// Import collections | |
$.get('http://ru.russellhobbs.com/russell-hobbs-collections/', (data) => { | |
$(data).find('#dsnestCat li').each((key, el)=> { | |
let $el = $(el); | |
let $img = $el.find('img'); | |
if ($img) { | |
let result = { | |
name: $img.attr('alt'), | |
image: $img.attr('src'), | |
short_description: $el.find('p').text() | |
}; | |
$.get($el.find('a').attr('href'), (data) => { | |
result.description = $(data).find('.dsCATtxt').html(); | |
result.line = data.match(/#dsContentMaskB"\).css\({'background-image':'url\((.*?)\)'}\);/)[1]; | |
}); | |
//console.log(result); | |
$.post('/catalog/collection/add/', result); | |
} | |
}); | |
}); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment