Tạo Bookmarklet để tải video, reel từ facebook

Table of Contents

Tạo Bookmarklet để tải video, reel từ Facebook

Đợt trước có bạn share js script để tải video từ Facebook nhưng phải mở browsers console, khá bất tiện, nay mình làm cái Bookmarklet để tải tài liệu từ tailieu.vn thì sắn làm nó luôn, cách thêm Bookmarklet vào Bookmark Bar bạn xem link dưới nhé:

https://dothanhlong.org/tao-bookmarklet-de-tai-tai-lieu-tu-tailieu-vn/

Sau đây là script tạo Bookmarklet để tải video từ Facebook

javascript:(() => { let a = location.href.match(/\/(?:videos|reel|watch)(?:\/?)(?:\?v=)?(\d+)/); if (a.length < 2) { console.log("Please open a video before running this script."); return } let c = function(d, e) { let f = [], a; for (a in d) if (d.hasOwnProperty(a)) { let g = e ? e + "[" + a + "]" : a, b = d[a]; f.push(null !== b && "object" == typeof b ? c(b, g) : encodeURIComponent(g) + "=" + encodeURIComponent(b)) } return f.join("&") }, b = function(a, b) { return fetch("https://www.facebook.com/api/graphql/", { method: "POST", headers: { "content-type": "application/x-www-form-urlencoded" }, body: c({ doc_id: a, variables: JSON.stringify(b), fb_dtsg: require("DTSGInitialData").token, server_timestamps: !0 }) }) }; console.log("Getting info..."), b("5279476072161634", { UFI2CommentsProvider_commentsKey: "CometTahoeSidePaneQuery", caller: "CHANNEL_VIEW_FROM_PAGE_TIMELINE", displayCommentsContextEnableComment: null, displayCommentsContextIsAdPreview: null, displayCommentsContextIsAggregatedShare: null, displayCommentsContextIsStorySet: null, displayCommentsFeedbackContext: null, feedbackSource: 41, feedLocation: "TAHOE", focusCommentID: null, privacySelectorRenderLocation: "COMET_STREAM", renderLocation: "video_channel", scale: 1, streamChainingSection: !1, useDefaultActor: !1, videoChainingContext: null, videoID: a[1] }).then(a => a.text()).then(b => { try { let a = JSON.parse(b.split("\n")[0]), c = a.data.video.playable_url_quality_hd || a.data.video.playable_url; window.location.href = c; } catch (d) { console.log("\u26A0\uFE0FFailed to extract data. Maybe this script is no longer effective.") } }).catch(a => { console.error("\u26A0\uFE0FFailed to get data") }) })()

Tham khảo script gốc của bạn Nguyễn Anh Nhân ở đây

https://www.facebook.com/groups/j2team.community/posts/1880294815635963


Warning: Undefined variable $comments_number in /shared/webdir2/dothanhlong.org/wp-content/themes/business-hub/comments.php on line 35

Warning: Undefined variable $comments_number in /shared/webdir2/dothanhlong.org/wp-content/themes/business-hub/comments.php on line 39
0 thoughts on “Tạo Bookmarklet để tải video, reel từ facebook”

Leave a Reply to Lê Văn Sơn Cancel reply

Your email address will not be published. Required fields are marked *