Coder Social home page Coder Social logo

phpyoutubescrapper's Introduction

PHP BASED YT SCRAPPER

The one and only youtube scrapper that scraps literally everything of the youtube , just using php no API key needed :) . Just Include the yt.php class and Enjoy!!.

    include_once("./yt.php");
    $youtube = new YT(); 
   // get Download Urls just like this 
   // pass the video id
   echo json_encode($youtube->getDownloadURL('1WEAJ-DFkHE'));

Features

  • Authentication
  • HomePage Videos
  • Video Details
  • Video Related Recomended Videos
  • Video Playable/Download links
  • Search Videos + load more videos
  • Channel Meta Info
  • Channel Featured
  • Channel Videos + Load more videos
  • Channel Shorts
  • Channel Playlist
  • Channel Community Post
  • Channel Live
  • Channel About
  • Video Comments
  • Comment Replys
  • Like Video
  • DisLike Video
  • Notifications

how to

just download the yt.php , include it and enjoy! for example checkout the index.php or example2.php. Sample Code

    include_once("./yt.php");

    $youtube = new YT();      
    echo json_encode($youtube->search("WordPress+Tutorail")); // search query with '+' sign no space
    echo json_encode($youtube->HomePageVideos());  // get youtube home page Array
    echo json_encode($youtube->getRelatedVideo('GlLRYml8mCY')); // pass videoId get an array of videos
  
   // pass videoId get a video object and related videos Array
    echo json_encode($youtube->getVideo('GlLRYml8mCY'));  
  
   //  pass channelId , channelId can be obtained from getVideo function in video object 
    echo json_encode($youtube->getChannelFeatured('UC8aFE06Cti9OnQcKpl6rDvQ'));
    echo json_encode($youtube->getChannelVideos('UC8aFE06Cti9OnQcKpl6rDvQ'));
    echo json_encode($youtube->getChannelShorts('UC8aFE06Cti9OnQcKpl6rDvQ'));
    echo json_encode($youtube->getChannelPlayList('UC8aFE06Cti9OnQcKpl6rDvQ'));
    echo json_encode($youtube->getChannelMetaDetails('UC8aFE06Cti9OnQcKpl6rDvQ'));

    // commentToken is Obtained from getVideo function
     echo json_encode($youtube->getComments(Comment_token_here));
     echo json_encode($youtube->getReplyComments(Reply_Comment_Token_Here));

Authorization

To get videos related to your Youtube account you need to be logged in, So now in order to that we need a Acccount Authorization key and users cookie so here are the steps.

  • Step1

    Open youtube.com with inspector open

  • Step2

    Go to Networks Tab Search for a Request called browser?key=xxxxwhatEverkeyherexxxx click it when find it if you cant find just the reload page.

  • Step3

    In Headers Tab Scroll Down and find authorization and cookie value , then copy it to your .env file; paste in as Variable you like AUTHORIZATION and COOKIE

    OR

    just pass them directly

     AUTHORIZATION="SAPISIDHASH xxxxxx......xxxx....xxx"
     COOKIE="VISITOR_INFO1_LIVE=fesy_ELdl0I; wide=0; YSCxxxx......"  

    /**
    * -----------------------------------
    *          AUTHORIZATION
    * -----------------------------------
    */
    include_once("./yt.php");

      $youtube = new YT();      
      $env = parse_ini_file('.env');
      $youtube->setAuthorization($env['AUTHORIZATION']);
      $youtube->setCookie($env['COOKIE']);
   // ------------------------------------

     echo json_encode($youtube->HomePageVideosWithAuth());

Todo

  • load more videos [for methods like relatedvideos , channel Shorts , community posts etc]

progress log

  • Now You Will Get Yt Shorts from HomePage as Well as the chips (21-Aug-2023)
  • Now we Can Get LoggedIn User Profile Picture (21-Aug-2023)
  • Added Channel Community Post and Channel Live Videos, About [fixed Some Bugs] (27-Aug-2023)
  • Video Download Speed Fixed , New Download Method Provide Fast Video URLS [Refractoring] (02-Sep-2023)
  • Now you can load more Videos of Channel (14-Oct-2023)

phpyoutubescrapper's People

Contributors

faiezwaseem avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.