processor.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. require_once "init.php";
  3. if ( empty( $_GET['link'] ) ){
  4. header( 'Location: index.php' );
  5. }
  6. $baselink = htmlspecialchars( $_GET['link'] );
  7. $urlexists = url_exists( $baselink );
  8. if ( $urlexists === TRUE ) {
  9. // Regex - filter URL id is match[5]
  10. $rx = '/^((?:https?:)?\/\/)? # Optional protocol
  11. ((?:www|m)[.])? # Optional sub-domain
  12. ((?:youtube[.]com|
  13. youtu[.]be|
  14. yotter[.]conocimientoslibres[.]ga|
  15. invidio[.]us|
  16. invidiou[.]sh|
  17. invidious[.]kabi[.]tk|
  18. invidious[.]glie[.]town|
  19. invidious[.]zapashcanon[.]fr|
  20. invidious[.]kavin[.]rocks|
  21. invidious[.]tube|
  22. invidious[.]xyz|
  23. invidious[.]fdn.fr|
  24. invidiou[.]site|
  25. invidious[.]site|
  26. invidious[.]mservice[.]ru[.]com|
  27. invidious[.]snopyta[.]org|
  28. vid[.]mint[.]lgbt)) # URL supports
  29. (\/(?:[\w\-]+\?v=|embed\/|v\/)?) # Parameters (embed, v)
  30. ([\w\-]+) # Video id of 11
  31. (\S+)?$/mx';
  32. preg_match( $rx, $baselink, $match );
  33. // Testing if id → 11 characters
  34. if ( strlen( $match[5] ) == 11 ) {
  35. $video_id = $match[5];
  36. } else {
  37. header( 'Location: index.php' );
  38. }
  39. } else {
  40. header( 'Location: index.php' );
  41. }
  42. // Core API
  43. require_once "extract.php";
  44. $videoTitle=$vidtitle;
  45. $videoThumbURL = "https://i.ytimg.com/vi/{$video_id}/hqdefault.jpg";
  46. $videoDuration = secToDuration($vidtime);
  47. $videoViews = bytes( $vidviewCount );
  48. $islive = $vidisLiveContent;
  49. if (!empty($vdef)) {
  50. $streamFormats = $vdef;
  51. $streamFormatsExtra = $vid;
  52. $streamExtra = TRUE;
  53. } else {
  54. $streamFormats = $vid;
  55. $streamExtra = FALSE;
  56. $streamFormatsExtra = NULL;
  57. }
  58. $videoAuthor = $vidauthor;
  59. /* ---- ---- Generated URL and embed ---- ---- */
  60. if ( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" ) {
  61. $pro = 'https';
  62. } else {
  63. $pro = 'http';
  64. }
  65. $subject = $pro."://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
  66. // Local URL
  67. $local_url = preg_replace( '/index.php/', '', $subject );
  68. /* ---- ---- URL Query ---- ---- */
  69. $url_query = "{$baselink}";