mirror of
https://github.com/anatolykopyl/vk-nft-feed.git
synced 2026-03-26 04:44:34 +00:00
Renamed file
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import getPosts from './getPosts.js';
|
||||
import post2Svg from './post2Svg.js';
|
||||
import postToImage from './postToImage.js';
|
||||
|
||||
function filterPosts(posts) {
|
||||
return posts.filter((post) => {
|
||||
@@ -21,9 +21,9 @@ export default async function(owner_id) {
|
||||
|
||||
let images = [];
|
||||
|
||||
posts.forEach((post) => {
|
||||
images.push(post2Svg(post));
|
||||
})
|
||||
for (const post of posts) {
|
||||
images.push(await postToImage(post));
|
||||
}
|
||||
|
||||
return images;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import axios from 'axios';
|
||||
import ProgressBar from 'progress';
|
||||
|
||||
const DELAY = 3000;
|
||||
|
||||
async function getPosts(owner_id, offset) {
|
||||
const res = await axios.get('https://api.vk.com/method/wall.get', {
|
||||
params: {
|
||||
@@ -42,7 +44,7 @@ export default async function getAllPosts(owner_id) {
|
||||
finished = true;
|
||||
} else {
|
||||
offset += response.items.length;
|
||||
await new Promise(r => setTimeout(r, 5000));
|
||||
await new Promise(r => setTimeout(r, DELAY));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
975
package-lock.json
generated
975
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -15,6 +15,7 @@
|
||||
"dotenv": "^14.2.0",
|
||||
"progress": "^2.0.3",
|
||||
"rareterm.node": "^0.0.10",
|
||||
"sharp": "^0.29.3",
|
||||
"svgdom": "^0.1.10"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {createSVGWindow} from 'svgdom';
|
||||
import {SVG, registerWindow} from '@svgdotjs/svg.js';
|
||||
// import sharp from 'sharp';
|
||||
|
||||
function makeSvg(images) {
|
||||
const spacing = 50;
|
||||
@@ -19,6 +20,10 @@ function makeSvg(images) {
|
||||
return draw.svg();
|
||||
}
|
||||
|
||||
// function svgToPng(svg) {
|
||||
// return sharp(Buffer.from(svg)).toBuffer();
|
||||
// }
|
||||
|
||||
export default function(post) {
|
||||
const photoAttachments = post.attachments.filter((attachment) => {
|
||||
return attachment.photo;
|
||||
Reference in New Issue
Block a user