Skip to content

Instantly share code, notes, and snippets.

@jaturken
Created October 20, 2015 14:14
Show Gist options
  • Save jaturken/7f0aaa40f6caccf29a8e to your computer and use it in GitHub Desktop.
Save jaturken/7f0aaa40f6caccf29a8e to your computer and use it in GitHub Desktop.
123
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