Closed carmenfdezb closed 8 years ago
Should be now fixed partially with https://github.com/llelectronics/webcat/commit/fb54eb8012d0c917a9630c762f3a92988632eaf2 Partially as on normal sites like https://m.facebook.com/redbull it won't always detect the videos (there are too many anyways). But if you open the individual post with the video (by clicking on its time of release) it will detect the video and offer a play and download button.
I will close this bug here.
I have used a CSS selector and it seems to catch all of them :)
Basically it's an extension of your "data-store" trick ( thumbnails included, if needed :) )
function grabVideo(fbvideoelement) {
var videothumb = fbvideoelement.querySelector("i[class*='img']");
if(!videothumb)
return;
var videoobj = JSON.parse(fbvideoelement.getAttribute("data-store"));
if(!videoobj.hasOwnProperty("videoID") || !videoobj.hasOwnProperty("src"))
return;
var fbinfo = new Object;
fbinfo.type = "play_facebook";
fbinfo.thumbnail = videothumb.style.background.match(/url\(["]*(.*)["]*\)/)[1];
fbinfo.url = videoobj.src;
// Video Grabbed
}
var fbembeddedvideos = document.querySelectorAll("div[data-store^='{\"videoID']");
for(var i = 0; i < fbembeddedvideos.length; i++)
grabVideo(fbembeddedvideos[i]);
Thanks added your version in this commit. https://github.com/llelectronics/webcat/commit/912ac97ec299b2f1814e2c5d9ad4ad2b87daf828 I did not know about querySelector and querySelectorAll. Saves lines of code indeed :)
I have same issue in WepPirate:
https://github.com/Dax89/harbour-webpirate/issues/66