Created
October 20, 2015 14:14
-
-
Save jaturken/7f0aaa40f6caccf29a8e to your computer and use it in GitHub Desktop.
123
This file contains hidden or 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
products_names_from_one_page = page_content.xpath("//a[span[@class='snippet-card__header-text']]").map(&:text) | |
products_urls_from_one_page = page_content.xpath("//a[span[@class='snippet-card__header-text']] | |
/@href").map(&:text) | |
############# #HACK | |
products_new_one_from_one_page = [] | |
products_names_from_one_page.each do |name| | |
val = page_content.xpath("//h3[a[span[@class='snippet-card__header-text'] | |
[contains(text(),'#{name}')]]]/div/ | |
div[@class='stickers__sticker stickers__sticker_type_new'] | |
[contains(text(),'Новинка')]").map(&:text)[0] | |
if val == nil | |
products_new_one_from_one_page << false | |
else | |
products_new_one_from_one_page << true | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment