How to auto load old Facebook posts in Chrome Javascript console and handle "Temporary error"?

in talking to Facebook posts, my goal is to get all posts on one page in order to keep the complete thread in one file. I am not happy with the Facebook data loading because the file provided by Facebook in this case does not contain the graphs included in the posts, and worse, posts for one person are not displayed in strict chronological order.

So I am using a trick in Google Chrome using Javascript console. (Ctrl + Shift + J) and the "mobile" version of Facebook. https://m.facebook.com When I am in a certain post flow, the page shows the last few posts, and a link on top of them allows us to download older posts. It is marked as "View old messages ..." and has an identifier named "see_older".

Then in the console enter this javascript code:

setInterval(function () {
    document.getElementById('see_older')
        .getElementsByClassName('content')[0].click();
}, 1000);

      

This works great, the message page gradually fills with the previous message, but by accident, Facebook returns an error. The error says " Temporary error. There was a temporary error, please try again. "

In the HTML source:

<div class="_55wr acr apm abb" data-sigil="marea">
<span class="mfsm">Temporary Failure</span>
<br />There was a temporary error, please try again.</div>

      

For a manual solution, just hit back in the browser, then wait for the page to reload the previous messages and run the javascript command again. This can be very tiring.

I was wondering if there is something that could be done in Javascript to detect the appearance of this error page, make a programmatic Back command in the browser, and when the previous page is ready, run the script again. In this way, the entire process can be completely shut down until the message flow reaches its beginning.

Many thanks.

+3


source to share


1 answer


Scrambling information from Facebook is against the Terms of Service and you shouldn't do it.



If you want you to read a user's post, use the Facebook platform by creating an app and creating a view for the Login Overview . Read the permissions documentation here before proceeding .

0


source







All Articles