Skip to content

Instantly share code, notes, and snippets.

@BANKA2017
Last active February 11, 2019 08:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BANKA2017/bc3be3cc58ccfe07d0d550b76008e839 to your computer and use it in GitHub Desktop.
Save BANKA2017/bc3be3cc58ccfe07d0d550b76008e839 to your computer and use it in GitHub Desktop.
百度学术任务
<?php
$bduss = '';//填入bduss
$cookie = 'BDUSS='.$bduss;
function t($tk,$cookie) {
$url = 'https://xueshu.baidu.com/usercenter/show/userinfo?cmd=update_task&task_type='.$tk;
$ch = curl_init($url);
curl_setopt($ch,CURLOPT_USERAGENT ,'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36');
curl_setopt($ch,CURLOPT_RETURNTRANSFER ,true);
curl_setopt($ch,CURLOPT_COOKIE ,$cookie);
$content = json_decode(curl_exec($ch),true);
curl_close($ch);
if ($content['status'] == 200)
echo $tk .":执行成功\n";
}
foreach (["firstLookSub" => 1, "firstLogin" => 1, "firstLoginHelp" => 1, "firstSimpleSearch" => 1, "firstAdvancedSearch" => 1, "firstLookFavorite" => 1, "recommendKeyword" => 1, "newLable" => 3, "favoritePaper" => 2, "addSub" => 2] as $key => $value) {
for ($x = 0; $x < $value; $x++) {
t($key, $cookie);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment