Home

Awesome

ZMediumToJekyll

Automatic build pages-build-deployment ZMediumToMarkdown

This tool can help you move your Medium posts to a Jekyll blog and keep them in sync in the future.

One-time setting, Lifetime enjoying❤️

It will automatically download your posts from Medium, convert them to Markdown, and upload them to your repository, check out my blog for online demo zhgchg.li.

Powered by ZMediumToMarkdown.

If you only want to create a backup or auto-sync of your Medium posts, you can use the GitHub Action directly by following the instructions in this Wiki.


Setup

  1. Click the green button Use this template located above and select Create a new repository.
  2. Repo Owner could be an organization or username
  3. Enter the Repository Name, which usually uses your GitHub Username/Organization Name and ends with .github.io, for example, my organization name is zhgchgli than it'll be zhgchgli.github.io.
  4. Select the public repository option, and then click on Create repository from template.
  5. Grant access to GitHub Actions by going to the Settings tab in your GitHub repository, selecting Actions -> General, and finding the Workflow permissions section, then, select Read and write permissions, and click on Save to save the changes.

*If you choose a different Repository Name, the GitHub page will be https://username.github.io/Repository Name instead of https://username.github.io/, and you will need to fill in the baseurl field in _config.yml with your Repository Name.

*If you are using an organization and cannot enable Read and Write permissions in the repository settings, please refer to the organization settings page and enable it there.

First-time run

  1. Please refer to the configuration information in the section below and make sure to specify your Medium username in the _zmediumtomarkdown.yml file.
  2. ⌛️ Please wait for the Automatic Build and pages-build-deployment gitHub actions to finish before making any further changes.
  3. Then, you can manually run the ZMediumToMarkdown GitHub action by going to the Actions tab in your GitHub repository, selecting the ZMediumToMarkdown action, clicking on the Run workflow button, and selecting the main branch.
  4. ⌛️ Please wait for the action to download and convert all Medium posts from the specified username, and commit the posts to your repository.
  5. ⌛️ Please wait for the Automatic Build and pages-build-deployment actions will also need to finish before making any further changes, and that they will start automatically once the ZMediumToMarkdown action has completed.
  6. Go to the Settings section of your GitHub repository and select Pages, In the Branch field, select gh-pages, and leave /(root) selected as the default. Click Save, you can also find the URL for your GitHub page at the top of the page.
  7. ⌛️ Please wait the Pages build and deployment action to finish.
  8. 🎉 After all actions are completed, you can visit your xxx.github.io page to verify that the results are correct. Congratulations! 🎉

*To avoid expected Git conflicts or unexpected errors, please follow the steps carefully and in order, and be patient while waiting for each action to complete.

*Note that the first time running may take longer.

*If you open the URL and notice that something is wrong, such as the web style being missing, please ensure that your configuration in the _config.yml file is correct.

*Please refer to the 'Things to Know' and 'Troubleshooting' sections below for more information.

Configuration

Site Setting

_zmediumtomarkdown.yml

medium_username: # Enter your username on Medium.com

Please specify your Medium username for automatic download and syncing of your posts.

Supports Paywall posts

ZMediumToMarkdown requires uid and sid cookies to access paywalled posts on Medium.

If you don’t provide valid Medium Member cookies, you will receive this warning message while downloading a Medium post if the post is behind a paywall:

This post is behind Medium's paywall. You must provide valid Medium Member login cookies to download the full post.

You can obtain uid and sid cookies from Medium by following these steps:

  1. Log in to a valid Medium Member account.
  2. Right-click anywhere on the Medium webpage.
  3. Select "Inspect" to open the Developer Tools.
  4. Navigate to the "Application" tab and locate the sid and uid values under "Cookies."

ZhgChgLi-2024-08-11_22-30-03

Add sid and uid to repo Secret

image

Settings -> Secrets and variables -> Actions -> Repository secrets -> New repository secret

image

Change Github Action Command

Go To ZMediumToMarkdown.yml Action

image

Change to command to:

--cookie_uid ${{ secrets.MEDIUM_COOKIE_UID }} --cookie_sid ${{ secrets.MEDIUM_COOKIE_SID }} -j ${{ steps.yaml-data.outputs.data }}

image

!!!! Ensure that cookie information is stored in repository secrets. Do not expose cookies directly in the action YAML. !!!!

_config.yml & jekyll setting

For more information, please refer to jekyll-theme-chirpy or jekyllrb.

Github Action

ZMediumToMarkdown

You can configure the time interval for syncing in ./.github/workflows/ZMediumToMarkdown.yml.

The default time interval for syncing is once per day.

You can also manually run the ZMediumToMarkdown action by going to the Actions tab in your GitHub repository, selecting the ZMediumToMarkdown action, clicking on the Run workflow button, and selecting the main branch.

Disclaimer

All content downloaded using ZMediumToMarkdown, including but not limited to articles, images, and videos, are subject to copyright laws and belong to their respective owners. ZMediumToMarkdown does not claim ownership of any content downloaded using this tool.

Downloading and using copyrighted content without the owner's permission may be illegal and may result in legal action. ZMediumToMarkdown does not condone or support copyright infringement and will not be held responsible for any misuse of this tool.

Users of ZMediumToMarkdown are solely responsible for ensuring that they have the necessary permissions and rights to download and use any content obtained using this tool. ZMediumToMarkdown is not responsible for any legal issues that may arise from the misuse of this tool.

By using ZMediumToMarkdown, users acknowledge and agree to comply with all applicable copyright laws and regulations.

Troubleshooting

If you are facing Run ZMediumToMarkdown Automatic Bot Failed ❌

remote: Write access to repository not granted.
fatal: unable to access 'https://github.com/zhgtest/test-init/': The requested URL returned error: 403
Error: Invalid status code: 128
    at ChildProcess.<anonymous> (/home/runner/work/_actions/stefanzweifel/git-auto-commit-action/v4/index.js:17:19)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1100:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5) {
  code: 128
}

Error: Invalid status code: 128
    at ChildProcess.<anonymous> (/home/runner/work/_actions/stefanzweifel/git-auto-commit-action/v4/index.js:17:19)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1100:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)

Please follow steps below to change workflow permission and retry running github action:

Settings -> Actions -> General -> Workflow Permissions -> Read and write permissions -> ✅

1_1ZHF9CIOMV8S12Xw2P4B8g

My GitHub page keeps presenting a 404 error or doesn't update with the latest posts.

Things to know

Sites That Use ZMediumToJekyll

You can add your site to this list by creating a pull request. 😝

About

Other works

Swift Libraries

Integration Tools

Donate

Buy Me A Coffe

If you find this library helpful, please consider starring the repo or recommending it to your friends.

Feel free to open an issue or submit a fix/contribution via pull request. :)