Skip to content

Commit

Permalink
Fix_1
Browse files Browse the repository at this point in the history
  • Loading branch information
Gotham25 committed Nov 10, 2019
1 parent b8d4ac8 commit 09f0e35
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/VideoFormats.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct($videoUrl) {
$this->playbackUri = null;
$this->appState = null;
$this->appStateJson = null;
$this->headers = ['Hotstarauth' => generateHotstarAuth() , 'X-Country-Code' => 'IN', 'X-Platform-Code' => 'JIO'];
$this->headers = ['Hotstarauth' => generateHotstarAuth() , 'X-Country-Code' => 'IN', 'X-Platform-Code' => 'JIO', 'Referer' => $videoUrl];
$this->downloadRetries = 0;
}

Expand Down
5 changes: 3 additions & 2 deletions tests/utilsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public function testMakeGetRequest_InvalidUrlWithoutHeaders_ProducesErrorOutput(
}

public function testMakeGetRequest_ValidUrlWithHeaders_ProducesCorrectOutput() {
$headers = ['Hotstarauth' => generateHotstarAuth() , 'X-Country-Code' => 'IN', 'X-Platform-Code' => 'JIO'];
$videoUrl = "https://hssouthsp-vh.akamaihd.net/i/videos/vijay_hd/chinnathambi/149/master_,106,180,400,800,1300,2000,3000,4500,kbps.mp4.csmil/master.m3u8?hdnea=st=1551575624~exp=1551577424~acl=/*~hmac=3d89f2aab02315ee100156209746e0e9f3bc70b0b52c17573300b5caa517cfd6";
$headers = ['Hotstarauth' => generateHotstarAuth() , 'X-Country-Code' => 'IN', 'X-Platform-Code' => 'JIO', 'Referer' => $videoUrl];

$expectedResponse = "<HTML><HEAD>\n";
$expectedResponse .= "<TITLE>Access Denied</TITLE>\n";
Expand All @@ -43,7 +44,7 @@ public function testMakeGetRequest_ValidUrlWithHeaders_ProducesCorrectOutput() {
$expectedResponse .= "</BODY>\n";
$expectedResponse .= "</HTML>\n";

$actualResponse = make_get_request("https://hssouthsp-vh.akamaihd.net/i/videos/vijay_hd/chinnathambi/149/master_,106,180,400,800,1300,2000,3000,4500,kbps.mp4.csmil/master.m3u8?hdnea=st=1551575624~exp=1551577424~acl=/*~hmac=3d89f2aab02315ee100156209746e0e9f3bc70b0b52c17573300b5caa517cfd6", $headers);
$actualResponse = make_get_request($videoUrl, $headers);
$actualResponse = substr($actualResponse, 0, strpos($actualResponse, "Reference")) . substr($actualResponse, strpos($actualResponse, "</BODY>"));

$this->assertEquals($expectedResponse, $actualResponse);
Expand Down

0 comments on commit 09f0e35

Please sign in to comment.