Auth Trouble with wp-import tool

@help

Getting the following when attempting to run the wp-import against a blog export file… Have tried logging out and then back in in the writeas CLI, but same behavior.

ldlw@berlow wp-import-master % writeas auth mnml                                    
You're already authenticated as mnml. Log out with: writeas logout
ldlw@berlow wp-import-master % go run main.go sitetitle.wordpress.2022-04-09.000.xml
not authenticated. run: writeas auth <username>
exit status 1
ldlw@berlow wp-import-master % 

@helpme Still looking for some @support on this item.

Hey, are you referring to this tool? GitHub - writeas/wp-import: Import your WordPress blog to Write.as

If so, it’s not actually meant for wide use right now. I recently started working on it again, though, after the recent WordPress news. Is this something you need soon?

Hey @matt! I do need it sooner than later as my Squarespace account is set to expire in about 2 weeks. Wouldn’t be the end of the world, but I’d like to have a smooth transition over to Write.as for that site without losing the history.

I managed to do an export of the SS site and then imported it to Wordpress to generate the xml export from there. I figured that may be the best path to get from SS to the point of using the WP-import script I’d found in the GitHub.

Since it seems the script is looking for me to be authenticated, when I already am, I’m hoping it’s a semi-simple hack to get it to recognize that I’m auth’d for the import to kick off.

Let me know how to best work through this.

Okay great. So if you’re building and running this tool yourself, you can make this work right now. A few notes beforehand:

  • This tool creates a new blog on your account, and imports all posts into it (main.go:67)
  • Only posts are imported – not static pages
  • Media is not imported
  • If anything goes wrong, deleting the blog will move your imported posts to “anonymous”, cluttering things up for you. So let me know if you need everything wiped, and I can manually help
  • You’ll need an access token for this, as you saw. I’ll explain how to edit the program to use your token below. (for advanced users)

Editing this tool

To get this to work, you’ll just need to edit this line:

Change this line to set your token to this variable, e.g.

t := "00000000-0000-0000-0000-000000000000"

Then build and run the program as you were doing before. That will run through everything and output progress along the way.

If you run into any issues, just let me know!

1 Like

Thanks a ton. I’ll work on this in the next day or two and report back.

Actually had a few minutes so I gave it a go. Ran into some issues, but hopefully you can give me guidance. The connection started being refused part of the way through, and it doesn’t like some of the character formatting that’s in the export. Only two posts got created out of 143, but hoping there are some basic steps that can be applied to run it again. Log link below.

Thanks. It looks like you ran into our rate-limiting on the API.

I’ve just created an Application Key on your account, which you can find on this page. To use it, you’ll want to pull the latest wp-import changes from GitHub first. Then copy your App Key, and set it to the variable on this line: main.go:50. Then delete your old blog and posts, and try running it all again.

Also, you might’ve gotten your IP temporarily blocked by hitting that limit. I fixed that in the wp-import tool. But if you still see issues, let me know so I can unblock you.

Got the updated files, put the API and app key in the file and attempted to run. Got this error:

@matt tagging you in case you don’t see an alert otherwise.

ldlw@berlow wp-import-master % go run main.go sitetitle.wordpress.2022-04-09.000.xml
# command-line-arguments
./main.go:51:5: cl.SetApplicationKey undefined (type *writeas.Client has no field or method SetApplicationKey)
ldlw@berlow wp-import-master %

Can you try running this first, and then go run again?

go get github.com/writeas/go-writeas/v2@master

That did it… worked like a charm that go round. I’ll be using it again to migrate another site’s content over, so please leave my App Key enabled if you’re comfortable with that.

Great! Yep, that’ll stay on your account permanently.

What Wordpress news are you making reference to?

The pricing changes from a couple weeks ago. Seems some people were upset since WP rolled out the changes without any announcement beforehand.

Got it👍. Glad I started blogging on write.as at the beginning of the year.

1 Like