Use the LW GraphQL API (https://www.lesswrong.com/posts/LJiGhpq8w4Badr5KJ/graphql-tutorial-for-lesswrong-and-effective-altruism-forum) to query for the html of the posts, and then use something like pandoc to translate said html into latex, and then to epub.
Link to the graphQL API
The command needed to get a particular post:
{ post(input: { selector:{ _id: "ZyWyAJbedvEgRT2uF" } }) { result { htmlBody } } }
Use the LW GraphQL API (https://www.lesswrong.com/posts/LJiGhpq8w4Badr5KJ/graphql-tutorial-for-lesswrong-and-effective-altruism-forum) to query for the html of the posts, and then use something like pandoc to translate said html into latex, and then to epub.
Link to the graphQL API
The command needed to get a particular post: