Auto Wordpress Video site

Status
Not open for further replies.

rograndom

New member
Feb 27, 2007
30
6
0
Alright, so I've lurked on here long enough, here's a quick and dirty way to start an automated Video site using Wordpress, a simple plug-in and some simple PHP.

0. Decide what type of site you want to have (dumb people, music videos, car racing, etc), and, more importantly, what your income stream will be (adsense, affilate, etc).
1. Download and install Wordpress.
2. Install the TubePress plug-in.
3. Now, the TubePress plug-in has to be run manually, we're going to make it automated, here's how. Create a new php file somewhere on your server and pop this in it (don't forget to edit to reflect your particular site)

PHP:
<? 
if (!empty($_GET['wpcat'])) {
$wpcat = urlencode($_GET['wpcat']);
$keyword = urlencode($_GET['keyword']);

$url = 'http://YOURSITE.com/wp-login.php';
$url2 = urlencode('http://YOURSITE.com/wp-admin/admin.php?page=tubepress-tag.php');
$post = 'log=WORDPRESSLOGIN&pwd=WORDPRESSPASSWORD&testcookie=1&redirect_to='.$url2.'&submit=Login';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookies.txt"); 
curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/cookies.txt");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 10);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
echo curl_exec($ch);
curl_close($ch);

$urlb = 'http://YOURSITE.com/wp-admin/admin.php?page=tubepress-tag.php';
$postb = 'tag='.$keyword.'&per_page=50&page=1&cat='.$wpcat.'&update_tp=Import+Videos+%C2%BB';
$chb = curl_init($urlb);
curl_setopt($chb, CURLOPT_COOKIEJAR, "/tmp/cookies.txt"); 
curl_setopt($chb, CURLOPT_COOKIEFILE, "/tmp/cookies.txt");
curl_setopt($chb, CURLOPT_FOLLOWLOCATION, 10);
curl_setopt($chb, CURLOPT_POSTFIELDS, $postb);
curl_setopt($chb, CURLOPT_RETURNTRANSFER, 1);
echo curl_exec($chb);
curl_close($chb);

} else {
?>
<html>
<head>
</head>
<body>
<form method="get">
<p>Category: <input type="test" name="wpcat"></p>
<p>Keyword:<input type="test" name="keyword"></p>
<input type="submit">
</form>
</body>
<? } ?>
This script will login to your Wordpress install and run the Tubepress script for you with your selected Keyword and populate a Category. You can load this file directly and it will prompt you for the Keyword and Category you want to use for quick additions. But to automate:

5. In your CPanel, edit your cron jobs to add the following to run once or twice a day:

HTML:
curl --output=/dev/null "http://YOURSITE.COM/SCRIPTLOCATION.php?wpcat=WORDPRESSCATEGORY&keyword=KEYWORD"
6. Install a nice wordpress theme that goes with your site topic (no death metal themes on a kitten site), and throw in some ads of your choice and you're all set.
 


Good, simple, clean working idea. Props, man. +rep. PHP posts are valuable information people don't really take too much advantage of..
 
Nice post. I spent 2 days sourcing 3 months worth of vids for a video blog. Feels good knowing I'll never have to do that again.
 
I have a question...

Lets say i use the keyword "car" , but i dont want to have any thing that is related to "car insurance" is there a way to exclude car insurance ? or would i have to find and delete all the car insurance related video afterwards...

Also once a category is populated, can i go and delete certain posts i dont want to see ? I am guessing yes, but then at the next update when using the automated method, it will add that same video again ?

Also, if you populate a " racing car " category, using the "racing car" keywords, and then create another category called "street racing car" , is it going to create a duplicate video or can it just add the right tag/category to the existing post....


Thanks for your help ! you did something pretty cool !
 
Nice post. I've found caffientated content is the dog's bollocks for video sites, but doesn't keep posting either... I was looking at using the WP pseudo-cron, but this method is simpler. Nice one... have some more rep!
 
I have a question...

Lets say i use the keyword "car" , but i dont want to have any thing that is related to "car insurance" is there a way to exclude car insurance ? or would i have to find and delete all the car insurance related video afterwards...

Also once a category is populated, can i go and delete certain posts i dont want to see ? I am guessing yes, but then at the next update when using the automated method, it will add that same video again ?

Also, if you populate a " racing car " category, using the "racing car" keywords, and then create another category called "street racing car" , is it going to create a duplicate video or can it just add the right tag/category to the existing post....


Thanks for your help ! you did something pretty cool !

Drill down more, don't worry about words like plain old "car". Do "Ford Mustang GT", "Audi TT", "Nissan 240sx drifting", etc. Just create a cron job for each of them, but don't have them run at the same time though try to space them out, your host may not like you very much if you're adding 25 entries a second for five minutes straight, every hour.

While being able to create categories for each search is pretty good for SEO, Tubepress is going pull in the YouTube tags for you too, which is really bad-ass. Pop that tag cloud widget into your sidebar. And you've opened a ton of doors a few weeks down the road when you've got a few thousand videos archived and tagged.

You can go back and delete the ones you don't like, but it's currently set to add the 50 newest videos. Maybe 50 new videos have been uploaded since your last refresh and you won't have to worry about the ones you deleted? Or, it's probably better just to set those as "Unpublished" so they're still and the system and I'm 99% sure that Tubepress does check for dupes across categories, but only by YouTube ID. So if the same video is on YouTube twice under a different title and tags, then it's going to show up twice on your site if you manage to tag both.
 
...While being able to create categories for each search is pretty good for SEO, Tubepress is going pull in the YouTube tags for you too, which is really bad-ass...

...I'm 99% sure that Tubepress does check for dupes across categories, but only by YouTube ID...

About the categories, every keyword inputed into tubepress plugin generates a new category ? can you tell it to use X, Y, Z keywords for a specific category or will it create 1 category per keyterms ? In which case, it would be best to only use all the tags that will be fetched as main navigation me thinks...

As for dupes across categories, its pretty cool that tubepress checks for dupe accross categories, but lets say i have 1 video called " Ferrari vs Audi race " , if i have a cron for the keyword ferrari, and one for the keyword audi, and one for the keyword race... the optimal result would be 1 post that belongs to 3 different category... the worst would be 3 post that belong to 1 category each... what do you think will happen ?


Ill try this thing over the weekend, just want to have a good ideal of how it works so i can organize something.... meh, anyways
sorry for all these questions, im giving you some reps :) . thanks again !
 
About the categories, every keyword inputed into tubepress plugin generates a new category ? can you tell it to use X, Y, Z keywords for a specific category or will it create 1 category per keyterms ? In which case, it would be best to only use all the tags that will be fetched as main navigation me thinks...

As for dupes across categories, its pretty cool that tubepress checks for dupe accross categories, but lets say i have 1 video called " Ferrari vs Audi race " , if i have a cron for the keyword ferrari, and one for the keyword audi, and one for the keyword race... the optimal result would be 1 post that belongs to 3 different category... the worst would be 3 post that belong to 1 category each... what do you think will happen ?

Ill try this thing over the weekend, just want to have a good ideal of how it works so i can organize something.... meh, anyways
sorry for all these questions, im giving you some reps :) . thanks again !

You get to choose which keywords go in which categories. Just mix and match the two URL parameters.

You can do:

Category: Audi / Keyword: audi tt
Category: Audi / Keyword: audi r8
Category: Audi / Keyword: audi quattro rally

All of these are separate cron jobs. Separate out the keywords so you get broader matches. If you do something like this:

Category: Audi / Keyword: audi tt r8 quattro

You'll only get items that have all of those keywords.

Then, you can also do

Category: Street Racing / keyword: audi street race
Category: Street Racing / keyword: bmw street race
Category: Street Racing / keyword: ferrari street race

Etc. If some of the Audi videos have already gone into your previous "Audi" category, they won't appear in the new "Racing" category, but that's where the tags come in. If someone clicks on the "Audi" tag, all of the videos tagged with "audi" from all the categories will come up.
 
so from what i understand, the best way to structure the website would be to forget about category and focus on tags as "main" navigation...

category can be used as well, but tags seems better... meh anyways ill play around with it, thanks for all the info
 
As my cron jobs are a bit odd and can only run such a 'usr/bin/php' etc. and not the above I tweaked the php a bit to the following code:

Code:
<?php
$wpcat = 'DEFAULT CAT';
$keyword = 'DEFAULT KEYWORD';
$number = rand(1, 6);

switch ($number)
{
case 1:
  $keyword = 'funny'; 
  $wpcat = 'primarycat';
  break;
case 2:
  $keyword = 'funny videos'; 
  break;
case 3:
$keyword = 'lol';
  break;
case 4:
$keyword = 'rofl';
  break;
case 5:
$keyword = 'wtf';
break;
case 6:
$keyword = 'standup comedy';
default:
  echo "FAIL!";
}

$url = 'http://WEBSITE.com/wp-login.php';
$url2 = urlencode('http://WEBSITE.com/wp-admin/admin.php?page=tubepress-tag.php');
$post = 'log=USER&pwd=PASSWORD&testcookie=1&redirect_to='.$url2.'&submit=Login';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookies.txt"); 
curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/cookies.txt");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 10);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
echo curl_exec($ch);
curl_close($ch);

$urlb = 'http://WEBSITE.com/wp-admin/admin.php?page=tubepress-tag.php';
$postb = 'tag='.$keyword.'&per_page=3&page=1&cat='.$wpcat.'&update_tp=Import+Videos+%C2%BB';
$chb = curl_init($urlb);
curl_setopt($chb, CURLOPT_COOKIEJAR, "/tmp/cookies.txt"); 
curl_setopt($chb, CURLOPT_COOKIEFILE, "/tmp/cookies.txt");
curl_setopt($chb, CURLOPT_FOLLOWLOCATION, 10);
curl_setopt($chb, CURLOPT_POSTFIELDS, $postb);
curl_setopt($chb, CURLOPT_RETURNTRANSFER, 1);
echo curl_exec($chb);
curl_close($chb);

?>

etc.

What this enables you to do is make it randomly update from different keywords to different cats. using a cron command like

Code:
 /usr/bin/php /home/username/file.php

useful for shared hosts etc.

If you want to add a new keyword just add a number to '$number' i.e. set the random one more up and add something like:

Code:
case 7:
   $keyword = 'monty python'; 
  $wpcat = 'Monty Python';
   break;

Thanks to the opp for the original code!
 
Status
Not open for further replies.