Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All Medium Articles are being saved to "drafts" array #11

Open
austriker27 opened this issue May 4, 2020 · 12 comments
Open

All Medium Articles are being saved to "drafts" array #11

austriker27 opened this issue May 4, 2020 · 12 comments

Comments

@austriker27
Copy link

Hello,

I followed your README instructions and all my posts are being saved to the "drafts" array per the conversion_report. None of my medium articles are drafts, they are in fact public posts. Any thoughts on how to fix this?

I copied and pasted your template.js file so it looks like :

module.exports = {
  render: function(data) {
    // data.published is Date ISO format: 2018-04-16T14:48:00.000Z
    var date = new Date(data.published);
    var prettyDate =
      date.getFullYear() +
      '-' +
      (date.getMonth() + 1).toString().padStart(2, 0) +
      '-' +
      date
        .getDate()
        .toString()
        .padStart(2, 0); //2018-04-16
    
    var template = `\
---
slug: "/posts/${data.titleForSlug}/"
date: ${prettyDate}
title: "${data.title}"
draft: false
description: "${data.description}"
categories: []
keywords: [${data.tags.join(',')}]
---

${data.body}
`;

    return template;
  },
  getOptions: function() {
    return {
      folderForEachSlug: true, // separate folder for each blog post, where index.md and post images will live
      imagePath: '/images2', // <img src="/images2/[filename]" >. Used in the markdown files.
      defaultCodeBlockLanguage: 'js', // code fenced by default will be ``` with no lang. If most of your code blocks are in a specific lang, set this here.
    };
  },
};

Unless Im misreading something it looks like drafts should be set to false.

@jamischarles
Copy link
Owner

Haven't used this in a while, but here's the logic to determine if the file should be a draft:

is_draft = filename.startsWith('draft')

Can you confirm that your file names don't start with draft?

@jamischarles
Copy link
Owner

Also I wonder if this helps or not
#7

@austriker27
Copy link
Author

Haven't used this in a while, but here's the logic to determine if the file should be a draft:

is_draft = filename.startsWith('draft')

Can you confirm that your file names don't start with draft?

Thanks for the quick reply! I can confirm none of my posts start with "draft".

@austriker27
Copy link
Author

Also I wonder if this helps or not
#7

Perhaps, I'll try to update the lib file with this change

@austriker27
Copy link
Author

I updated the converter.js file with the changes from #7 but Im still getting the same bug. I'm not sure if I did the changes correctly though because its my first time editing a global package like this.

@jamischarles
Copy link
Owner

No promises on turnaround time, but if you're willing to send me your medium export zip, I can run it locally so see if I can reproduce the issue and then fix it.

@austriker27
Copy link
Author

@jamischarles That would be pretty incredible. Not sure what Im doing wrong, I even tried to remove the conditional that checks for the is_draft.

Export is here (it will self destruct after one download 💣)

@jamischarles
Copy link
Owner

Sorry forgot about this lol. Digging into this now. This is what I'm seeing currently. Do you get the same thing?
posts drafts that were not attempted: 26

@austriker27
Copy link
Author

Yup! @jamischarles

@jamischarles
Copy link
Owner

Alright. Fixed. I merged a PR about a year ago, and that PR broke the happy path. Sorry about that.

I'll need to add tests before I allow any more PRs.

Thanks for being patient and filing this. Let me know if you find any more bugs. It should exclude replies, but I don't think that's working properly because medium changed their markup.

Screen Shot 2020-05-19 at 4 03 34 PM

@austriker27
Copy link
Author

Cool cool. Thanks a lot for sinking your teeth into this!

@jamischarles
Copy link
Owner

Np 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants