{"id":345,"date":"2024-11-27T17:37:52","date_gmt":"2024-11-27T16:37:52","guid":{"rendered":"http:\/\/gvxzpby.cluster027.hosting.ovh.net\/?page_id=345"},"modified":"2024-11-27T18:12:07","modified_gmt":"2024-11-27T17:12:07","slug":"insta","status":"publish","type":"page","link":"https:\/\/www.editions-howtobecome.com\/index.php\/insta\/","title":{"rendered":"insta"},"content":{"rendered":"\n\n<script>    function downloadInstagramMedia() {\r\n        \/\/ Collect all media elements\r\n        const mediaElements = document.querySelectorAll(\"a.sbi_photo\");\r\n        const mediaUrls = [];\r\n\r\n        mediaElements.forEach(el => {\r\n            const fullResUrl = el.getAttribute(\"data-full-res\"); \/\/ Images or placeholder\r\n            const videoElement = el.querySelector(\"video\"); \/\/ Look for videos inside\r\n            const videoUrl = videoElement ? videoElement.getAttribute(\"src\") : null;\r\n\r\n            if (videoUrl) {\r\n                mediaUrls.push({ url: videoUrl, type: \"video\" });\r\n            } else if (fullResUrl) {\r\n                mediaUrls.push({ url: fullResUrl, type: \"image\" });\r\n            }\r\n        });\r\n\r\n        if (mediaUrls.length === 0) {\r\n            alert(\"No media found on the page.\");\r\n            return;\r\n        }\r\n\r\n        mediaUrls.forEach((media, index) => {\r\n            const { url, type } = media;\r\n            if (url) {\r\n                const a = document.createElement(\"a\");\r\n                a.href = url;\r\n                a.download = `media_${index + 1}.${type === \"video\" ? \"mp4\" : url.split('.').pop().split('?')[0]}`;\r\n                document.body.appendChild(a);\r\n                a.click();\r\n                document.body.removeChild(a);\r\n            }\r\n        });\r\n\r\n        alert(`${mediaUrls.length} media files downloaded!`);\r\n    }\r\n\r\n    \/\/ Create a button to trigger the download\r\n    const button = document.createElement(\"button\");\r\n    button.textContent = \"Download Instagram Media\";\r\n    button.style.position = \"fixed\";\r\n    button.style.bottom = \"20px\";\r\n    button.style.right = \"20px\";\r\n    button.style.padding = \"10px\";\r\n    button.style.backgroundColor = \"#007bff\";\r\n    button.style.color = \"#fff\";\r\n    button.style.border = \"none\";\r\n    button.style.borderRadius = \"5px\";\r\n    button.style.cursor = \"pointer\";\r\n    document.body.appendChild(button);\r\n\r\n    button.addEventListener(\"click\", downloadInstagramMedia);\r\n<\/script>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":7,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"class_list":["post-345","page","type-page","status-publish","hentry"],"blocksy_meta":[],"acf":[],"_links":{"self":[{"href":"https:\/\/www.editions-howtobecome.com\/index.php\/wp-json\/wp\/v2\/pages\/345","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.editions-howtobecome.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.editions-howtobecome.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.editions-howtobecome.com\/index.php\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.editions-howtobecome.com\/index.php\/wp-json\/wp\/v2\/comments?post=345"}],"version-history":[{"count":4,"href":"https:\/\/www.editions-howtobecome.com\/index.php\/wp-json\/wp\/v2\/pages\/345\/revisions"}],"predecessor-version":[{"id":352,"href":"https:\/\/www.editions-howtobecome.com\/index.php\/wp-json\/wp\/v2\/pages\/345\/revisions\/352"}],"wp:attachment":[{"href":"https:\/\/www.editions-howtobecome.com\/index.php\/wp-json\/wp\/v2\/media?parent=345"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}