I made a tool for automated importing of lessons to LingQ

As discussed here:

I developed a script that enables me to upload a book split into tiny parts as separate lessons. It’s inspired by spatterson’s script (thanks for the idea). His script can be found here: lingq/bulk_upload at master · shaunpatterson/lingq · GitHub

My script is essentially a PowerShell version of the same approach, I made it because I couldn’t get spatterson’s python version to work. My script should be easier to use (I know it is for me :P). It isn’t much, it only works on Windows, and it only handles the import part - it expects you to have your book split into files before you run it.

Frankly, this whole approach (using Selenium to commandeer a browser window and have it work the import form over and over again) seems rather clumsy and inefficient to me. But I promised I’d share the tool, so here it is:

I hope someone will find it useful. If you have problems using it, let me know, I’ll try to help if time permits.

3 Likes

Thanks for sharing this. Also following the discussion to hear about the API call that isn’t working.

I think a function built into the website for bulk imports would be very useful and maybe not so difficult to develop, though of course the developers have a lot to do and not so many resources. I also think a RSS automatic import tool would be great, but I don’t expect this to happen. Maybe when the API thing is working, somebody can develop it.

1 Like

I think you are right-- if you want people who are not “techie” importing in bulk, then it will need to be built right into the website itself.

M

I agree, this should be built in functionality of LingQ. However, it would seem that the LingQ dev team has their hands full as it is. This functionality is probably not a high priority for them.

There is, in all fairness, something that serves a similar purpose already built into LingQ. If I understand correctly, longer texts are split into multiple lessons when they are imported. This doesn’t work for Japanese, so it’s useless for me. However, even if it did, I’d choose not to use it (if I had a choice) because it doesn’t let me pick what the size or the title of the lessons will be.

I think if the import function of the API is ever fixed, we “techies” can make a tool for the “non-techies” that will be just as easy to use as if it were a part of LingQ. The first version of my tool was a Windows application, complete with a GUI. But I decided to release it as a script to save people the trepidation of running an exe file on their machine that they got from some dude on the internet. But if a bunch of us cooperates on the tool and then we vouch for it, or we have the LingQ dev team look at the source code and approve it, it could work.

I have updated the script and the user manual a bit. Special thanks to keke_eo for providing invaluable feedback.

1 Like

Thank you for this and I will report back once I have used it. Greatly appreciate the community spirit!

It’s the least I could do. Great tool!

I have just updated the script substantially, based on my experience with using it on large books (300+ lessons). The biggest problem I was facing was sometimes the LingQ website would time out or respond too slowly, which would cause a couple of failed imports. This would mean incorrect lesson ordering for the entire course. To get around this I’ve added the ability to retry an import if it fails. Because the failures are caused by slow response times, the script will wait for an increasing period of time before each retry.
While still not perfect, this change dramatically improves the success rate of the script.
I’ve also expanded the instructions regarding how to prepare your lessons so they’ll import successfully.
As LingQ currently has an issue where you can’t delete a course unless you’ve deleted all the lessons in it, I’ve added a script that does that.

1 Like

Great stuff! I’l check it out on my next big import.