Skip to content

Commit

Permalink
asdasd
Browse files Browse the repository at this point in the history
  • Loading branch information
surya432 committed Apr 22, 2020
1 parent 41e559f commit 4900c62
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 21 deletions.
11 changes: 11 additions & 0 deletions app/Http/Controllers/GoogleDrivePlayerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

class GoogleDrivePlayerController extends Controller
{
use HelperController;

/**
* Display a listing of the resource.
*
Expand Down Expand Up @@ -133,6 +135,15 @@ public function getlist()
$data = GoogleDrivePlayer::where('status', 'active')->inRandomOrder()->first();
return response()->json($data);
}
public function getDataWebLink($id){
$dataCurl=$this->viewsource("https://www.googleapis.com/drive/v3/files/".$id."?alt=json&fields=webContentLink%2Cid&");
$data = json_decode($dataCurl,true);

if(isset($data['webContentLink'])){
return $data['webContentLink'];
}
return null;
}
public function jsonDataTable()
{
$query = \App\GoogleDrivePlayer::orderBy('id', 'desc')->get();
Expand Down
46 changes: 26 additions & 20 deletions public/curl_gd.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ function GoogleDrive($gid)
$iframeid = my_simple_crypt($gid);
//$title = gdTitle($gid);
//$img = gdImg($gdurl);
$streaming_vid = Drive($gid, "1");

return $streaming_vid = Drive($gid, "2");
if (empty($streaming_vid) || is_null($streaming_vid) || $streaming_vid == "Error") {
$streaming_vid = Drive($gid, "2");
if (empty($streaming_vid) || is_null($streaming_vid) || $streaming_vid == "Error") {
Expand Down Expand Up @@ -44,7 +43,6 @@ function Drive($gid, $try)
$arrays = explode('|', $create_cache);
$cache = $arrays[0];
$cache = $linkdown;

} else {
$cache = $data[1];
}
Expand Down Expand Up @@ -76,28 +74,40 @@ function gd_cache($gid, $source)
}
return $msn;
}
function getCookies(){
return "";
function getCookies($id)
{
$hostName = "//" . $_SERVER['HTTP_HOST'] . "/drive/getDataWebLink/" . $id;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $hostName);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
$headers = array();
$headers[] = 'Accept: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
return "";
}
curl_close($ch);
return $result;
}
function getlink($id, $try)
{
$link = "https://drive.google.com/uc?export=download&id=$id";
$ch = curl_init();
$cookies = "cookies" . rand(1, 5);
$jsoncookies = getCookies();
if ($try == "2") {
$link = getCookies($id);
}
curl_setopt($ch, CURLOPT_URL, $link);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 10);
// curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
if ($try == "2") {
curl_setopt($ch, CURLOPT_COOKIE, $jsoncookies);
} else {
curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__) . "/google.mp3");
curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__) . "/google.mp3");
}
curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__) . "/google.mp3");
curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__) . "/google.mp3");
$page = curl_exec($ch);
$get = locheader($page);
if (strpos($page, "Can't")) {
Expand All @@ -120,12 +130,8 @@ function getlink($id, $try)
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 600);
if ($try == "2") {
curl_setopt($ch, CURLOPT_COOKIE, $jsoncookies);
} else {
curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__) . "/google.mp3");
curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__) . "/google.mp3");
}
curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__) . "/google.mp3");
curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__) . "/google.mp3");
$page = curl_exec($ch);
$get = locheader($page);
}
Expand Down
2 changes: 1 addition & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
Route::get('/ajax/videos/{url}', function () {
return abort(404);
});
Route::get('/drive/cookies', ['as' => 'googleDriveCookies', 'uses' => 'GoogleDrivePlayerController@getlist']);
Route::get('/drive/getDataWebLink/{id}', ['as' => 'googleDrivegetDataWebLink', 'uses' => 'GoogleDrivePlayerController@getDataWebLink']);
Route::get('/detail/drama', ['as' => 'dramacurl', 'uses' => 'WebfrontsController@asiawiki']);
Route::post('/ajax/videos/{url}', ['as' => 'ajaxEps', 'uses' => 'EmbedController@getDetail']);
Route::get('/login', ['as' => 'login', 'uses' => 'LoginController@login']);
Expand Down

0 comments on commit 4900c62

Please sign in to comment.