Chytame chyby, pouzivame http.

master
severak 2020-05-28 12:51:30 +02:00
parent bd224a3b9e
commit 4b6ecc708a
1 changed files with 8 additions and 2 deletions

View File

@ -6,7 +6,13 @@ const mustache = require("mustache");
console.log('downloading tilde.town homepage...'); console.log('downloading tilde.town homepage...');
axios.get('https://tilde.town/').then(function (response) { axios.get('http://tilde.town/').then(function (response) {
if (response.status != 200) {
console.log('Chyba!');
return 0;
}
let userRegex = /<a href="\/~(\w+)">[\w]+<\/a>/g; let userRegex = /<a href="\/~(\w+)">[\w]+<\/a>/g;
var users = Array.from(response.data.matchAll(userRegex), function (result) { var users = Array.from(response.data.matchAll(userRegex), function (result) {
return result[1]; return result[1];
@ -32,7 +38,7 @@ axios.get('https://tilde.town/').then(function (response) {
setTimeout(() => { setTimeout(() => {
(async () => { (async () => {
console.log('downloading ' + user + '...'); console.log('downloading ' + user + '...');
await captureWebsite.file('https://tilde.town/~'+user+'/', user+'.png', { await captureWebsite.file('http://tilde.town/~'+user+'/', user+'.png', {
scaleFactor: 0.5, scaleFactor: 0.5,
overwrite: true, overwrite: true,
timeout: 5 timeout: 5