Renamed file

This commit is contained in:
2022-01-23 04:22:13 +03:00
parent d5cff0e788
commit 9702be4463
5 changed files with 948 additions and 45 deletions

View File

@@ -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;
}

View File

@@ -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

File diff suppressed because it is too large Load Diff

View File

@@ -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"
}
}

View File

@@ -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;