Post on Steemit from Twitter, it's awesome just do it

in #steemit6 years ago (edited)

cypromo.jpg

So, let's cut to the chase. Twitter's bigger, more people use it, and I'm not sure if anyone has made a twitter to steemit poster yet, so I'm going with no they haven't except for this little project of mine. Also, you've probably already signed your soul away on twitter several times but what is this new agreement on Steemit, screw that, probably signed one when we first got on but whatever, who ever looked at the details in a revolution. Don't want to sign the new Steemit agreement and post from your twitter in defiance? I've got just the thing.

CYBERSTEEM

What is @cybersteem? Just an account I opened a while ago for an idea. Since then I've decided to latch my little TwitterToSteem or TTS project to the account as I'm fairly busy but soon, soon.

Anyways, if you, traveling stranger, are curious about the functionality:

  • You can chain tweets into one steemit post.
  • You can grab tweets from any twitter account.
  • The first sentence of a tweet or chain of them becomes the title of the steemit post.
  • The first hashtag in a tweet becomes the main tag here, or you could use the default "steemit", or you could use your own default.
  • Hashtags after the first become normal steemit tags.
  • You can specify some tags which always get added by default.
  • Pictures show up split by hr html elements respective to where they are in a tweet or chain of tweets.
  • Hashtags and @ accounts on twitter show up here with correct links.
  • Pure links, not the fancy iframe stuff, from twitter also work.
  • To update settings, simply add a new comment to this post, only the most recent validly formatted comment is looked at.
  • To quit the service, just comment "x", only a single x in a comment to this post will delist you.
  • For now, to reference a steemit account in a twitter post, you have to wrap it in ~ such as ~loshcat~ in the twitter post itself.
  • For now, only tweets that end in these: '. ! ?' will be posted, and that means that the very last character in the tweet's text has to be a sentence ender. Also, you need a first sentence to make the title, but you do not need any more text in a tweet than that.
  • Lastly, to chain tweets just make sure that the last character in a tweet is a hyphen: '-'. To close the chain use a sentence ender as the final character in the last tweet. In twitter the chain will be upside down because the most recent tweet would be last, but this is fixed for steemit.

That's the major stuff for now.

Posting Authorization

For this to work, you need to have @cybersteem added as an account authorized to use your posting rights. First off, I sincerely promise to never use this authority malevolently.

Because as far as I know the only front-end for post-auth is steemconnect, and they only let you do it with paid-for accounts, I was going to make my own little front-end webby site but decided they would look quite shady. Instead I will post some basic code that very transparently updates your account and only adds @cybersteem as an authorized poster.

To do so, simply make a new folder, then make two files inside of it named "index.html" and "main.js". In the Index one write this:

Index.html

<!DOCTYPE html>
<html>
    
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Account Update</title>
    <script src="https://cdn.steemjs.com/lib/latest/steem.min.js"></script>
    <script src="main.js"></script>
</head>
    
<body>
    
    <div id="a">Account Info</div>
    
</body>
    
</html>

In the JS one write this:

main.js

window.addEventListener('DOMContentLoaded', function() {
    divRef = document.getElementById('a');
    addPAuth();
}, false);

function addPAuth() {
    steem.api.getAccounts(['YOUR_ACCOUNT_HERE'], (err, result) => {
        
        var postAuths = result[0].posting;
        postAuths.account_auths.push(['cybersteem', 1]);
        
        steem.broadcast.accountUpdate(
            'YOUR_ACTIVE_OR_OWNER_KEY_HERE', // active or owner key
            'YOUR_ACCOUNT_HERE', // your username
            undefined, // owner - undefined makes it so authorities do not change, these are authority objects
            undefined, // active
            postAuths, // posting
            'YOUR_PUBLIC_MEMO_KEY_HERE', // public memo key found on steemit or easily on steemd
            result[0].json_metadata,
            (err, result) => {
                console.log(err, result);
                divRef.innerText = !err ? 'Successful: ' + JSON.stringify(result) : err;
            }
        );
    });
}

Stuff that has "YOUR" in it, you need to fill out. Should be pretty safe as long as your network hasn't been explicitly compromised. After saving the code above, just double click on the index.html file and that should be it. If you want to run it through node, just copy the addPAuth function in a js file, delete the divRef part, and run it.

SIGN-UP COMMENT

If you haven't run away, you may be wondering how to sign up or specify some controls. Well, that is simple, just make a comment directly on this post that is correctly formatted and that's it. Here are the parameters:

  • twitter - necessary - just the twitter account name you want to post from.
  • tURL - necessary - the https url of your twitter homepage.
  • defaultCat - optional - The default main tag to use for steemit for each tweet. Default is "steemit"
  • defaultTags - optional - A set of tags that always get added.
  • catOverride - optional - true or false value denoting whether you want to always have your defaultCat tag be the main tag, or only if there are no hashtags. If you don't add it, it defaults to false meaning that first hashtag overrides your default.

To format all that into a comment, just put it into JSON format such as the following:

{"twitter": "SuperTinyBird", "tURL": "https://twitter.com/SuperTinyBird", "defaultCat": "steemit", "defaultTags": ["twitter", "life"], "catOverride": true}

Notes: All key names such as twitter or tURL have to be in "parentheses" then a ':' is needed then a ',' comma then parentheses for each value except defaultTags which needs brackets around comma split string values. The catOverride does not have parentheses, just true or false. Last value does not need a comma after it. Also, the tag 'cybersteem' gets auto-added to each tweet post and a beneficiary amount of 7% is awarded to the cybersteem account because... 7 is a lucky number.

I am not exempt from the signup, I ran the code above myself to authorize this account, and now I will be the first to sign-up, hopefully not the only lol. So below should be the fully transparent comment containing the sign-up options of loshcat.
Hope you enjoy, have a good one!

Sort:  

fucking finally, campaign time
{"twitter": "officialmcafee", "tURL": "https://twitter.com/officialmcafee", "defaultCat": "mcafee2020", "defaultTitle": "McAfee2020", "catOverride": false, "justOne": true, "retweets": true}

Wow, the totally actually genuine McAfee! Such pressure, much expectations. Wish I knew ahead of time that I'd be a part of the campaign. You might have to take some broken posts and titles and a few fat downvotes for a bit lol

{"twitter": "SuperTinyBird", "tURL": "https://twitter.com/SuperTinyBird", "defaultCat": "steemit", "defaultTags": ["life"], "catOverride": false}

{"twitter": "SuperTinyBird", "tURL": "https://twitter.com/SuperTinyBird", "defaultCat": "steemit", "defaultTitle": "Another tweet bites the dust, and another one gone and another one gone...", "defaultTags": ["life"], "catOverride": false, "anyMine": false, "retweets": true}

{"twitter": "SuperTinyBird", "tURL": "https://twitter.com/SuperTinyBird", "defaultCat": "steemit", "defaultTitle": "Another tweet bites the dust, and another one gone and another one gone...", "defaultTags": ["life"], "catOverride": false, "justOne": true, "retweets": true}