Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

crawler.config.js 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. screenshot: {
  22. // 视口尺寸
  23. viewport: {
  24. width: 1920,
  25. height: 1080
  26. },
  27. // 截图选项
  28. options: {
  29. fullPage: false,
  30. quality: 60, // 图片质量 0-100
  31. type: 'png' // 图片格式: 'png' | 'jpeg'
  32. }
  33. }
  34. },
  35. // 亚马逊配置
  36. amazon: {
  37. selectors: {
  38. title: '#productTitle',
  39. price: 'span.a-price > span.a-offscreen',
  40. coupon: '.a-declarative[data-action="a-modal"], .couponLabelText',
  41. variants: '.a-cardui-body #twister-plus-inline-twister > .a-section'
  42. },
  43. timeouts: {
  44. pageLoad: 600000,
  45. elementWait: 100000,
  46. networkIdle: 50000
  47. },
  48. retry: {
  49. maxAttempts: 3,
  50. delay: 6000
  51. },
  52. headers: {
  53. }
  54. },
  55. // 乐天配置
  56. rakuten: {
  57. selectors: {
  58. title: '.normal_reserve_item_name',
  59. price: 'span[irc="Price"] .number-display--3s4mj',
  60. coupon: '',
  61. variants: ''
  62. },
  63. timeouts: {
  64. pageLoad: 60000,
  65. elementWait: 10000,
  66. networkIdle: 50000
  67. },
  68. retry: {
  69. maxAttempts: 3,
  70. delay: 6000
  71. },
  72. headers: {
  73. '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',
  74. 'Accept-Language': 'ja-JP,ja;q=0.9,en-US;q=0.8,en;q=0.7'
  75. }
  76. },
  77. // 雅虎配置(预留)
  78. yahoo: {
  79. selectors: {},
  80. timeouts: {
  81. pageLoad: 5000,
  82. elementWait: 1000,
  83. networkIdle: 500
  84. },
  85. retry: {
  86. maxAttempts: 3,
  87. delay: 1000
  88. }
  89. }
  90. };