Giter Site home page Giter Site logo

dlive-video-embed's Introduction

Nisarg's github stats

dlive-video-embed's People

Contributors

nisargshh avatar

Watchers

 avatar

dlive-video-embed's Issues

usage question

i just stumbled across this embed and was wondering if you can help out with some info on how to use this?

i have changed up a few parts of the code but even with the m3u8 it wont play on video.js or any other player i have found

<?php
    error_reporting(E_ERROR | E_PARSE);

	$displayname = 'VinylRecords';

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL,"https://cors-anywhere.herokuapp.com/https://graphigo.prd.dlive.tv/");
        curl_setopt($ch, CURLOPT_POST, 1);
        $headers = [
            'Content-Type: application/json',
            'origin: https://dlive.tv',
			'Access-Control-Request-Method: GET',
        ];
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); // Do not send to screen
        $obj1->operationName = "LivestreamPageRefetch";
        $obj1->variables->displayname = $displayname;
        $obj1->variables->add = false;
        $obj1->variables->isLoggedIn = false;
        $obj1->extensions->persistedQuery->version = 1;
        $obj1->extensions->persistedQuery->sha256Hash = "5fb08d9011ad28aa96b193636a70252a85ec044f7a6c715e3d59c19ebab56e24";
       

		$post_data = json_encode($obj1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
        $apiResponse = curl_exec($ch);
		if (curl_errno($ch)) {
    		$error_msg = curl_error($ch);
			echo " the error is:" . $error_msg."<br><br>";
			}

        curl_close($ch);
        $jsonArrayResponse = json_decode($apiResponse);
        $username = $jsonArrayResponse->data->userByDisplayName->username;		

        //All video urls
        $ch1 = curl_init();
        curl_setopt($ch1, CURLOPT_URL,"https://live.prd.dlive.tv/hls/live/" . $username . ".m3u8");
        curl_setopt($ch1,CURLOPT_RETURNTRANSFER,1);
        $apiResponse = curl_exec($ch1);
        curl_close($ch1);


		preg_match_all('/(?P<tag>#EXTINF:-1)|(?:(?P<prop_key>[-a-z]+)=\"(?P<prop_val>[^"]+)")|(?<something>,[^\r\n]+)|(?<url>http[^\s]+)/', $apiResponse, $match );

		$count = count( $match[0] );

		$result = [];
		$index = -1;

		for( $i =0; $i < $count; $i++ ){
			$item = $match[0][$i];

			if( !empty($match['tag'][$i])){
				//is a tag increment the result index
				++$index;
			}elseif( !empty($match['prop_key'][$i])){
				//is a prop - split item
				$result[$index][$match['prop_key'][$i]] = $match['prop_val'][$i];
			}elseif( !empty($match['something'][$i])){
				//is a prop - split item
				$result[$index]['something'] = $item;
			}elseif( !empty($match['url'][$i])){
				$result[$index]['url'] = $item ;
			}
		}

		// $video_url= $result[$index]['url'];
?>

do you still have this working in some way? seems it is being caused from a cors

if you look above i changed the header with the curl request it was missing 'Access-Control-Request-Method: GET',

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.