Перейти к основному содержимому

Shop::Amazon: парсер товаров Amazon

img

Обзор парсера товаров Shop::Amazon#

Используя парсер товаров amazon, вы можете получать все данные с карточки товара, собрать базу ссылок на товары, отслеживать динамику цен на товар и доставку, собирать оценку рейтинга и количество отзывов на товар, собрать картинки товаров, получить список магазинов.

Функционал A-Parser позволяет сохранять настройки парсинга для дальнейшего использования (пресеты), задавать расписание парсинга и многое другое. Вы можете использовать автоматическое размножение запросов, подстановку подзапросов из файлов, перебор цифро-буквенных комбинаций и списков для получения максимально возможного количества результатов.

img

Собираемые данные#

img

  • Название товара
  • Ссылка на товар
  • Картинка товара
  • Цена и цена без скидки
  • Рейтинг, число комментариев
  • Количество продавцов
  • Продавец
  • Дополнительная информация (Bestseller, Sponsored)

Варианты использования#

  • Сбор ссылок на товары
  • Оценка популярности товаров
  • Отслеживание динамики цен

Примеры запросов#

В качестве запросов необходимо указывать названия товаров, точно так же, как если бы их вводили прямо в форму поиска Amazon, например:

iphone 11pro max
Беспроводная Bluetooth-мышь, домашняя игровая мышь
Карта памяти Micro Sd Sandisk, карта Micro Sd Class10 TF
AMD Ryzen R3 2200U

Подстановки запросов#

Вы можете использовать встроенные макросы для разможения запросов, например мы хотим получить очень большую базу товаров по брендам,

philips
sony
xiaomi
samsung

В формате запросов укажем перебор символов от a до zzzz, данный метод позволяет максимально ротировать поисковую выдачу и получать множество новых уникальных результатов:

$query {az:a:zzzz}

Данный макрос создаст 475254 дополнительных запросов на каждый исходный поисковый запрос, что в сумме даст 4 х 475254 = 1901016 поисковых запроса, цифра впечатляющая, но это совсем не проблема для A-Parser'а.

Варианты вывода результата#

Вывод в csv#

Вы можете использовать Шаблнизатор Template-Toolkit для вывода результата в csv, например мы записать в файл csv такие колонки: Сссылка на товар, Название товара, Цена, Старая цена, Рейтинг, Кол-во комментариев

Формат результата:

[% FOREACH item IN products;
tools.CSVline(item.link, item.title, item.price, item.oldprice, item.rating, item.commentscount );
END; %]

Приимер результата:

https://www.amazon.com/Oculus-Quest-Advanced-All-One-2/dp/B08F7PTF54/ref=sr_1_5?dchild=1&keywords=playstation+5&qid=1611928056&sr=8-5,"Oculus Quest 2 — Advanced All-In-One Virtual Reality Headset — 256 GB",399.00,,"19,203
https://www.amazon.com/DualSense-Wireless-Controller-PlayStation-5/dp/B08FC6C75Y/ref=sr_1_6?dchild=1&keywords=playstation+5&qid=1611928056&sr=8-6,"DualSense Wireless Controller",69.93,,"11,451
https://www.amazon.com/Resident-Evil-Village-Deluxe-PlayStation-5/dp/B08TR5R8S4/ref=sr_1_7?dchild=1&keywords=playstation+5&qid=1611928056&sr=8-7,"Resident Evil Village Deluxe Edition - PlayStation 5 Deluxe Edition",69.99,,
https://www.amazon.com/Demons-Souls-PlayStation-5/dp/B08FC5TTBF/ref=sr_1_8?dchild=1&keywords=playstation+5&qid=1611928056&sr=8-8,"Demon’s Souls – PlayStation 5",69.89,,"1,963
https://www.amazon.com/gp/slredirect/picassoRedirect.html/ref=pa_sp_mtf_aps_sr_pg1_1?ie=UTF8&adId=A0678777UQU133BE10NC&url=%2FController-Charging-Playstation-Indicator-Game-Boy%2Fdp%2FB08QNJNXNF%2Fref%3Dsr_1_9_sspa%3Fdchild%3D1%26keywords%3Dplaystation%2B5%26qid%3D1611928056%26sr%3D8-9-spons%26psc%3D1&qualifier=1611928056&id=1074325077257761&widgetName=sp_mtf,"PS5 Controller Charger, Charging Dock for Playstation 5 / PS5/ Controller, OIVO PS5 Controller Charging Dock Station with 2 USB-C Adapter with LED Indicator",17.99,,2
https://www.amazon.com/gp/slredirect/picassoRedirect.html/ref=pa_sp_mtf_aps_sr_pg1_1?ie=UTF8&adId=A056102415216X4GXFBHL&url=%2FController-DualSense-Orgaization-Accessories-playstation-5%2Fdp%2FB08R8DVJ8K%2Fref%3Dsr_1_10_sspa%3Fdchild%3D1%26keywords%3Dplaystation%2B5%26qid%3D1611928056%26sr%3D8-10-spons%26psc%3D1&qualifier=1611928056&id=1074325077257761&widgetName=sp_mtf,"PS5 Controller Charger Station,Double Charging Dock for DualSense Wireless Controller with Type-C USB Cable Play Station 5 Consle Orgaization Accessories Station",17.39,,
https://www.amazon.com/Persona-5-Strikers-PlayStation-4/dp/B08Q6YYLN5/ref=sr_1_11?dchild=1&keywords=playstation+5&qid=1611928056&sr=8-11,"Persona 5 Strikers - PlayStation 4",59.99,,
https://www.amazon.com/Marvels-Spider-Man-Morales-Ultimate-Launch-PlayStation/dp/B08FC66ZV4/ref=sr_1_12?dchild=1&keywords=playstation+5&qid=1611928056&sr=8-12,"Marvel's Spider-Man: Miles Morales Ultimate Launch Edition – PlayStation 5",69.97,,"3,468
https://www.amazon.com/PlayStation-5-DualSense-Wireless-Controller/dp/B08H99BPJN/ref=sr_1_13?dchild=1&keywords=playstation+5&qid=1611928056&sr=8-13,"PlayStation 5 DualSense Wireless Controller",79.95,,"9,685
https://www.amazon.com/Sackboy-Big-Adventure-PlayStation-5/dp/B08FC64CNF/ref=sr_1_14?dchild=1&keywords=playstation+5&qid=1611928056&sr=8-14,"Sackboy: A Big Adventure – PlayStation 5",,,911

Вывод названия, цены и валюты#

Формат результата:

$products.format('$title, $price, $oldprice, $currency\n');

Пример результата:

Vertical Stand with Dual Cooling Fans for Sony PS5 Digital Edition & PS5 UHD with 2 DualSense PS5 Controller Chargers and 3 USB Ports for Sony Playstation 5 DE & UHD Edition, 39.99, $46.99, $
Marvel's Spider-Man: Miles Morales Ultimate Launch Edition – PlayStation 5, 69.99, , $
Ps5 skin protective wrap customizable cover vinyl sticker decals for sony playstation 5 disk version console and two dual sense 5 sticker skins cyber net yellow black blue, 21.99, , $
Werewolf: The Apocalypse - Earthblood (PS5) - PlayStation 5, 49.99, , $
Sackboy: A Big Adventure – PlayStation 5, 59.99, , $
Charger Stand for PS5 DualSense Controller, MENEEA Controller Type-C Fast Dual Charging Station Dock with LED Indicator for Sony Playstation 5 with Dual Detachable USB C Ports, 14.99, $17.99, $
HEYSTOP PS5 Controller Charger, PS5 Wireless Charger DualSense Fast Charging Station Compatible with Sony Playstation 5 Controller, 15.99, , $
Marvel’s Spider-Man: Miles Morales Launch Edition – PlayStation 5, 49.44, , $
CYTXSWARDWELL PS5 Controller Charger, Dual USB PS5 Controller Charging Station, for Playstation 5 Console DualSense PS5 Controllers. (Pearl White), 18.99, , $
Seltureone Compatible for Playstation 5 Media Remote Cover, Silicone Protective Case Sleeve for PS5 Remote Control, Shock Absorption Washable, White, 9.95, , $
PS5 Controller Cover Case, Anti-Slip Silicone Skin Protective Cover Case for Playstation 5 DualSense Wireless Controller with 8 Thumb Grip Caps(Comics Dynamic), 11.99, , $

Вывод c названиями переменных#

Формат результата:

$products.format('Название: $title, Цена: $price, Валюта: $currency\n');

Пример результата:

Название: Resident Evil Village Deluxe Edition - PlayStation 5 Deluxe Edition, Цена: 69.99, Валюта: $
Название: DualSense Wireless Controller, Цена: 69.98, Валюта: $
Название: Persona 5 Strikers - PlayStation 4, Цена: 59.99, Валюта: $
Название: Assassin’s Creed Valhalla PlayStation 5 Standard Edition, Цена: 34.99, Валюта: $
Название: Demon’s Souls – PlayStation 5, Цена: 69.99, Валюта: $
Название: NexiGo Dobe PS5 Controller Charger, Upgraded Playstation 5 Charging Station Dock with LED Indicator, Safety Chip Protection, Dual USB Type C Fast Charging, for Sony DualSense Controller, White, Цена: 19.99, Валюта: $
Название: PS5 Controller Charger, Charging Dock for Playstation 5 / PS5/ Controller, OIVO PS5 Controller Charging Dock Station with 2 USB-C Adapter with LED Indicator, Цена: 17.99, Валюта: $
Название: PlayStation 5 DualSense Wireless Controller, Цена: 79.95, Валюта: $

Вывод c новой переменной#

Выведем результат, с переменной total_price, которая равна сумме товара + стоимость доставки, цена доставки условная (50$)

Формат результата:

[% FOREACH item IN p1.products;
total_price = item.price + 50;
tools.CSVline(item.title, item.price, total_price );
END; %]

Пример результата:

Charger Stand for PS5 DualSense Controller, MENEEA Controller Type-C Fast Dual Charging Station Dock with LED Indicator for Sony Playstation 5 with Dual Detachable USB C Ports",14.99,64.99
"Marvel's Spider-Man: Miles Morales Ultimate Launch Edition – PlayStation 5",69.99,119.99
"PlayStation 5 DualSense Wireless Controller",79.95,129.95
"HEYSTOP PS5 Controller Charger, PS5 Wireless Charger DualSense Fast Charging Station Compatible with Sony Playstation 5 Controller",15.99,65.99
"PS5 Controller Charger, Charging Dock for Playstation 5 / PS5/ Controller, OIVO PS5 Controller Charging Dock Station with 2 USB-C Adapter with LED Indicator",17.99,67.99
"PS5 Controller Cover Case, Anti-Slip Silicone Skin Protective Cover Case for Playstation 5 DualSense Wireless Controller with 8 Thumb Grip Caps(Comics Dynamic)",11.99,61.99
"PomisGam Vertical Stand for Playstation 5 with Cooling Fan Charing Station for PS5 Digital Edition/PS5 Ultra HD,Multi-Function Charger Station with 2 Controller Charging Docks",35.99,85.99
"Vertical Stand with Dual Cooling Fans for Sony PS5 Digital Edition & PS5 UHD with 2 DualSense PS5 Controller Chargers and 3 USB Ports for Sony Playstation 5 DE & UHD Edition",39.99,89.99
"Persona 5 Strikers - PlayStation 4",59.99,109.99
"FYOUNG Controller Charging Station for PS5, Charging Dock Compatible for Playstation 5 DualSense Wireless Controller with LED Light Indicators and USB C Cable",16.99,66.99
"PlayStation 5 Console",,50
"Resident Evil Village - PlayStation 5 Standard Edition",59.99,109.99

Сохранение в формате SQL#

Формат результата:

[% FOREACH item IN p1.products; "INSERT INTO products VALUES('" _ item.title _ "', '"; item.link _ "', '"; item.price _ "', '"; item.currency _ "')\n"; END %]

Пример результата:

INSERT INTO products VALUES('Resident Evil Village Deluxe Edition - PlayStation 5 Deluxe Edition', 'https://www.amazon.com/Resident-Evil-Village-Deluxe-PlayStation-5/dp/B08TR5R8S4/ref=sr_1_1?dchild=1&keywords=playstation+5&qid=1611934195&sr=8-1', '69.99', '$')
INSERT INTO products VALUES('DualSense Wireless Controller', 'https://www.amazon.com/DualSense-Wireless-Controller-PlayStation-5/dp/B08FC6C75Y/ref=sr_1_2?dchild=1&keywords=playstation+5&qid=1611934195&sr=8-2', '69.98', '$')
INSERT INTO products VALUES('Assassin’s Creed Valhalla PlayStation 5 Standard Edition', 'https://www.amazon.com/Assassins-Creed-Valhalla-PlayStation-5-Standard/dp/B08FS5HKTR/ref=sr_1_3?dchild=1&keywords=playstation+5&qid=1611934195&sr=8-3', '34.99', '$')
INSERT INTO products VALUES('Demon’s Souls – PlayStation 5', 'https://www.amazon.com/Demons-Souls-PlayStation-5/dp/B08FC5TTBF/ref=sr_1_4?dchild=1&keywords=playstation+5&qid=1611934195&sr=8-4', '68.95', '$')
INSERT INTO products VALUES('Charger Stand for PS5 DualSense Controller, MENEEA Controller Type-C Fast Dual Charging Station Dock with LED Indicator for Sony Playstation 5 with Dual Detachable USB C Ports', 'https://www.amazon.com/DualSense-Controller-MENEEA-Playstation-Detachable/dp/B08L7N3MF1/ref=sr_1_5?dchild=1&keywords=playstation+5&qid=1611934195&sr=8-5', '14.99', '$')
INSERT INTO products VALUES('Marvel's Spider-Man: Miles Morales Ultimate Launch Edition – PlayStation 5', 'https://www.amazon.com/Marvels-Spider-Man-Morales-Ultimate-Launch-PlayStation/dp/B08FC66ZV4/ref=sr_1_6?dchild=1&keywords=playstation+5&qid=1611934195&sr=8-6', '69.99', '$')
INSERT INTO products VALUES('PlayStation 5 DualSense Wireless Controller', 'https://www.amazon.com/PlayStation-5-DualSense-Wireless-Controller/dp/B08H99BPJN/ref=sr_1_7?dchild=1&keywords=playstation+5&qid=1611934195&sr=8-7', '79.95', '$')
INSERT INTO products VALUES('Vertical Stand with Dual Cooling Fans for Sony PS5 Digital Edition & PS5 UHD with 2 DualSense PS5 Controller Chargers and 3 USB Ports for Sony Playstation 5 DE & UHD Edition', 'https://www.amazon.com/Vertical-DualSense-Controller-Chargers-Playstation-5/dp/B08NL49YJ3/ref=sr_1_8?dchild=1&keywords=playstation+5&qid=1611934195&sr=8-8', '39.99', '$')
INSERT INTO products VALUES('PomisGam Vertical Stand for Playstation 5 with Cooling Fan Charing Station for PS5 Digital Edition/PS5 Ultra HD,Multi-Function Charger Station with 2 Controller Charging Docks', 'https://www.amazon.com/PomisGam-Vertical-Playstation-Multi-Function-Controller/dp/B08PNZXGMY/ref=sr_1_11?dchild=1&keywords=playstation+5&qid=1611934195&sr=8-11', '35.99', '$')
INSERT INTO products VALUES('Persona 5 Strikers - PlayStation 4', 'https://www.amazon.com/Persona-5-Strikers-PlayStation-4/dp/B08Q6YYLN5/ref=sr_1_12?dchild=1&keywords=playstation+5&qid=1611934195&sr=8-12', '59.99', '$')
INSERT INTO products VALUES('HEYSTOP PS5 Controller Charger, PS5 Wireless Charger DualSense Fast Charging Station Compatible with Sony Playstation 5 Controller', 'https://www.amazon.com/HEYSTOP-Controller-DualSense-Compatible-Playstation/dp/B08R3K1977/ref=sr_1_13?dchild=1&keywords=playstation+5&qid=1611934195&sr=8-13', '15.99', '$')
INSERT INTO products VALUES('PlayStation 5 Console', 'https://www.amazon.com/PlayStation-5-Console/dp/B08FC5L3RG/ref=sr_1_14?dchild=1&keywords=playstation+5&qid=1611934195&sr=8-14', '', '')

Дамп результатов в JSON#

Формат результата:

[% data = {}; data.items = []; FOREACH i IN p1.products; item = {}; item.link = i.link; item.name = i.title; item.price = i.price; data.items.push(item); END; result = {}; result = data; result.json; %]
{
"items": [
{
"link": "https://www.amazon.com/Controller-Protector-Playstation-Anti-Slip-Christmas/dp/B08CVRCFK3/ref=sr_1_18?dchild=1&keywords=playstation+5&qid=1611933831&sr=8-18",
"name": "2 Pack PS5 Controller Skin Covers Xmas Gifts for Men Women Hubby Wife Friends Grip Protector with 16 pcs Thumb Grip Caps for Sony Playstation 5 Anti-Slip Silicone",
"price": "10.90"
},
{
"link": "https://www.amazon.com/Controller-Protector-Playstation-Anti-Slip-Christmas/dp/B08CVRCFK3/ref=sr_1_18?dchild=1&keywords=playstation+5&qid=1611933831&sr=8-18",
"name": "2 Pack PS5 Controller Skin Covers Xmas Gifts for Men Women Hubby Wife Friends Grip Protector with 16 pcs Thumb Grip Caps for Sony Playstation 5 Anti-Slip Silicone",
"price": "10.90"
},
{
"link": "https://www.amazon.com/Controller-Protector-Playstation-Anti-Slip-Christmas/dp/B08CVRCFK3/ref=sr_1_18?dchild=1&keywords=playstation+5&qid=1611933831&sr=8-18",
"name": "2 Pack PS5 Controller Skin Covers Xmas Gifts for Men Women Hubby Wife Friends Grip Protector with 16 pcs Thumb Grip Caps for Sony Playstation 5 Anti-Slip Silicone",
"price": "10.90"
},
{
"link": "https://www.amazon.com/Controller-Protector-Playstation-Anti-Slip-Christmas/dp/B08CVRCFK3/ref=sr_1_18?dchild=1&keywords=playstation+5&qid=1611933831&sr=8-18",
"name": "2 Pack PS5 Controller Skin Covers Xmas Gifts for Men Women Hubby Wife Friends Grip Protector with 16 pcs Thumb Grip Caps for Sony Playstation 5 Anti-Slip Silicone",
"price": "10.90"
},
{
"link": "https://www.amazon.com/Controller-Protector-Playstation-Anti-Slip-Christmas/dp/B08CVRCFK3/ref=sr_1_18?dchild=1&keywords=playstation+5&qid=1611933831&sr=8-18",
"name": "2 Pack PS5 Controller Skin Covers Xmas Gifts for Men Women Hubby Wife Friends Grip Protector with 16 pcs Thumb Grip Caps for Sony Playstation 5 Anti-Slip Silicone",
"price": "10.90"
}
]
}

Вывод результата с датой парсинга#

Выведем результат, с переменной total_price, которая равна сумме товара + макс.стоимость доставки

Формат результата:

[% USE date;
d = date.format(mytime, format = "%Y %d %H:%M");
FOREACH item IN p1.products;
total_price = item.price + 50;
tools.CSVline(d, item.title, item.price, item.link, total_price );
END; %]

Пример результата:

"2021 29 18:31","PlayStation 5 Console",,https://www.amazon.com/PlayStation-5-Console/dp/B08FC5L3RG/ref=sr_1_1?dchild=1&keywords=playstation+5&qid=1611934312&sr=8-1,50
"2021 29 18:31","PlayStation 4 Console - 1TB Slim Edition",384.99,https://www.amazon.com/PlayStation-4-Console-1TB-Slim/dp/B074LRF639/ref=sr_1_2?dchild=1&keywords=playstation+5&qid=1611934312&sr=8-2,434.99
"2021 29 18:31","PlayStation VR Marvel's Iron Man VR Bundle",349.99,https://www.amazon.com/PlayStation-Marvels-Iron-Man-Bundle-4/dp/B08NRGF2DL/ref=sr_1_3?dchild=1&keywords=playstation+5&qid=1611934312&sr=8-3,399.99
"2021 29 18:31","Turtle Beach Stealth 600 White Gen 2 Wireless Gaming Headset for PlayStation 5 and PlayStation 4",99.95,https://www.amazon.com/Stealth-Wireless-Gaming-Headset-PlayStation-Console/dp/B08D44WZTS/ref=sr_1_4?dchild=1&keywords=playstation+5&qid=1611934312&sr=8-4,149.95
"2021 29 18:31","$100 PlayStation Store Gift Card [Digital Code]",100.00,https://www.amazon.com/PlayStation-Store-Gift-Card-Digital/dp/B00K59HKIQ/ref=sr_1_5?dchild=1&keywords=playstation+5&qid=1611934312&sr=8-5,150
"2021 29 18:31","Oculus Quest 2 — Advanced All-In-One Virtual Reality Headset — 256 GB",399.00,https://www.amazon.com/Oculus-Quest-Advanced-All-One-2/dp/B08F7PTF54/ref=sr_1_6?dchild=1&keywords=playstation+5&qid=1611934312&sr=8-6,449
"2021 29 18:31","DualSense Wireless Controller",69.98,https://www.amazon.com/DualSense-Wireless-Controller-PlayStation-5/dp/B08FC6C75Y/ref=sr_1_7?dchild=1&keywords=playstation+5&qid=1611934312&sr=8-7,119.98
"2021 29 18:31","Resident Evil Village Deluxe Edition - PlayStation 5 Deluxe Edition",69.99,https://www.amazon.com/Resident-Evil-Village-Deluxe-PlayStation-5/dp/B08TR5R8S4/ref=sr_1_8?dchild=1&keywords=playstation+5&qid=1611934312&sr=8-8,119.99
"2021 29 18:31","Demon’s Souls – PlayStation 5",68.95,https://www.amazon.com/Demons-Souls-PlayStation-5/dp/B08FC5TTBF/ref=sr_1_10?dchild=1&keywords=playstation+5&qid=1611934312&sr=8-10,118.95
"2021 29 18:31","Marvel's Spider-Man: Miles Morales Ultimate Launch Edition – PlayStation 5",69.99,https://www.amazon.com/Marvels-Spider-Man-Morales-Ultimate-Launch-PlayStation/dp/B08FC66ZV4/ref=sr_1_11?dchild=1&keywords=playstation+5&qid=1611934312&sr=8-11,119.99
"2021 29 18:31","Persona 5 Strikers - PlayStation 4",59.99,https://www.amazon.com/Persona-5-Strikers-PlayStation-4/dp/B08Q6YYLN5/ref=sr_1_12?dchild=1&keywords=playstation+5&qid=1611934312&sr=8-12,109.99

Возможные настройки#

ПараметрЗначение по умолчаниюОписание
Pages count5Количество страниц для парсинга
Amazon domainUnited StatesДомены Amazon в разных доменных зонах
AntiGate presetdefaultПресет Внтигейта для включения разгадывания каптч
Последнее обновление