Skip to content

Instantly share code, notes, and snippets.

@kim-tom
Created September 27, 2020 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kim-tom/f7b18e78b7f32a414f8712b65f27251f to your computer and use it in GitHub Desktop.
Save kim-tom/f7b18e78b7f32a414f8712b65f27251f to your computer and use it in GitHub Desktop.
[Recipe]download-dm-from-instagram.md

How to download your direct messages in your PC browser.

EN

You can refresh the screen to redo from the beginning.

  1. Go to https://www.instagram.com/direct/t/{numbers}, which you want to download in your PC browser.
  2. Open JavaScript console via 'Inspect' in your browser.
  3. Run this code for auto scrolling.
timer = setInterval(() => {
  document.getElementsByClassName('frMpI  -sxBV')[0].scrollBy(0, -window.innerHeight);
}, 100)
  1. Stop auto scrolling.
clearInterval(timer);
  1. Download messages as text file
out = document.getElementsByClassName('VUU41')[0].innerText
let blob = new Blob([out],{type:"text/plan"});
let link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = 'out.txt';
link.click();

日本語

途中で失敗したら、ブラウザの更新ボタンを押して、やり直してください。

  1. PCブラウザで保存したいDM画面を開きます。https://www.instagram.com/direct/t/[番号]
  2. ブラウザの検証機能を開き、コンソール画面を開きます。
  3. 以下のコードを実行して、保存したいところまで遡ります。(量が多いと時間かかります)
timer = setInterval(() => {
  document.getElementsByClassName('frMpI  -sxBV')[0].scrollBy(0, -window.innerHeight);
}, 100)
  1. 保存したいところまで来たら、以下のコードで止めます。
clearInterval(timer);
  1. テキストファイルとして保存します。
out = document.getElementsByClassName('VUU41')[0].innerText
let blob = new Blob([out],{type:"text/plan"});
let link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = 'out.txt';
link.click();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment