Advertisement
Th3-822

[rapidleech][d][video] facebook.com

Oct 25th, 2012
575
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.84 KB | None | 0 0
  1. <?php
  2. if (!defined('RAPIDLEECH')) {
  3.     require_once('index.html');
  4.     exit;
  5. }
  6.  
  7. class facebook_com extends DownloadClass {
  8.     public function Download($link) {
  9.         if (!preg_match('@://(?:[^/]+\.)?facebook\.com/(?:(?:video/video|photo)\.php\?v=|[\w\-]+/videos/)(\d+)@i', $link, $vid)) html_error('Video ID not found.');
  10.         $page = $this->GetPage('https://www.facebook.com/video/video.php?v='.$vid[1]);
  11.         is_present($page, '>This content is currently unavailable<', 'Video unavailable or deleted.');
  12.  
  13.         if (!preg_match('@"video_title"\s?,\s?"([^"]+)"@i', $page, $title) && !preg_match('@<title id="pageTitle">[\s\t\r\n]*([^<>]+)[\s\t\r\n]*\|[\s\t\r\n]*Facebook[\s\t\r\n]*</title>@i', $page, $title)) {
  14.             html_error('Video title not found.');
  15.         }
  16.         $title = preg_replace('@[^ A-Za-z_\-\d\.,\(\)\[\]\{\}&\!\'\@\%\#]@u', '_', urldecode(html_entity_decode(preg_replace('@\\\u(\d{4})@i', '&#$1;', trim($title[1])), ENT_QUOTES, 'UTF-8')));
  17.  
  18.         if (!preg_match('@"video_src"\s?,\s?"(http[^"]+)"@i', $page, $dl)) {
  19.             if (!preg_match('@\[\s?\"params\"\\s?,\s?\"([^\"\]]+)@i', $page, $params)) html_error('Download link not found.');
  20.             $params = json_decode(urldecode(str_replace('\u0025', '%', $params[1])), true);
  21.             $video = reset($params['video_data']);
  22.             $dllink = !empty($video['hd_src']) ? $video['hd_src'] : $video['sd_src'];
  23.         } else $dllink = urldecode(str_replace('\u0025', '%', $dl[1]));
  24.  
  25.         $ext = strrchr(basename(parse_url($dllink, PHP_URL_PATH)), '.');if (empty($ext)) $ext = '.flv';
  26.         $fname = "$title [FB-" . (!empty($video['hd_src']) ? 'HD' : 'SD') . "][{$vid[1]}]$ext";
  27.         // Remove rate limit
  28.         $dllink = preg_replace('@&rl=\d+@i', '', $dllink);
  29.         $this->RedirectDownload($dllink, $fname);
  30.     }
  31. }
  32.  
  33. //[25-10-2012] Written by Th3-822. (I won't reply "media-related" plugin requests by Mail/IM/PM, only at forum.)
  34. //[20-9-2016] Small Fixes. - Th3-822
  35.  
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement