Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

crawler.config.js 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /**
  2. * 爬虫配置
  3. */
  4. module.exports = {
  5. // 通用配置
  6. common: {
  7. screenshotDir: 'screenshots',
  8. upload: {
  9. url: 'https://apibase.sohomall.jp/uploaders',
  10. scene: 'digital-yy',
  11. timeout: 30000 * 5
  12. },
  13. browser: {
  14. headless: true,
  15. args: ['--no-sandbox', '--disable-setuid-sandbox']
  16. },
  17. page: {
  18. locale: 'ja-JP',
  19. }
  20. },
  21. // 亚马逊配置
  22. amazon: {
  23. selectors: {
  24. title: '#productTitle',
  25. price: 'span.a-price > span.a-offscreen',
  26. coupon: '.a-declarative[data-action="a-modal"], .couponLabelText',
  27. variants: '.a-cardui-body #twister-plus-inline-twister > .a-section'
  28. },
  29. timeouts: {
  30. pageLoad: 600000,
  31. elementWait: 100000,
  32. networkIdle: 50000
  33. },
  34. retry: {
  35. maxAttempts: 3,
  36. delay: 6000
  37. },
  38. headers: {
  39. }
  40. },
  41. // 乐天配置
  42. rakuten: {
  43. selectors: {
  44. title: '.normal_reserve_item_name',
  45. price: 'span[irc="Price"] .number-display--3s4mj',
  46. coupon: '',
  47. variants: ''
  48. },
  49. timeouts: {
  50. pageLoad: 60000,
  51. elementWait: 10000,
  52. networkIdle: 50000
  53. },
  54. retry: {
  55. maxAttempts: 3,
  56. delay: 6000
  57. },
  58. headers: {
  59. 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36',
  60. 'Accept-Language': 'ja-JP,ja;q=0.9,en-US;q=0.8,en;q=0.7'
  61. }
  62. },
  63. // 雅虎配置(预留)
  64. yahoo: {
  65. selectors: {},
  66. timeouts: {
  67. pageLoad: 5000,
  68. elementWait: 1000,
  69. networkIdle: 500
  70. },
  71. retry: {
  72. maxAttempts: 3,
  73. delay: 1000
  74. }
  75. }
  76. };