MCPcopy Create free account
hub / github.com/Useful-Scripts-Extension/useful-script / method2

Function method2

scripts/insta_injectDownloadBtn.js:603–627  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

601 }
602
603 function method2() {
604 let scriptJson = document.querySelectorAll(
605 'script[type="application/json"]'
606 );
607 for (let i = 0; i < scriptJson.length; i++) {
608 let match = scriptJson[i].text.match(
609 /"pk":"(\d+)","id":"[\d_]+"/
610 );
611 if (match) {
612 if (!window.location.href.includes("highlights")) {
613 return match[1];
614 }
615 let matchs = Array.from(
616 scriptJson[i].text.matchAll(
617 /"pk":"(\d+)","id":"[\d_]+"/g
618 ),
619 (match) => match[1]
620 );
621 const matchIndex = findHighlightsIndex();
622 if (matchs.length > matchIndex) {
623 return matchs[matchIndex];
624 }
625 }
626 }
627 }
628
629 return method1() || (await method3()) || method2();
630 }

Callers 1

findMediaIdFunction · 0.85

Calls 1

findHighlightsIndexFunction · 0.85

Tested by

no test coverage detected