Adult Script Pro Community Forums

The forum is here for legacy reasons. No new posts will be created. User registration is disabled! If you have any questions, please email us or check https://www.adultscriptpro.com for more details!

You are not logged in.

#1 2019-11-08 10:26:27

thiva7
Member
Registered: 2011-04-30
Posts: 1,022

webmaster "tool" to share your videos v3

Hey
i have create based on andrian code of course some extra tools that may help to get some extra traffic based on your video export.
most of tube site give option to download CSV videos, so i create a "tool"for that .

step 1

add export videos from admin->videos->Exports

step 2

add a content page for webmasters from admin->content->add
(we will come back to this later )

step 3
create on  your public_html a folder "webmasters"

step 4

create a file named "create_csv.php" , and replace exmple.com with your URL

and add this code inside

<?php
define('_VALID', true);
require 'libraries/bootstrap.php';


function build_csv($videos, $fields, $method)
{
	$columns	= array_flip(explode(',', $fields));
	$filter		= VF::factory('filter');
$access_key	= (isset($_GET['key'])) ? $filter->get('key', 'STRING', 'GET') : '';
if ($access_key == '') {
	die('Invalid access key (1)!');
}

$emodel		= VModel::load('export', 'video');
if (!$export = $emodel->get($access_key)) {
	die('Invalid access key (2)!');
}
	
	
	$main_url = "https://www.example.com";
	$output		= array();
	foreach ($videos as $video) {
		$video_id	= (int) $video['video_id'];
		$entry		= array();
		
		if (isset($columns['video_id'])) {
			$entry[$columns['video_id']] 	= $video_id;
		}
		
		if (isset($columns['url'])) {
			$entry[$columns['url']]			= video_view_url($video_id, $video['slug']."/?utm_source=".$export['csource']."&utm_medium=".$export['cmedium']."&utm_campaign=".$export['cexport']."", null, false, true);
		}
		
		if (isset($columns['title'])) {
			$entry[$columns['title']]		= $video['title'];
		}

		if (isset($columns['description'])) {
			$entry[$columns['description']]	= $video['description'];
		}		

		if (isset($columns['categories'])) {
			$entry[$columns['categories']]	= $video['categories'];
		}

		if (isset($columns['tags'])) {
			$entry[$columns['tags']]		= $video['tags'];
		}

		if (isset($columns['duration'])) {
			$entry[$columns['duration']]	= (int) $video['duration'];
		}

		if (isset($columns['add_date'])) {
			$entry[$columns['add_date']]	= date('Y-m-d H:i:s', $video['add_time']);
		}

		if (isset($columns['thumb'])) {
			$entry[$columns['thumb']]		= $main_url .''. THUMB_URL.'/'.path($video['video_id']).'/'.$video['thumb'].'.jpg';
		}

		if (isset($columns['thumbs'])) {
			$thumbs	= array();
			for ($thumb = 1; $thumb <= $video['thumbs']; $thumb++) {
				$thumbs[]					= $main_url .''. THUMB_URL.'/'.path($video['video_id']).'/'.$thumb.'.jpg';
			}
		
			$entry[$columns['thumbs']]		= implode(',', $thumbs);
		}

		if (isset($columns['embed'])) {
			$entry[$columns['embed']]		= ($video['embed_code'] != '') ? $video['embed_code'] : '<iframe src="'.BASE_URL.'/embed/'.$video_id.'/" width="100%" height="100%" frameborder="0" border="0" scrolling="no"></iframe>';
		}		
		
		ksort($entry);
		$output[]	= implode('|', $entry);
	}
	
			$date = date("Y-m-d");
			$p =  implode("\n", $output);
			$p =  file_put_contents('webmasters/CSV_export-'.$date.'.csv',$p);
			$p;
	 
			  // output headers so that the file is downloaded rather than displayed
		  header("Content-type: text/csv");
		  header("Content-disposition: attachment; filename = ".$main_url."/webmasters/CSV_export-".$date.".csv");
		  readfile("".$main_url."/webmasters/CSV_export-".$date.".csv");
			
}



$videos	= $emodel->videos($args);
if ($ext == 'xml') {
	$content	= build_xml($videos, $fields, $method);
} else {
	$content	= build_csv($videos, $fields, $method);
}

if ($export['cache_ttl'] > 0 and $timeline == 'all') {
	file_put_contents($cache_file, $content);
}

echo $content;

VF::close();

Now in your browser open URL : exmple.com/create_csv.php?key=KEY&fields=url,title,categories,tags,thumbs,duration,embed

replace KEY with the key generated in step 1


Each time this URL run will save new CSV to webmaster folder

you can go to your content manage page in admin and add this url AS href and will download fresh CSV each time

exmple.com/create_csv.php?key=KEY&fields=url,title,categories,tags,thumbs,duration,embed


Enjoy

Offline

Board footer

Powered by FluxBB