Browse Source

Initial commit

master
ale 4 years ago
commit
115454a7d4
5 changed files with 173 additions and 0 deletions
  1. +1
    -0
      .gitignore
  2. +21
    -0
      README.md
  3. +34
    -0
      follow.js
  4. +12
    -0
      package.json
  5. +105
    -0
      yarn.lock

+ 1
- 0
.gitignore View File

@ -0,0 +1 @@
node_modules

+ 21
- 0
README.md View File

@ -0,0 +1,21 @@
# follow-pleroma
### Follow users in whole network instance of pleroma
## Install
```
yarn or npm i
```
## Usage
```
node follow <url of instance with auth>
Example:
$ node follow `https://user:pass@social.hatthieves.es`
```
## License
MIT

+ 34
- 0
follow.js View File

@ -0,0 +1,34 @@
'use strict'
const requestsync = require('sync-request'),
url = process.argv[2] || 'https://user:pass@social.hatthieves.es'
try {
let actors,
followed = []
do {
let id = actors && actors.length > 0 ? actors[actors.length - 1].id : '',
body = requestsync('GET', 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 && !followed.some(f => f === a.user.id)) {
requestsync('POST', url + '/api/v1/accounts/' + a.user.id + '/follow')
if (a.in_reply_to_user_id && !followed.some(f => f === a.in_reply_to_user_id)) {
requestsync('POST', url + '/api/v1/accounts/' + a.in_reply_to_user_id + '/follow')
followed.push(a.in_reply_to_user_id)
console.log('followed: ' + a.in_reply_to_user_id)
}
followed.push(a.user.id)
console.log('followed: ' + a.user.screen_name)
}
}
}
} catch (e) {
console.log(e)
}
console.log(url)
} while (actors && actors.length >= 20)
} catch (e) {
console.log(e)
}

+ 12
- 0
package.json View File

@ -0,0 +1,12 @@
{
"name": "follow-pleroma",
"version": "1.0.0",
"main": "follow.js",
"repository": "http://gitea.hatthieves.es/manalejandro/follow-pleroma.git",
"author": "ale",
"license": "MIT",
"private": true,
"dependencies": {
"request-sync": "^1.0.0"
}
}

+ 105
- 0
yarn.lock View File

@ -0,0 +1,105 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
concat-stream@~1.4.1:
version "1.4.11"
resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.4.11.tgz#1dc9f666f2621da9c618b1e7f8f3b2ff70b5f76f"
integrity sha512-X3JMh8+4je3U1cQpG87+f9lXHDrqcb2MVLg9L7o8b1UZ0DzhRrUpdn65ttzu10PpJPPI3MQNkis+oha6TSA9Mw==
dependencies:
inherits "~2.0.1"
readable-stream "~1.1.9"
typedarray "~0.0.5"
core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=
esprima@~1.0.3:
version "1.0.4"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.0.4.tgz#9f557e08fc3b4d26ece9dd34f8fbf476b62585ad"
integrity sha1-n1V+CPw7TSbs6d00+Pv0drYlha0=
http-sync-win@^0.0.7:
version "0.0.7"
resolved "https://registry.yarnpkg.com/http-sync-win/-/http-sync-win-0.0.7.tgz#f3fa8e22ddf03d292150d7eab029aef39b79a474"
integrity sha1-8/qOIt3wPSkhUNfqsCmu85t5pHQ=
dependencies:
concat-stream "~1.4.1"
json-literal "~1.1.0"
rimraf "~2.2.5"
shelljs "~0.2.6"
http-sync@^0.0.5:
version "0.0.5"
resolved "https://registry.yarnpkg.com/http-sync/-/http-sync-0.0.5.tgz#d27180f000f275885b0685cd7e93b45aca418ead"
integrity sha1-0nGA8ADydYhbBoXNfpO0WspBjq0=
inherits@~2.0.1:
version "2.0.4"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
isarray@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"
integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=
json-literal@~1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/json-literal/-/json-literal-1.1.0.tgz#60bd4fc601c1408814922d2e42ac4f23da657406"
integrity sha1-YL1PxgHBQIgUki0uQqxPI9pldAY=
dependencies:
esprima "~1.0.3"
type-of "~2.0.0"
qs@^2.2.4:
version "2.4.2"
resolved "https://registry.yarnpkg.com/qs/-/qs-2.4.2.tgz#f7ce788e5777df0b5010da7f7c4e73ba32470f5a"
integrity sha1-9854jld33wtQENp/fE5zujJHD1o=
readable-stream@~1.1.9:
version "1.1.14"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9"
integrity sha1-fPTFTvZI44EwhMY23SB54WbAgdk=
dependencies:
core-util-is "~1.0.0"
inherits "~2.0.1"
isarray "0.0.1"
string_decoder "~0.10.x"
request-sync@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/request-sync/-/request-sync-1.0.0.tgz#8eb6d90cab6fbca59e2b0ea5afbc050421c5eeec"
integrity sha1-jrbZDKtvvKWeKw6lr7wFBCHF7uw=
dependencies:
http-sync-win "^0.0.7"
qs "^2.2.4"
optionalDependencies:
http-sync "^0.0.5"
rimraf@~2.2.5:
version "2.2.8"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.2.8.tgz#e439be2aaee327321952730f99a8929e4fc50582"
integrity sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=
shelljs@~0.2.6:
version "0.2.6"
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.2.6.tgz#90492d72ffcc8159976baba62fb0f6884f0c3378"
integrity sha1-kEktcv/MgVmXa6umL7D2iE8MM3g=
string_decoder@~0.10.x:
version "0.10.31"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94"
integrity sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=
type-of@~2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/type-of/-/type-of-2.0.1.tgz#e72a1741896568e9f628378d816d6912f7f23972"
integrity sha1-5yoXQYllaOn2KDeNgW1pEvfyOXI=
typedarray@~0.0.5:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

Loading…
Cancel
Save