selbetar / askfmArchiver

An arhciving tool for ask.fm profiles
GNU General Public License v3.0
14 stars 4 forks source link

How to write code to archive ASKfm page directly into a PDF file? #14

Open knightstempler opened 1 year ago

knightstempler commented 1 year ago

Hello Selbetar

Thanks a lot for this great code. I was actively looking for something like this.

I have been trying to use your code with the latest version V 2.1.0.

As I was using Archival options (-a), it only gave me a handful of scattered media (usually photos and videos) in the designated output folder with no questions or answers saved. Not all media on this page as well. But when I try to use Markdown options (-m) it doesn't download anything and only gets this error message. "Application is starting Markdown Service Nothing to generate. Application is Done: Markdown Service".

Only once I managed to get about 15 MD files. Unfortunately, I couldn't piece them together into one PDF file as shown in the example folder.

Anyway, my question to you is: Can you please give me a code example of how to archive the Askfm page directly into PDF as in your folder example?

I hope to hear back from you.

Thank you.

Best Regards.

selbetar commented 1 year ago

This tool was created to continuously archive a user's profile while not performing any redundant work. Archived textual data is saved into a sqlite database that resides under the config folder which is in the same directory as the executable (unless you changed the config location using the --config flag), while binary data such as images/videos/gifs resides under the visuals folder, however, it skips polls. You can use a tool like sqlitebrowser if you wanna browse the database using a GUI.

The markdown option reads data from the local database and this option keeps track of the last time the markdown files were generated. If there's no new answers in the database for the specified user, then no new markdown files will be generated. You can use the flag --reset (I just the noticed the description is incorrect) to override this behavior and generate the files anyway.

Can you please give me a code example of how to archive the Askfm page directly into PDF as in your folder example?

Archiving a user's profile into pdf directly is beyond the scope of this tool. It can only generate markdown files that can be converted to pdf using another tool. I personally use puppeteer to convert markdown files to PDF. The vscode extension vscode-markdown-pdf can also be used for this task. I recommend checking the source code of this extension to see how it utilizes puppeteer to convert markdown to pdf in case you want a more flexible approach that doesn't depend on vscode.

To merge multiple pdf files into one file, you can use pdfunite or pdftk if you are on Windows.

Hope that helps.

knightstempler commented 1 year ago

Hello Selbetar

Thanks a lot for the invaluable assistance provided.

I have followed your instructions and successfully managed to archive the Askfm profile, then I could make the markdown files without any problem and convert them to separate PDFs as you said, lastly put them together in one big PDF.

The only problem I have is that I'd like to get the same style structure for your PDF in the example folder (e.g the panel for questions above the answer, Date field, Like counter, Thread counter, Question by: ... etc).

Please tell me how to do so.

Thank you once again, and have a nice day.

Best Regards.