MCPcopy
hub / github.com/ChinaGodMan/UserScripts / fetchPage

Function fetchPage

missav-explorer/missav-explorer.user.js:629–654  ·  view source on GitHub ↗
(pageNum, pages, callback)

Source from the content-addressed store, hash-verified

627
628 // 异步获取页面内容
629 function fetchPage(pageNum, pages, callback) {
630 const pageUrl = `${processUrl(inurl)}${pageNum}`
631 console.log(`正在获取第 ${pageNum} 页的内容...`)
632 //showModal(`正在获取${name} 第 ${pageNum} / ${allpages}页 `);
633 if (a !== -1) {
634 showModal(`${a + 1}/${names.length} 正在获取 ${name} 第 ${pageNum} / ${allpages} 页`)
635 } else {
636 showModal(`正在获取 ${name} 第 ${pageNum} / ${allpages} 页`)
637 }
638 GM_xmlhttpRequest({
639 method: 'GET',
640 url: pageUrl,
641 headers: { 'Cookie': document.cookie },
642 onload: function (response) {
643 if (response.status === 200) {
644 processPageContent(response.responseText, pageNum, pages, callback)
645 } else {
646 pendingRequests--
647 checkIfComplete(callback)
648 if (pages.length > 0) {
649 setTimeout(() => fetchPage(pages.shift(), pages, callback), delayTime)
650 }
651 }
652 }
653 })
654 }
655
656 //获取视频信息
657 function extractInformation(htmlContent) {

Callers 2

startFunction · 0.70
processPageContentFunction · 0.70

Calls 4

processUrlFunction · 0.85
showModalFunction · 0.85
processPageContentFunction · 0.85
checkIfCompleteFunction · 0.85

Tested by

no test coverage detected