node
Este commit está contenido en:
54
development/node/follow/follow-federationbot.js
Archivo normal
54
development/node/follow/follow-federationbot.js
Archivo normal
@@ -0,0 +1,54 @@
|
||||
'use strict'
|
||||
const requestsync = require('sync-request')
|
||||
|
||||
/*let body = requestsync('GET', 'https://social.hatthieves.es/api/v1/instance/peers'),
|
||||
urls = JSON.parse(body.getBody())*/
|
||||
|
||||
//for (let url of urls) {
|
||||
let url = 'social.hatthieves.es',
|
||||
count = 100
|
||||
// try {
|
||||
let actors,
|
||||
followed = [],
|
||||
body
|
||||
do {
|
||||
let id = actors && actors.length > 0 ? actors[actors.length - 1].id : ''
|
||||
body = requestsync('GET', 'https://ale:pleroma.@' + url + '/api/v1/accounts/9kSZXaByPLAFWK949A/following?max_id=' + id + '&limit=' + count)
|
||||
try {
|
||||
actors = JSON.parse(body.getBody())
|
||||
if (actors && actors.length > 0) {
|
||||
for (let a of actors) {
|
||||
if (a && a.id && !followed.some(f => f === a.id)) {
|
||||
followed.push(a.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
console.log('Loading users: ' + followed.length)
|
||||
} while (actors && actors.length >= count && body.statusCode === 200)
|
||||
// actors = []
|
||||
do {
|
||||
let id = actors && actors.length > 0 ? actors[actors.length - 1].id : ''
|
||||
// body = requestsync('GET', 'https://' + url + '/api/statuses/networkpublic_timeline?max_id=' + id + '&only_media=false&count=20&with_muted=true')
|
||||
try {
|
||||
// actors = JSON.parse(body.getBody())
|
||||
if (actors && actors.length > 0) {
|
||||
for (let a of actors) {
|
||||
if (a && a.user && a.user.id) {
|
||||
requestsync('POST', 'https://ale:pleroma.@social.hatthieves.es/api/v1/accounts/' + a.user.id + '/follow')
|
||||
console.log('following: ' + a.user.screen_name)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
console.log(url + ' following: ' + followed.length)
|
||||
} while (actors && actors.length >= 20 && body.statusCode === 200)
|
||||
/* } catch (e) {
|
||||
console.log(e)
|
||||
}*/
|
||||
//}
|
||||
|
||||
Referencia en una nueva incidencia
Block a user