![]() |
|
YouTube auto like - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: PHP (https://sinister.ly/Forum-PHP) +--- Thread: YouTube auto like (/Thread-YouTube-auto-like) |
YouTube auto like - zomgwtfbbq - 09-26-2013 You can feed this script an array of gmail user accounts and videos to like. Just add them in the arrays. This is just raw code which I will polish up and add to the hacksuite cms so you can have control over accounts and videos without touching the code itself. Thought it would be useful for other people: PHP Code: <?php
$_C00KIES = "cookies.txt";
$aVideos = array("http://www.youtube.com/watch?v=868NCW0jGrU");
$aUsers = array();
$aUsers[0] = array("somemail@gmail.com","password_here");
//$aUsers[1] = array("somemail@gmail.com","password_here");
for($x=0;$x<count($aVideos);$x++){
for($y=0;$y<count($aUsers);$y++){
if(file_exists($_C00KIES)){
@unlink($_C00KIES);
}
$sYTLink = $aVideos[$x];
$sUser = $aUsers[$y][0];
$sPass = $aUsers[$y][1];
if(false!==($iPos = strpos($sYTLink,"&"))){
$sYTLink = substr($sYTLink,0,$iPos);
}
$aVID = explode("=",$sYTLink);
if(!isset($aVID[1])){
die("Invalid video");
}
$sVID = $aVID[1];
// open gmail and get dynamic field values everytime we start a login attempt
$ch = curl_init("https://accounts.google.com/ServiceLogin?continue=http%3A%2F%2Fwww.youtube.com%2Fsignin%3Faction_handle_signin%3Dtrue%26feature%3Dsign_in_button%26hl%3Dnl_NL%26next%3D%252F%26nomobiletemp%3D1&passive=true&service=youtube&uilel=3&hl=nl_NL");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_COOKIEFILE, $_C00KIES);
$sData = curl_exec($ch);
// get login form
$sPattern = "/<form(?=[^>]*novalidate id=\"gaia_loginform\")[^>].+<\/form>/Uis";
preg_match($sPattern,$sData,$aData);
if(isset($aData[0])){
// get action
$sPattern = "/action=\"([^\"]+)/is";
preg_match($sPattern,$aData[0],$aTarget);
$sTarget = $aTarget[1];
// get all inputs
$sPattern = "/<input[^>]+/is";
preg_match_all($sPattern,$aData[0],$aInput);
// go through the inputs and extract the vars and their values
$sPost = "";
for($y=0;$y<count($aInput[0]);$y++){
if($y>0){
$sPost .= "&";
}
// get var names
$sPattern = "/name=\"([^\"]+)/is";
preg_match($sPattern,$aInput[0][$y],$aVar);
if(!isset($aVar[1])){
// no name
continue;
}
$sPost .= $aVar[1]."=";
// add pass
if($aVar[1]=="Passwd"){
$sPost .= $sPass;
continue;
}
// add email/user
if($aVar[1]=="Email"){
$sPost .= $sUser;
continue;
}
// get values
$sPattern = "/value=\"([^\"]+)/is";
preg_match($sPattern,$aInput[0][$y],$aVal);
if(!isset($aVal[1]) || empty($aVal[1])){
// no value
continue;
}
$sPost .= $aVal[1];
}
// in case we are skipping an input with no name
$sPost = str_replace("&&","&",$sPost);
curl_setopt($ch, CURLOPT_URL, $sTarget);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $sPost);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: application/x-www-form-urlencoded"));
$sResponse = curl_exec($ch);
// find the user style string if it is there, login was successful
$iPos = strpos($sResponse,"refresh");
if($iPos){
// ok we have logged in, go to youtube and get the video
curl_setopt($ch, CURLOPT_URL, $sYTLink);
curl_setopt($ch, CURLOPT_POST, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$sResponse = curl_exec($ch);
preg_match('/\'PLAYBACK_ID\':\s+\"(.*)\"/',$sResponse,$aPID);
preg_match('/yt\.setAjaxToken\(\'watch_actions_ajax\',\s+\"(.*)\"/',$sResponse,$aSessionToken);
if(!isset($aPID[1])){
echo"No playback id found";
}
elseif(!isset($aSessionToken[1])){
echo"No session id found";
}
else{
// like this video
curl_setopt($ch, CURLOPT_URL, "http://www.youtube.com/watch_actions_ajax?action_like_video=1&video_id=".$sVID."&plid=".$aPID[1]);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, "session_token=".$aSessionToken[1]."&screen=".rawurlencode("h=800&w=1280&d=24"));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: application/x-www-form-urlencoded"));
$sResponse = curl_exec($ch);
curl_close($ch);
//echo $sResponse;
}
}
else{
echo "Login failed";
}
}
else{
die("Unable to find login form, terminating script\n");
}
}
}
?>RE: YouTube auto like - twix - 09-26-2013 thnks sister great job RE: YouTube auto like - zomgwtfbbq - 09-26-2013 (09-26-2013, 01:38 PM)twix Wrote: thnks sister great jobYou're welcome broski. Will make something similar for facebook as well. :Thumbs-Up: RE: YouTube auto like - Mojang - 09-27-2013 how would i make it dislike the video RE: YouTube auto like - zomgwtfbbq - 09-27-2013 (09-27-2013, 07:57 AM)Mojang Wrote: how would i make it dislike the videoIn the last curl post you should change action_like_video to action_dislike_video. RE: YouTube auto like - zomgwtfbbq - 09-27-2013 Okidoki, have decided that I'm going to create AntiSocial for the hacksuite cms which can be used for blackhat seo-ing on community sites. So far I've come up with the following structure, feel free to add other options as well. PHP Code: <?php
$_CONTEXT['social'] = array();
$_CONTEXT['social']['youtube'] = array();
$_CONTEXT['social']['youtube']['actions'] = array();
$_CONTEXT['social']['youtube']['actions'][0] = array("like videos","YTLike");
$_CONTEXT['social']['youtube']['actions'][1] = array("dislike videos","YTDisLike");
$_CONTEXT['social']['youtube']['actions'][2] = array("channels subscribe","YTChannelSubsribe");
$_CONTEXT['social']['youtube']['actions'][3] = array("comment videos","YTMassComment");
$_CONTEXT['social']['facebook'] = array();
$_CONTEXT['social']['facebook']['actions'] = array();
$_CONTEXT['social']['facebook']['actions'][0] = array("like pages","FBLikePage");
$_CONTEXT['social']['facebook']['actions'][1] = array("post to walls","FBMassWallPost");
?>RE: YouTube auto like - THE-TUMBLE - 10-04-2013 Thanks! good work! RE: YouTube auto like - THE-TUMBLE - 10-04-2013 Thanks! good work! RE: YouTube auto like - THE-TUMBLE - 10-04-2013 Thanks! good work! RE: YouTube auto like - zomgwtfbbq - 10-04-2013 (10-04-2013, 10:54 AM)THE-TUMBLE Wrote: Thanks! good work!Thanks, I love your avatar. :troll: Still haven't done that much on integrating it in the hacksuite, only done the configuration part so far where you can add and remove accounts. |