Package: crossposter
CrossposterCrosspost your articles to dev.to/medium.com/hashnode.com from the command lineCrossposter is a script(Python/BASH) to automate crossposting to platforms like dev.to, medium.com and hashnode.com. The script takes in markdown version of your post with a few inputs from you and posts it to those platforms. You would require a token/key for each of those platforms to post it from the command line.There are two versions of the script:PythonShellscript(BASH)The actual script is still not perfect (has a few bugs). Though it posts ondev.toandmedium.comeasily, thehashnode.comis buggy as it parses the raw markdown into the post and doesn't render as desired. So,its a under-development script, fell free to raise any issues or PRs on the official GitHub repo.Crossposter Python ScriptThe python script initially is now a python package. You can essily install and configure it as per your requirements.Dependencies for the python script:requestspyyamlpython-frontmatterrichRunning the script:Make sure you install the python package with pip or any other package manager like pipenv or poetry you would like:pip install crossposter

# OR

pipenv install crossposter

# OR

poetry install crossposter

# OR

pipx install crossposterConfigurationCreate a config fileconfig.jsonfor customizationCreate a folder for the output filesInside the config file, you can specify the two attributes for the working of the script. The first is for generating thecanonical_urlfor the post and the next is the output folder for the generated files for different platforms.{"blog_link":"https://www.meetgor.com/","output_folder":"crossout"}One it is installed, you can then specify the markdown file which you want to use as a post with:crosspost <filename>.md

# OR with pipx

pipx run crossposterThis will prompt you for a few things, if not provided in the frontmatter of the command. There will be need of inputs liketitle,description,tags,status,cover-image, etc. If you provide it in the frontmatter, there will be no input prompt. Once the input is taken or the frontmatter is picked, it will set those frontmatter for various publications automatically.# post to dev.to

crosspost <filename>.md --dev


# post to codenewbie.org

crosspost <filename>.md --cdb


# post to medium.com

crosspost <filename>.md --medFor further help on CLI command, you can get the help argumentcrosspost --hShellScript is no longer developed because of content parsing issues, it has been converted to a python packageThough some basic functions will work in shell script like simple frontmatter, devto and medium posting.Crossposter Shell ScriptThe crossposter shell script is a file to be used from a linux/unix command line in a shell environment. The procedure to execute the file is as follows:Run the script on a bash interpreter with the command:bash crosspost.shORbash crosspost.sh file_name.mdFor posting the article you need to provide the following details:Front-MatterMeta data about the postTitle of PostSubtitle of PostPublish status of post(trueorfalse)Tags for the post (comma separated values)Canonical Url (original url of the post)Cover Image (URL of the post's image/thumbnail)This information is a must fordev.toespecially thetitle. This should be provide in the same order as given below:---
title: The title of the post
subtitle: The description of your article
published: true
tags: programming, anythingelse
canonical url: url of your original blog
cover_image: coverimage_url
---There is no need to enclose any of them with quotation marks.Publishedargument will betrueif you want to publish it andfalseif you want to keep it in your Drafts.In the demonstrations, we just need to enter the tokens once. The tokens will be stored locally in thekeys.txtfile and retrieved later within the script.Posting ondev.to:Posting on dev.to requires theirAPI keywhich can be generated by going on theDev Community API Keys. From there you can generate a new key with any name you like. You just need to enter the key to CLI once or manually enter in thekeys.txtfile with the formatdev.to:keyon the first line. This will be used for the future cross-posting whenever you execute the shell script(bash crosspost.sh)You can provide thefront mattermanually in your markdown file or you will be prompted for the input. So, that is all you will require for posting on dev.to from the Command line.Lets see the script in actionIf you want to add in more stuff to the post, you can check out theDEV.to API docswhich is powered byForem, there a ton of options you can hook to the front-matter in the shellscript.