Giter Site home page Giter Site logo

mstdn-ebooks's People

Contributors

benlubar avatar dependabot-preview[bot] avatar kanelillym avatar lfuelling avatar lynnesbian avatar moggers87 avatar notagoat avatar qbfreak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mstdn-ebooks's Issues

The @ and instance name are not removed when someone's handle appears in a toot

I'm not quite sure why it's not doing this as I was sure this was a feature that is implemented. Everything is set up according to the guide, and I re-set up the bot again just now to make sure. Is there a glaringly obvious configuration option that I could be missing?

Running this on ubuntu server 18.04.3 LTS if that matters.

Reorganise into a package

While this project is small, I think it would be a good idea to put the current code into a proper installable package.

I can submit a PR if you like.

Error when decoding Emoji

I got an error when running gen.py with --simulate. Apparently the script fails when trying to decode the "zany-face"-Emoji.

╭─lerk@comm ~/mstdn-ebooks  ‹master*› 
╰─$ python3 ./gen.py --simulate
Traceback (most recent call last):
  File "./gen.py", line 39, in <module>
    print(toot['toot'])
UnicodeEncodeError: 'ascii' codec can't encode character '\U0001f92a' in position 100: ordinal not in range(128)

Can I ignore invalid characters somehow?

Don't create infinite loop threads

There are multiple situations that will cause an ebooks bot to create an infinite reply loop:

  • An ebooks bot mentions another ebooks bot
  • An ebooks bot mentions a bot like OCRbot or that alpine shell bot
  • Alice the Attacker creates a bot that constantly tags random ebooks bots

We need to guard against this. One possible option is to ignore a thread after already replying in it five times.

extract_toot deletes the content of <p> blocks

Hello,

I've tried using this and generation wouldn't work, so I dug into the code and found out that all toots' content in the db were empty. Looking further, I've found the reason : 8274409 line 73

This commit changed the handling of p tags from "Append a line break and unwrap" to "replace with a linebreak". I'm assuming that's an unfortunate copy/paste with the above change about br tags, but either way the result is that all content inside p tags is sent into oblivion. I don't know if it's common or something about my instance but all of my toots' content are wrapped in a p tag, thus the database emptiness. Reverting that change made the code work again for me.

Add 1-button Heroku/Now.sh deployment

Hiiiiii!

Was reading through the ebooks bot guide and it sort of dawned on me that it'd be really simple to set up a button on the repo to deploy it to Now.sh or Heroku (probably the former because it supports Docker).

Docs:

I've only really ever had luck with the latter but I haven't tried Docker on Now.sh yet, might work better.

Happy to PR if it helps! 💚

-Andi

Convey rate limit error better

Right now, rate limiting produces the generic "fucky wucky" error. We should catch the HTTP error (if any) and print something more helpful in case of HTTP 429.

Pleroma toot collection fails

here is the error output, running the latest version from git, i tried twice so it did get through some tootsmews but eventually there came a problem toot

WebFingering...
catgirl.science is a pleroma instance -- falling back to legacy toot collection method
Downloading and parsing tootsEncountered an error! Saving toots to database and exiting.
WebFingering...
catgirl.science is a pleroma instance -- falling back to legacy toot collection method
Downloading and parsing tootsEncountered an error! Saving toots to database and exiting.```

Mastodon users with one post break the script.

I have a user with one post which breaks the script with the following error:

Using config.json as configuration file
Downloading posts for user @robin, starting from 0
WebFingering...
Using Pleroma compatibility mode
Traceback (most recent call last):
  File "main.py", line 199, in <module>
    j = j['first']
KeyError: 'first'

The issue seems to be that the JSON being returned does not contain a next field (presumably because there are no next posts to load) and so the script assumes Pleroma compatibility mode is needed, which then causes the rest of the script to fail.

Grabing posts from Pleroma fails

  1. Clean run without any toots.db generated yet
  2. Bot account is following this accounts (raru.me are mastodon and the other two are pleroma instances)
  3. Running the bot:

Using config.json as configuration file
Downloading posts for user @[email protected], starting from 0
WebFingering...
Using standard mode
Downloading and saving posts............................................ Done!
Downloading posts for user @[email protected], starting from 0
WebFingering...
Using standard mode
Downloading and saving posts................................. Done!
Downloading posts for user @[email protected], starting from 0
WebFingering...
Using standard mode
Downloading and saving posts........... Done!
Downloading posts for user @[email protected], starting from 0
WebFingering...
Using standard mode
Traceback (most recent call last):
File "/app/main.py", line 215, in
j = r.json()
File "/usr/lib/python3.8/site-packages/requests/models.py", line 897, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.8/json/init.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

  1. As it can be seen on the fedi.absturztau.me fails to grab posts.
  2. Re-run the sync:

Using config.json as configuration file
Downloading posts for user @[email protected], starting from 40dd49ac-3b6e-4ea6-9f99-7415a57bed3c
WebFingering...
Using standard mode
Traceback (most recent call last):
File "/app/main.py", line 215, in
j = r.json()
File "/usr/lib/python3.8/site-packages/requests/models.py", line 897, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.8/json/init.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

  1. And now the other pleroma instance (kitsune.cafe) starts failing too. I tried waiting for half an hour in case it was a rate-limit but it still kept failing

Filter out words from learning

Certain terms keep coming up (names of instances, names of people) that I don't want. Allowing a filter to remove certain words from being used in posts by filtering them from being learned from would make the Bot Experience Better

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.