Преглед изворни кода

add date and carousel_id to Instagram file name

Artur Paikin пре 7 година
родитељ
комит
4808d7625b
1 измењених фајлова са 10 додато и 2 уклоњено
  1. 10 2
      src/plugins/Instagram/index.js

+ 10 - 2
src/plugins/Instagram/index.js

@@ -100,8 +100,16 @@ module.exports = class Instagram extends Plugin {
 
   getItemName (item) {
     if (item && item['created_time']) {
-      let date = new Date(item['created_time'] * 1000).toUTCString()
-      return `Instagram ${date}`
+      let date = new Date(item['created_time'] * 1000)
+      date = date.toLocaleDateString([], {
+        year: 'numeric',
+        month: 'short',
+        day: 'numeric',
+        hour: 'numeric',
+        minute: 'numeric'
+      })
+      // adding both date and carousel_id, so the name is unique
+      return `Instagram ${date} ${item.carousel_id || ''}`
     }
     return ''
   }