Skip to content

Instantly share code, notes, and snippets.

@moolex
Created January 20, 2013 05:02
Show Gist options
  • Save moolex/4576758 to your computer and use it in GitHub Desktop.
Save moolex/4576758 to your computer and use it in GitHub Desktop.
豆瓣相册下载(单文件)
<?php
$start = @$_GET['start'];
$start || $start = 0;
$d = file_get_contents('http://www.douban.com/photos/album/20987752/?start='.$start);
preg_match_all('/\/photos\/photo\/(\d{10})\/"/i', $d, $photo_ms);
preg_match_all('/http:\/\/img(\d{1})\.douban\.com\//i', $d, $server_ms);
preg_match_all('/class="photolst_photo" title="(.*?)"/is', $d, $title_ms);
foreach ($photo_ms[1] as $i => $imgID)
{
$imgSV = $server_ms[1][$i];
$imgTT = $title_ms[1][$i];
$img_url = 'http://img'.$imgSV.'.douban.com/view/photo/photo/public/p'.$imgID.'.jpg';
file_put_contents('dm/s.'.$imgSV.'.'.$imgID.'.jpg', file_get_contents($img_url));
file_put_contents('dm/s.'.$imgSV.'.'.$imgID.'.txt', $imgTT);
}
$start += 18;
?>
<script>
window.location = '?start=<?=$start?>';
</script>
downloading....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment