Make Discourse play nice with the Wayback Machine

I’ve noticed that when archiving Discourse topics using archive.org, the CSS is mangled. Here is an example:

9 Likes

Cannot be resolved, as wayback does not understand and cannot archive pure JavaScript sites at all. Either you serve it plain crawler HTML, or it will show nothing.

You may want to raise this with them, if they can make their crawler archive pure JavaScript sites, but it requires an extremely advanced crawler that runs headless browsers. Pure text curl retrieval is no longer sufficient, they have to retrieve the JS and execute it.

3 Likes

orrrrr we could build a topic view that looks like this :smile: (from my AMPproject.org experiment branch)

This layout is both extremely easy to crawl, and works with both wide and narrow screens.

However, I seem to have forgotten the topic’s category.

10 Likes

Very strongly opposed to adding another renderer, one that has to be kept in sync with the primary JavaScript renderer, plus the crawler 1996 HTML renderer we already have.

5 Likes

The way I have it implemented, this replaces the crawling view outright on topics.

14 Likes

May I suggest we focus back on the original issue here?

There’s people willing to use the Internet Archive Wayback Machine (myself included) in order to keep copies of Discourse threads for posterity and right now that seems to be impossible to achieve with the current implementation (of both Discourse and Wayback).

What are the things that can be done to the Discourse codebase that can improve this? And what are the things that can be done on the Archive’s crawling system that could help as well?

3 Likes

I believe the CSS should look a lot better with @falco’s latest changes in that area. Can you quickly check using the archive.org tools @falco?

3 Likes

I think all we need is detecting archive.org UA as a crawler, let me take a look.

2 Likes

I actually experienced a server error while attempting to save a Discourse page on the wayback machine today:

https://web.archive.org/save/_embed//t/recuperando-dados-de-disquetes-antigos/35

This was the original URL:

And I was trying to save it this way:

1 Like

OK, this is kinda strange.

They are using the User Agent of the user who asked to save the page to download the HTML, and after that they try to show the page with a bunch of injected JS.

This topic when I click on the save button using Google Bot User Agent: Make Discourse play nice with the Wayback Machine - feature - Discourse Meta

Sent an email to archive.org, let’s see.

4 Likes

That’s not enough actually, because there are many other web archives in town and new web archives come to life every now and then.

1 Like

There are many efforts of headless browser based archiving including http://archive.is/ which is an on-demand single page archiving system. It renders the page using PhantomJS and then archives the rendered DOM plus necessary assets. However, doing it on a massive scale (not just for on-demand pages) takes a lot of time, because PhantomJS or any other renderer is orders of magnitude slower than traditional vanilla crawlers such as Heritrix that is used my Internet Archive and many other web archives.

Here is a relevant research work on the topic Scripts in a Frame: A Two-Tiered Approach for Archiving Deferred Representations. Below is a blog post summarizing the research work and related resources.

3 Likes

Actually that didn’t work because they aren’t respecting user agent.

Discourse is already crawler friendly, you just need to ask the crawler version.

Attempts by me to save this topic result in:

I can not describe the procedure, or the end result, as playing nicely.

We should follow up and see if we can improve this somehow @falco, perhaps in the next few weeks or early after 1.9 begins beta.

2 Likes

The problem, as described above, is that Wayback machine is not being nice, because they hijack their user-agent string, making it impossible for use to serve a non-js crawler version for then.

I tried their e-mail but got 0 responses.

3 Likes

@Falco, the Wayback machine is the archival replay system. The crawler used at Internet Archive is Heritrix. That said, would you mind telling me the exact user-agent string you are seeing from them? I might be able to approach some people at Internet Archive on personal channels and see what’s going on.

6 Likes

Wow, this is amazing! :tada:

It’s like I said here:

For example, if you are using Firefox 52 and click on the save, they will use your user-agent (Firefox 52 user agent) when asking the page.

If they add something that can distinguish this requests, we can serve the correct page.

1 Like

I will try to talk to some friends at the Internet Archive later this week. Next month I will be meeting with many web archive folks (including Internet Archive) at an International Internet Preservation Consortium conference. I will raise this issue there.

7 Likes

Thanks, and to clarify: I did not suggest that Discourse did not play nicely. Please see earlier versions of my post, keyword:

  • /print

– I meant to say that the print workaround is not nice. I do not recommend it.

1 Like