? Editing: Post:21.body Save Delete Cancel
Content changed Sign & Publish new content

BinChan's ZeroNotes

Messy Notes about using ZeroNet and other things
All code published here are under CC-BY-SA licence, if not compatible, then MIT license X)

Follow in NewsfeedFollowing

TOC by date
TOC by tag
View in light theme

Latest comments:

Add new post

Title

21 hours ago · 2 min read ·
3 comments

tag:
Body
Read more

Not found

ZeroMe Mastodon Bridge

on Apr 28, 2017
tag: mastodon script zerome

Another python script :3 This script gives you the power to cross post between ZeroMe and Mastodon, which means when you post something on ZeroMe, it will also post to your Mastodon account, and vice versa.

What is Mastodon? It's a Twitter-like, that based on OStatus protocol, distributed social network, and recently its user base and development are exploding. For more information check its github repository.

Screenshot:

Screenshot
Bildschirmfoto_2017-04-28_23-03-49.png (24x24)

How to Install - ZeroMe Mastodon Bridge:

Unlike Feedbot.py, this time the installation is quite simple. First you need to have an account from a Mastodon instance. Then create a folder named ZeroMeMastodonBridge under your ZeroNet root directory (Or simply use the FeedBot folder if you have created one):
$ cd /path/to/zeronet && mkdir ZeroMeMastodonBridge
Download the script file ↗ or copy it from Nullpaste to the folder, then install dependent packages html2text and Mastodon.py like with $ pip install html2text --user && pip install Mastodon.py --user. That's all.

Run the script with $ python zerome_mastodon_bridge.py, just at the first time it will ask you to input your hub address, ID auth_address, ID auth_privatekey (you can find them in the users.json) and your Mastodon instance website address, your username and password of your Mastodon account.

You can keep repeating the script with $ while sleep TIME_INTERVAL_IN_SECOND; do python zerome_mastodon_bridge.py; done.

PS: The script also supports to set last timestamps without cross-posting anything, with command: $ cd /path/to/zeronet/ZeroMeMastodonBridge && python -c 'from zeronet_mastodon_bridge import initGlobalName, setLastTimestamp; initGlobalName(); setLastTimestamp()'

How to Install - ZeroMe Gnusocial Bridge:

The process is similar to "ZeroMe Mastodon Bridge", but in addition you need to create an
access token dict: First register an OAuth client applicant from Settings -> Connections, then check https://pythonhosted.org/gnusocial/oauth.html to get the access_token dict. Finally copy & paste the dict when running the script at the first time. Script file ↗

For Markdown support, add this, and enable it in Settings.

Bugs and Troubleshooting:

  1. Currently Mastodon doesn't support markdown, so your post from ZeroMe to Mastodon won't be well formatted. But in contrast post from Mastodon to ZeroMe will be formatted, thanks to html2text, though it may still have some bugs. Also Mastodon limits post to 500 characters by default.

Todo^TM:

  • Image support is possible ...
  • ZeroMe API

License:

MIT

A Small Proposal:

Currently ZeroMe still has not many users (though I also like small community), and most hubs have quite heavy limit to content size. But I believe ZeroMe is still quite a promising project . Besides keep improving performance and adding functions, similiar to using same protocol like traditional email service, Diaspora* with Friendica (Friendica also supports connecting to many other websites, before it could also hack Facebook, but later Facebook built some high wall...) and Hubzilla, Mastodon with StatusNet, Gnusocial and Quitter. In the long term it may be better that ZeroMe and ZeroNet can communicate with other distributed (social) network, or just P2P (social) network. Therefore ZeroMe and ZeroNet project won't become an isolated island.

6 Comments:

user_name1 day ago
Reply
Body
schiz0on May 09, 2019
Reply

it don't works anymore, it's a shame!

schiz0on Jun 15, 2018
Reply

I've this error

strptime() argument 1 must be str, not datetime.datetime

so I've included a

argument_to_pass = str(argument_to_pass)

before every strptime()


the timestamp form is:

"%Y-%m-%d %H:%M:%S.%f%z"

without T between date & time and %z instead of Z for the timezone

%z is UTC offset in the form +HHMM or -HHMM
but we need a +HH:MM and I don't know how to make the transformation so... I've forced a +00:00 in the code

I know it's brutal and imbarassing, but now I can use the script

binchan2on Jun 15, 2018
Reply

schiz0: thank you, it's simple,anyway I've new problems ...

This script used "Mastodon.py-1.0.7", probably in later version Mastodon.py changed its API, so you can try with that specific version. Also it's only tested in Python 3.

schiz0on Jun 14, 2018
Reply

balancer73: I have not looked at this bridge, but in ZeroMe the hub is the site on which your data is stored. For example, a link to my profile is http://127.0.0.1:43110/Me.ZeroNetwork.bit/?Profile/1BLueGvui1GdbtsjcKqCf4F67uKfritG49/1PniNzyi8fygvwyBaLpA9oBDVWZ5fXuJUw/balancer73@zeroid.bit
The address of the hub is there: 1BLueGvui1GdbtsjcKqCf4F67uKfritG49

thank you, it's simple,
anyway I've new problems

  File "zerome_mastodon_bridge.py", line 188, in <module>
    accessToMastodon()
  File "zerome_mastodon_bridge.py", line 105, in accessToMastodon
    setLastTimestamp()
  File "zerome_mastodon_bridge.py", line 81, in setLastTimestamp
    timestamp1 = returnLastTimestamp(mastodon)
  File "zerome_mastodon_bridge.py", line 67, in returnLastTimestamp
    timestamp = datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S.%fZ").timestamp()
TypeError: strptime() argument 1 must be str, not datetime.datetime
balancer73on Jun 14, 2018
Reply

schiz0: where can I find my hub address in users.json?

I have not looked at this bridge, but in ZeroMe the hub is the site on which your data is stored. For example, a link to my profile is http://127.0.0.1:43110/Me.ZeroNetwork.bit/?Profile/1BLueGvui1GdbtsjcKqCf4F67uKfritG49/1PniNzyi8fygvwyBaLpA9oBDVWZ5fXuJUw/balancer73@zeroid.bit

The address of the hub is there: 1BLueGvui1GdbtsjcKqCf4F67uKfritG49

schiz0on Jun 14, 2018
Reply

I'm trying to install ZeroMe Mastodon Bridge, but, I'm sorry... where can I find my hub address in users.json?

Select user
  • Welcome to ZeroMessage!
This page is a snapshot of ZeroNet. Start your own ZeroNet for complete experience. Learn More