Skip to content

Instantly share code, notes, and snippets.

@davidhcefx
Last active October 26, 2024 15:49
Show Gist options
  • Save davidhcefx/b53b8e23172cc9fe936963587429a0fd to your computer and use it in GitHub Desktop.
Save davidhcefx/b53b8e23172cc9fe936963587429a0fd to your computer and use it in GitHub Desktop.

Revisions

  1. davidhcefx revised this gist Oct 26, 2024. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion How to Search Facebook Messenger by Date.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,8 @@ Until now, Facebook Messenger still doesn't offer an option to filter messages w
    So, I wrote a script to automate all the tedious stuff!

    1. In Chrome, press `Cmd+Option+C` (or `Ctrl+Shift+C` on Windows) and click on a "**timestamp message**" in Messenger.
    1. For example, a timestamp message might be like "2023/09/26 上午12:51" in Chinese.
    1. A "timestamp message" is the timestamp that are sometimes inserted at the top of the messages.
    2. For example, in Chinese it might appear as "2023/09/26 上午12:51".

    2. Switch to the **Console** tab, and paste the following:

  2. davidhcefx revised this gist Oct 26, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion How to Search Facebook Messenger by Date.md
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,7 @@ x = $0; while (x.tagName !== 'DIV' || x.role !== 'row') { x = x.parentNode; } wh

    3. Assuming the timestamp message in your language appears as "YYYY/MM/DD" (eg. "2023/09/26"). Paste the following to Console, and change the TARGET to `TARGET = ['YYYY/MM/']`.
    1. Facebook tends to represent timestamps in different formats.
    2. For example, in Chinese it appear as "2023年9月26日 上午12:51" for dates that are near but change to "2022/08/17 上午10:23" when the date is far away.
    2. For example, in Chinese it might appear as "2023年9月26日 上午12:51" for dates that are near but change to "2022/08/17 上午10:23" when the date is far away.
    3. If you are not sure what format it might be, you can list all the possibilities, eg. `TARGET = ['2023/09/', '2023年9月']`.

    ```js
  3. davidhcefx revised this gist Oct 26, 2024. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions How to Search Facebook Messenger by Date.md
    Original file line number Diff line number Diff line change
    @@ -16,9 +16,9 @@ So, I wrote a script to automate all the tedious stuff!
    x = $0; while (x.tagName !== 'DIV' || x.role !== 'row') { x = x.parentNode; } while (x.parentNode.children.length <= 3) { x = x.parentNode; }
    ```

    3. Assuming the timestamp message in your language appears as "YYYY/MM/DD" (eg. "2023/09/26"). Paste the following to Console, and change the TARGET to `TARGET = ['2023/09/']`.
    3. Assuming the timestamp message in your language appears as "YYYY/MM/DD" (eg. "2023/09/26"). Paste the following to Console, and change the TARGET to `TARGET = ['YYYY/MM/']`.
    1. Facebook tends to represent timestamps in different formats.
    2. For example, it might be "2023年9月26日 上午12:51" for dates that are near but turned to "2022/09/26 上午12:51" format when the date is far away.
    2. For example, in Chinese it appear as "2023年9月26日 上午12:51" for dates that are near but change to "2022/08/17 上午10:23" when the date is far away.
    3. If you are not sure what format it might be, you can list all the possibilities, eg. `TARGET = ['2023/09/', '2023年9月']`.

    ```js
  4. davidhcefx revised this gist Oct 26, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion How to Search Facebook Messenger by Date.md
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ So, I wrote a script to automate all the tedious stuff!

    ```js
    /* select row div */
    x = $0; while (x.tagName !== 'DIV' || x.role !== 'row') { x = x.parentNode; } while (x.parentNode.children.length <= 2) { x = x.parentNode; }
    x = $0; while (x.tagName !== 'DIV' || x.role !== 'row') { x = x.parentNode; } while (x.parentNode.children.length <= 3) { x = x.parentNode; }
    ```

    3. Assuming the timestamp message in your language appears as "YYYY/MM/DD" (eg. "2023/09/26"). Paste the following to Console, and change the TARGET to `TARGET = ['2023/09/']`.
  5. davidhcefx revised this gist Oct 26, 2024. No changes.
  6. davidhcefx revised this gist Oct 26, 2024. No changes.
  7. davidhcefx revised this gist Oct 26, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion How to Search Facebook Messenger by Date.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # How to Search Facebook Messenger by Date

    > Answer to [this thread](https://www.reddit.com/r/facebook/comments/1349ry8/why_cant_you_search_facebook_messenger_by_date/)
    > Answered in [this thread](https://www.reddit.com/r/facebook/comments/1349ry8/why_cant_you_search_facebook_messenger_by_date/)
    Until now, Facebook Messenger still doesn't offer an option to filter messages within a specific date range. The only option left is to scroll manually through the entire message thread, either by pressing `Page up` or `Ctrl + Home`, which is very very time-consuming.

  8. davidhcefx revised this gist Oct 26, 2024. 1 changed file with 13 additions and 9 deletions.
    22 changes: 13 additions & 9 deletions How to Search Facebook Messenger by Date.md
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,13 @@
    # How to Search Facebook Messenger by Date

    > From [this thread](https://www.reddit.com/r/facebook/comments/1349ry8/why_cant_you_search_facebook_messenger_by_date/)
    > Answer to [this thread](https://www.reddit.com/r/facebook/comments/1349ry8/why_cant_you_search_facebook_messenger_by_date/)
    Until now, Facebook Messenger still doesn't offer an option to filter messages within a specific range of dates. The only option left is to scroll manually through the entire message thread, by pressing `Page up` or `Ctrl + Home`, which is very time-consuming.
    Until now, Facebook Messenger still doesn't offer an option to filter messages within a specific date range. The only option left is to scroll manually through the entire message thread, either by pressing `Page up` or `Ctrl + Home`, which is very very time-consuming.

    So, I wrote a script to automate all the tedious stuff!

    1. In Chrome, press `Cmd+Option+C` (or `Ctrl+Shift+C` on Windows) and click on a "**timestamp message**" in Messenger.
    1. For example, a timestamp message might be like "2023/10/26 上午12:51" in Chinese.
    1. For example, a timestamp message might be like "2023/09/26 上午12:51" in Chinese.

    2. Switch to the **Console** tab, and paste the following:

    @@ -16,23 +16,27 @@ So, I wrote a script to automate all the tedious stuff!
    x = $0; while (x.tagName !== 'DIV' || x.role !== 'row') { x = x.parentNode; } while (x.parentNode.children.length <= 2) { x = x.parentNode; }
    ```

    3. Assuming the timestamp message in your language starts with "YYYY/MM/DD", where the month comes after the year. Paste the following to Console, and change the `TARGET = xxx` to your desired month:
    3. Assuming the timestamp message in your language appears as "YYYY/MM/DD" (eg. "2023/09/26"). Paste the following to Console, and change the TARGET to `TARGET = ['2023/09/']`.
    1. Facebook tends to represent timestamps in different formats.
    2. For example, it might be "2023年9月26日 上午12:51" for dates that are near but turned to "2022/09/26 上午12:51" format when the date is far away.
    3. If you are not sure what format it might be, you can list all the possibilities, eg. `TARGET = ['2023/09/', '2023年9月']`.

    ```js
    /* set the month; please make sure at least one message exist in this month */
    TARGET = '2023/09/';
    /* set the month; you can list all the possibilities here */
    TARGET = ['2023/09/'];
    intId = setInterval(() => {
    x = x.parentNode.firstChild; x.scrollIntoView();
    for (let n of x.parentNode.childNodes) {
    d = n.querySelector('div[data-scope="date_break"]'); if (d && d.innerText.startsWith(TARGET)) {
    clearInterval(intId); return;
    d = n.querySelector('div[data-scope="date_break"]');
    for (let t of TARGET) {
    if (d && d.innerText.startsWith(t)) { clearInterval(intId); return; }
    }
    }
    while (x.parentNode.children.length > 1000) { x.parentNode.lastChild.remove(); }
    }, 1000);
    ```

    4. If in step 3 your timestamp is displayed in a different format, for example "2023年10月26日", then it is ok to set `TARGET = "2023年10月"`. If anything goes wrong, to make it stop simply paste the following to the Console.
    4. If anything goes wrong, to make it stop simply paste the following to the Console.

    ```js
    clearInterval(intId);
  9. davidhcefx created this gist Oct 26, 2024.
    42 changes: 42 additions & 0 deletions How to Search Facebook Messenger by Date.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    # How to Search Facebook Messenger by Date

    > From [this thread](https://www.reddit.com/r/facebook/comments/1349ry8/why_cant_you_search_facebook_messenger_by_date/)
    Until now, Facebook Messenger still doesn't offer an option to filter messages within a specific range of dates. The only option left is to scroll manually through the entire message thread, by pressing `Page up` or `Ctrl + Home`, which is very time-consuming.

    So, I wrote a script to automate all the tedious stuff!

    1. In Chrome, press `Cmd+Option+C` (or `Ctrl+Shift+C` on Windows) and click on a "**timestamp message**" in Messenger.
    1. For example, a timestamp message might be like "2023/10/26 上午12:51" in Chinese.

    2. Switch to the **Console** tab, and paste the following:

    ```js
    /* select row div */
    x = $0; while (x.tagName !== 'DIV' || x.role !== 'row') { x = x.parentNode; } while (x.parentNode.children.length <= 2) { x = x.parentNode; }
    ```

    3. Assuming the timestamp message in your language starts with "YYYY/MM/DD", where the month comes after the year. Paste the following to Console, and change the `TARGET = xxx` to your desired month:

    ```js
    /* set the month; please make sure at least one message exist in this month */
    TARGET = '2023/09/';
    intId = setInterval(() => {
    x = x.parentNode.firstChild; x.scrollIntoView();
    for (let n of x.parentNode.childNodes) {
    d = n.querySelector('div[data-scope="date_break"]'); if (d && d.innerText.startsWith(TARGET)) {
    clearInterval(intId); return;
    }
    }
    while (x.parentNode.children.length > 1000) { x.parentNode.lastChild.remove(); }
    }, 1000);
    ```

    4. If in step 3 your timestamp is displayed in a different format, for example "2023年10月26日", then it is ok to set `TARGET = "2023年10月"`. If anything goes wrong, to make it stop simply paste the following to the Console.

    ```js
    clearInterval(intId);
    ```


    >DISCLAIMER: Please use it at your own risk. If you feel unsure please stop and seek for other approach.