【python学习】零基础编写批量下载4K壁纸爬虫脚本

如何使用python访问网站

相关代码

首先,我们引入requests模块,完成模拟访问网页的操作,并查看其返回的内容,完成初步的网站访问尝试

在初步摸索阶段,访问任何网站都可以使用下面的代码

import requests

url='https://m.bcoderss.com/tag/4k/'
headers={
    'user-agent':'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1'
}
response = requests.post(url=url, headers=headers)
print(response.text)

相关参数解释

  • url:需要采集的网站链接
  • headers中的user-agent为客户端UA,可以参考常见的UA

也可以使用浏览器,按F12打开开发者工具,选择Network,然后刷新页面,找到我们模拟的User-Agent

图片[1]-【python学习】零基础编写批量下载4K壁纸爬虫脚本-FancyPig's blog
  • 使用requests.post方法完成对网站的post请求
  • 使用print打印响应的页面内容

访问后的响应内容

<!DOCTYPE html>
<html lang="en">
<head>
	
	<title>4K壁纸- 全面屏手机壁纸</title>
 <meta name="keywords" content="" />
 <meta name="description" content="" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="baidu-site-verification" content="OG0dxlSADD" />
	<meta name="apple-mobile-web-app-capable" content="yes" />
	<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> 
	
	<meta name="apple-mobile-web-app-status-bar-style" content="white" />
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<meta name="apple-mobile-web-app-title" content="全面屏壁纸">
	<meta name="browsermode" content="application">


		<link rel="stylesheet" type="text/css" href="https://m.bcoderss.com/wp-content/themes/new_wallpaper/css/bootstrap.min.css">


<!-- 	<link rel="stylesheet" type="text/css" href="https://cdn.bootcss.com/twitter-bootstrap/4.4.1/css/bootstrap.min.css">
	 -->	<link rel="stylesheet" type="text/css" href="https://cdn.bootcdn.net/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
	<link rel="stylesheet" type="text/css" href="https://m.bcoderss.com/wp-content/themes/new_wallpaper/css/main.css">
	<link rel="stylesheet" type="text/css" href="https://m.bcoderss.com/wp-content/themes/new_wallpaper/style.css?v=20110011611">
	<link rel="shortcut icon" type="images/x-icon" href="https://m.bcoderss.com/wp-content/themes/new_wallpaper/favicon.ico" />

	<script src="https://lib.sinaapp.com/js/jquery/1.12.4/jquery-1.12.4.min.js"></script>
			
	<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>


	<!-- Include the imagesLoaded plug-in -->
	<script src="https://m.bcoderss.com/wp-content/themes/new_wallpaper/js/jquery.imagesloaded.js"></script>

	<!-- Include the plug-in -->
	<script src="https://m.bcoderss.com/wp-content/themes/new_wallpaper/js/jquery.wookmark.js"></script>
<!--  -->
	<script src="https://m.bcoderss.com/wp-content/themes/new_wallpaper/js/index.js?v=2020274851"></script>
	<script src="https://m.bcoderss.com/wp-content/themes/new_wallpaper/js/common.js?v=2020011127"></script>

	<script src="https://m.bcoderss.com/wp-content/themes/new_wallpaper/js/audio.min.js?v=2020110127"></script>
	<link rel="shortcut icon" href="https://m.bcoderss.com/wp-content/themes/new_wallpaper/favicon.ico" type="image/x-icon"> 


<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?ce3020881c73bb20f0830ef4ed0a61fb";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>




<script>

$(function(){
	 $('img').on('mousedown',function (e) {
    e.preventDefault()
})

})


document.getElementsByTagName('img').onmousedown = function(e){
    e.preventDefault();
};


document.onkeydown = function(){

    if(window.event && window.event.keyCode == 123) {
        
        event.keyCode=0;
        event.returnValue=false;
    }
    if(window.event && window.event.keyCode == 13) {
        window.event.keyCode = 505;
    }
    if(window.event && window.event.keyCode == 8) {
        alert(str+"\n请使用Del键进行字符的删除操作!");
        window.event.returnValue=false;
    }

}

document.oncontextmenu = function (event){
if(window.event){
event = window.event;
}try{
var the = event.srcElement;
if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){
return false;
}
return true;
}catch (e){
return false;
}
}

document.onpaste = function (event){
if(window.event){
event = window.event;
}try{
var the = event.srcElement;
if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){
return false;
}
return true;
}catch (e){
return false;
}
}

document.oncopy = function (event){
if(window.event){
event = window.event;
}try{
var the = event.srcElement;
if(!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){
return false;
}
return true;
}catch (e){
return false;
}
}

document.oncut = function (event){
if(window.event){
event = window.event;
}try{
var the = event.srcElement;
if(!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){
return false;
}
return true;
}catch (e){
return false;
}
}

</script>

<style>
  footer p{
    font-size: 11px;
  }
</style>






</head>
<body>

	<header>
		<nav class="top">
			<div class="container-fluid">
				<div class="header">
					<div class="logo"><a href="https://m.bcoderss.com"><img src="https://m.bcoderss.com/wp-content/themes/new_wallpaper/img/logo.png" ></a></div>
				 	
				 	<form class="search" role="search" method="get" class="search-form" action="https://m.bcoderss.com">

				 		<input type="text" class="form-control"  value="" name="s" id="search" placeholder="搜索壁纸,铃声">

				 		<i class="fa fa-search tb-search" aria-hidden="true"><input type="submit"></i>
				 		
				 	</form>
				 	<div class="menu">
						<ul>
							 <li><a target="_blank" style="color:#e6b87c" href="https://m.bcoderss.com/vip"><i class="fa fa-diamond  fa-lg" aria-hidden="true"></i> VIP专区</a></li> 
							<li><a target="_blank" href="https://m.bcoderss.com/upload">上传壁纸</a></li>
					
							<!-- <li class="select"><a href="javascript:;">分辨率 <i class="fa fa-angle-down" aria-hidden="true"></i></a></li>
							 <li><a target="_blank" style="color:#e6b87c" href="/vip_wallpaper_type/电脑壁纸/"><i class="fa fa-diamond  fa-lg" aria-hidden="true"></i> 电脑壁纸</a></li>  -->

							 <li><a target="_blank" style="color:#e6b87c" href="https://m.bcoderss.com/bing"><i class="fa fa-diamond  fa-lg" aria-hidden="true"></i> 4K电脑壁纸</a></li> 

							 <li class="date"><a href="javascript:;"><i class="fa fa-calendar fa-lg" aria-hidden="true"></i> 日历</a></li>

							

							<div class="selectList">
									<a href="https://m.bcoderss.com/category/1920x1080/" >1920×1080</a> (2,120)<br />
	<a href="https://m.bcoderss.com/category/2048x2048/" >2048×2048</a> (2)<br />
	<a href="https://m.bcoderss.com/category/2160x1080/" >2160×1080</a> (3,738)<br />
	<a href="https://m.bcoderss.com/category/2208x1242/" >2208×1242</a> (22)<br />
	<a href="https://m.bcoderss.com/category/2260x1080/" >2260×1080</a> (600)<br />
	<a href="https://m.bcoderss.com/category/2280x1080/" >2280×1080</a> (148)<br />
	<a href="https://m.bcoderss.com/category/2316-x-1080/" >2316×1080</a> (19)<br />
	<a href="https://m.bcoderss.com/category/2331x1080/" >2331×1080</a> (9)<br />
	<a href="https://m.bcoderss.com/category/2340x1080/" >2340×1080</a> (1,086)<br />
	<a href="https://m.bcoderss.com/category/2340x2160/" >2340×2160</a> (52)<br />
	<a href="https://m.bcoderss.com/category/2400x1080/" >2400×1080</a> (207)<br />
	<a href="https://m.bcoderss.com/category/2436-x-1125/" >2436×1125</a> (23,649)<br />
	<a href="https://m.bcoderss.com/category/2438-x-1126/" >2438×1126</a> (11)<br />
	<a href="https://m.bcoderss.com/category/2520x1080/" >2520×1080</a> (5)<br />
	<a href="https://m.bcoderss.com/category/2532x1170/" >2532×1170</a> (3)<br />
	<a href="https://m.bcoderss.com/category/2560x1440/" >2560×1440</a> (334)<br />
	<a href="https://m.bcoderss.com/category/2688x1242/" >2688×1242</a> (140)<br />
	<a href="https://m.bcoderss.com/category/2880x1440/" >2880×1440</a> (29)<br />
	<a href="https://m.bcoderss.com/category/2934x1356/" >2934×1356</a> (10)<br />
	<a href="https://m.bcoderss.com/category/2960x1440/" >2960×1440</a> (916)<br />
	<a href="https://m.bcoderss.com/category/3040x1440/" >3040×1440</a> (47)<br />
	<a href="https://m.bcoderss.com/category/3120x1440/" >3120×1440</a> (74)<br />
	<a href="https://m.bcoderss.com/category/3200x1440/" >3200X1440</a> (42)<br />
	<a href="https://m.bcoderss.com/category/3436-x-1587/" >3436×1587</a> (3)<br />
	<a href="https://m.bcoderss.com/category/3840x2160/" >3840×2160</a> (152)<br />
	<a href="https://m.bcoderss.com/category/4683x2160/" >4683×2160</a> (7)<br />
	<a href="https://m.bcoderss.com/category/%e8%b6%85%e6%b8%85%e5%8e%9f%e5%9b%be/" >超清原图</a> (1,101)<br />
							</div>
						</ul>
					
					</div>
					<div class="user">
						
							<a class="login" href="https://m.bcoderss.com/login">登陆</a>
							<a class="reg" href="https://m.bcoderss.com/register">注册</a>


											
						
					</div>
				</div>

				<nav class="mobile-header">
<div class="mobile-menu">
<ul>
	<li class="home"><a href="https://m.bcoderss.com"><i class="fa fa-home fa-lg" aria-hidden="true"></i></span></a></li>
	<li class="vip"><a style="color:#e6b87c;" href="https://m.bcoderss.com/vip"><i class="fa fa-diamond  fa-lg" aria-hidden="true"></i></a></li>
	<li class="date"><a href="javascript:;"><i class="fa fa-calendar fa-lg" aria-hidden="true"></i></a></li>
	
	<li class="upload"><a href="https://m.bcoderss.com/upload"><i class="fa fa-cloud-upload fa-lg" aria-hidden="true"></i></a></li>
	<li class="mobile-search"><a href="javascript:"><i class="fa fa-search fa-lg" aria-hidden="true"></i></a></li>
	
	<li class="user"><a href="https://m.bcoderss.com/login"><i class="fa fa-user-circle fa-lg" aria-hidden="true"></i></a></li>
	
</ul>
</div>

</nav>



	<div class="search-cover" style="display: none;">
	<form class="search" role="search" method="get" class="search-form" action="https://m.bcoderss.com">

				 		<input type="text" class="form-control"  value="" name="s" id="search" placeholder="请输入搜索内容">

				 		<i class="fa fa-search tb-search" aria-hidden="true"><input type="submit"></i>
				 		<span class="cancel">取消</span>
				 		
				 	</form>
	
	</div>


				
				
			</div>


		
			
		</nav>
	</header>

		
			
			<div class="tag"><a href="https://m.bcoderss.com" class="tagall">最新</a><ul class='wp-tag-cloud' role='list'>
	<li><a href="https://m.bcoderss.com/tag/iphone/" class="tag-cloud-link tag-link-19 tag-link-position-1" style="font-size: 14px;">iphone</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e5%8a%a8%e7%89%a9/" class="tag-cloud-link tag-link-8 tag-link-position-2" style="font-size: 14px;">动物</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e9%a3%8e%e6%99%af/" class="tag-cloud-link tag-link-9 tag-link-position-3" style="font-size: 14px;">风景</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e7%be%8e%e5%a5%b3/" class="tag-cloud-link tag-link-46 tag-link-position-4" style="font-size: 14px;">美女</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e8%ae%be%e8%ae%a1/" class="tag-cloud-link tag-link-21 tag-link-position-5" style="font-size: 14px;">设计</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e5%8a%a8%e6%bc%ab/" class="tag-cloud-link tag-link-14 tag-link-position-6" style="font-size: 14px;">动漫</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e8%b6%85%e6%b8%852k/" class="tag-cloud-link tag-link-100 tag-link-position-7" style="font-size: 14px;">2K</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e6%8a%bd%e8%b1%a1/" class="tag-cloud-link tag-link-20 tag-link-position-8" style="font-size: 14px;">抽象</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e6%b8%b8%e6%88%8f/" class="tag-cloud-link tag-link-42 tag-link-position-9" style="font-size: 14px;">游戏</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e4%b8%89%e6%98%9f/" class="tag-cloud-link tag-link-17 tag-link-position-10" style="font-size: 14px;">三星</a></li>
	<li><a href="https://m.bcoderss.com/tag/iphonex/" class="tag-cloud-link tag-link-51 tag-link-position-11" style="font-size: 14px;">iphoneX</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e5%b0%8f%e7%b1%b3/" class="tag-cloud-link tag-link-96 tag-link-position-12" style="font-size: 14px;">小米</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e5%8d%8e%e4%b8%ba/" class="tag-cloud-link tag-link-84 tag-link-position-13" style="font-size: 14px;">华为</a></li>
	<li><a href="https://m.bcoderss.com/tag/vivo/" class="tag-cloud-link tag-link-86 tag-link-position-14" style="font-size: 14px;">vivo</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e7%94%b5%e5%bd%b1/" class="tag-cloud-link tag-link-40 tag-link-position-15" style="font-size: 14px;">电影</a></li>
	<li><a href="https://m.bcoderss.com/tag/ios/" class="tag-cloud-link tag-link-72 tag-link-position-16" style="font-size: 14px;">ios</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e9%bb%91%e8%89%b2/" class="tag-cloud-link tag-link-183 tag-link-position-17" style="font-size: 14px;">黑色</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e5%9f%8e%e5%b8%82/" class="tag-cloud-link tag-link-41 tag-link-position-18" style="font-size: 14px;">城市</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e6%98%9f%e7%a9%ba/" class="tag-cloud-link tag-link-12 tag-link-position-19" style="font-size: 14px;">星空</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e8%8b%b9%e6%9e%9c/" class="tag-cloud-link tag-link-340 tag-link-position-20" style="font-size: 14px;">苹果</a></li>
	<li><a href="https://m.bcoderss.com/tag/oppo/" class="tag-cloud-link tag-link-60 tag-link-position-21" style="font-size: 14px;">oppo</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e7%ae%80%e7%ba%a6/" class="tag-cloud-link tag-link-18 tag-link-position-22" style="font-size: 14px;">简约</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e5%8d%8e%e7%a1%95/" class="tag-cloud-link tag-link-170 tag-link-position-23" style="font-size: 14px;">华硕</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e8%8a%b1/" class="tag-cloud-link tag-link-52 tag-link-position-24" style="font-size: 14px;">花</a></li>
	<li><a href="https://m.bcoderss.com/tag/4k/" class="tag-cloud-link tag-link-125 tag-link-position-25" style="font-size: 14px;">4K</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e6%b5%b7/" class="tag-cloud-link tag-link-63 tag-link-position-26" style="font-size: 14px;">海</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e4%b8%80%e5%8a%a0/" class="tag-cloud-link tag-link-119 tag-link-position-27" style="font-size: 14px;">一加</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e8%bd%a6/" class="tag-cloud-link tag-link-16 tag-link-position-28" style="font-size: 14px;">车</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e6%96%87%e5%ad%97/" class="tag-cloud-link tag-link-106 tag-link-position-29" style="font-size: 14px;">文字</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e4%b8%ad%e5%85%b4/" class="tag-cloud-link tag-link-95 tag-link-position-30" style="font-size: 14px;">中兴</a></li>
	<li><a href="https://m.bcoderss.com/tag/lg/" class="tag-cloud-link tag-link-79 tag-link-position-31" style="font-size: 14px;">LG</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e5%88%9b%e6%84%8f/" class="tag-cloud-link tag-link-10 tag-link-position-32" style="font-size: 14px;">创意</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e5%93%81%e7%89%8c/" class="tag-cloud-link tag-link-44 tag-link-position-33" style="font-size: 14px;">品牌</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e9%9b%aa%e5%b1%b1/" class="tag-cloud-link tag-link-65 tag-link-position-34" style="font-size: 14px;">雪山</a></li>
	<li><a href="https://m.bcoderss.com/tag/miui/" class="tag-cloud-link tag-link-396 tag-link-position-35" style="font-size: 14px;">miui</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e7%94%b5%e8%84%91/" class="tag-cloud-link tag-link-467 tag-link-position-36" style="font-size: 14px;">电脑</a></li>
	<li><a href="https://m.bcoderss.com/tag/google/" class="tag-cloud-link tag-link-531 tag-link-position-37" style="font-size: 14px;">google</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e8%b0%b7%e6%ad%8c/" class="tag-cloud-link tag-link-403 tag-link-position-38" style="font-size: 14px;">谷歌</a></li>
	<li><a href="https://m.bcoderss.com/tag/pixel/" class="tag-cloud-link tag-link-78 tag-link-position-39" style="font-size: 14px;">Pixel</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e5%b9%b3%e6%9d%bf/" class="tag-cloud-link tag-link-466 tag-link-position-40" style="font-size: 14px;">平板</a></li>
	<li><a href="https://m.bcoderss.com/tag/zte/" class="tag-cloud-link tag-link-532 tag-link-position-41" style="font-size: 14px;">ZTE</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e6%98%8e%e6%98%9f/" class="tag-cloud-link tag-link-43 tag-link-position-42" style="font-size: 14px;">明星</a></li>
	<li><a href="https://m.bcoderss.com/tag/sony-xperia/" class="tag-cloud-link tag-link-83 tag-link-position-43" style="font-size: 14px;">Sony Xperia</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e5%8d%a1%e9%80%9a/" class="tag-cloud-link tag-link-80 tag-link-position-44" style="font-size: 14px;">卡通</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e9%ad%85%e6%97%8f/" class="tag-cloud-link tag-link-88 tag-link-position-45" style="font-size: 14px;">魅族</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e4%ba%8c%e6%ac%a1%e5%85%83/" class="tag-cloud-link tag-link-215 tag-link-position-46" style="font-size: 14px;">二次元</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e5%a4%a7%e6%b5%b7/" class="tag-cloud-link tag-link-87 tag-link-position-47" style="font-size: 14px;">大海</a></li>
	<li><a href="https://m.bcoderss.com/tag/amoled/" class="tag-cloud-link tag-link-832 tag-link-position-48" style="font-size: 14px;">Amoled</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e8%af%ba%e5%9f%ba%e4%ba%9a/" class="tag-cloud-link tag-link-85 tag-link-position-49" style="font-size: 14px;">诺基亚</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e7%be%8e%e9%a3%9f/" class="tag-cloud-link tag-link-108 tag-link-position-50" style="font-size: 14px;">美食</a></li>
	<li><a href="https://m.bcoderss.com/tag/pixiv/" class="tag-cloud-link tag-link-996 tag-link-position-51" style="font-size: 14px;">pixiv</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e4%b8%89%e6%98%9fs10/" class="tag-cloud-link tag-link-298 tag-link-position-52" style="font-size: 14px;">三星s10</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e3%80%82/" class="tag-cloud-link tag-link-367 tag-link-position-53" style="font-size: 14px;">。</a></li>
	<li><a href="https://m.bcoderss.com/tag/htc/" class="tag-cloud-link tag-link-169 tag-link-position-54" style="font-size: 14px;">htc</a></li>
	<li><a href="https://m.bcoderss.com/tag/rog/" class="tag-cloud-link tag-link-364 tag-link-position-55" style="font-size: 14px;">ROG</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e5%bb%ba%e7%ad%91/" class="tag-cloud-link tag-link-47 tag-link-position-56" style="font-size: 14px;">建筑</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e9%bb%91%e9%b2%a8/" class="tag-cloud-link tag-link-93 tag-link-position-57" style="font-size: 14px;">黑鲨</a></li>
	<li><a href="https://m.bcoderss.com/tag/iqoo/" class="tag-cloud-link tag-link-414 tag-link-position-58" style="font-size: 14px;">iQOO</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e5%b4%a9%e5%9d%8f3/" class="tag-cloud-link tag-link-371 tag-link-position-59" style="font-size: 14px;">崩坏3</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e5%8a%aa%e6%af%94%e4%ba%9a/" class="tag-cloud-link tag-link-141 tag-link-position-60" style="font-size: 14px;">努比亚</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e7%8c%ab/" class="tag-cloud-link tag-link-27 tag-link-position-61" style="font-size: 14px;">猫</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e7%b4%a2%e5%b0%bc/" class="tag-cloud-link tag-link-111 tag-link-position-62" style="font-size: 14px;">索尼</a></li>
	<li><a href="https://m.bcoderss.com/tag/lol/" class="tag-cloud-link tag-link-534 tag-link-position-63" style="font-size: 14px;">LOL</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e9%bb%91%e7%99%bd/" class="tag-cloud-link tag-link-189 tag-link-position-64" style="font-size: 14px;">黑白</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e5%ae%a0%e7%89%a9/" class="tag-cloud-link tag-link-98 tag-link-position-65" style="font-size: 14px;">宠物</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e5%ae%89%e5%8d%93/" class="tag-cloud-link tag-link-113 tag-link-position-66" style="font-size: 14px;">安卓</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e6%80%a7%e6%84%9f/" class="tag-cloud-link tag-link-356 tag-link-position-67" style="font-size: 14px;">性感</a></li>
	<li><a href="https://m.bcoderss.com/tag/ipad/" class="tag-cloud-link tag-link-244 tag-link-position-68" style="font-size: 14px;">ipad</a></li>
	<li><a href="https://m.bcoderss.com/tag/iphonexs-max/" class="tag-cloud-link tag-link-485 tag-link-position-69" style="font-size: 14px;">iphoneXS MAX</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e7%8b%97/" class="tag-cloud-link tag-link-31 tag-link-position-70" style="font-size: 14px;">狗</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e8%8b%b1%e9%9b%84%e8%81%94%e7%9b%9f/" class="tag-cloud-link tag-link-420 tag-link-position-71" style="font-size: 14px;">英雄联盟</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e6%9b%b2%e9%9d%a2%e5%b1%8f/" class="tag-cloud-link tag-link-24 tag-link-position-72" style="font-size: 14px;">曲面屏</a></li>
	<li><a href="https://m.bcoderss.com/tag/realme/" class="tag-cloud-link tag-link-413 tag-link-position-73" style="font-size: 14px;">realme</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e5%8f%af%e7%88%b1/" class="tag-cloud-link tag-link-345 tag-link-position-74" style="font-size: 14px;">可爱</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e6%a4%8d%e7%89%a9/" class="tag-cloud-link tag-link-82 tag-link-position-75" style="font-size: 14px;">植物</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e9%94%a4%e5%ad%90%e6%89%8b%e6%9c%ba/" class="tag-cloud-link tag-link-73 tag-link-position-76" style="font-size: 14px;">锤子手机</a></li>
	<li><a href="https://m.bcoderss.com/tag/macos/" class="tag-cloud-link tag-link-867 tag-link-position-77" style="font-size: 14px;">macos</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e6%b8%90%e5%8f%98/" class="tag-cloud-link tag-link-447 tag-link-position-78" style="font-size: 14px;">渐变</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e4%b8%89%e6%98%9fs8/" class="tag-cloud-link tag-link-146 tag-link-position-79" style="font-size: 14px;">三星s8</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e4%ba%ba%e7%89%a9/" class="tag-cloud-link tag-link-107 tag-link-position-80" style="font-size: 14px;">人物</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e9%9b%b7%e8%9b%87/" class="tag-cloud-link tag-link-246 tag-link-position-81" style="font-size: 14px;">雷蛇</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e6%b1%bd%e8%bd%a6/" class="tag-cloud-link tag-link-13 tag-link-position-82" style="font-size: 14px;">汽车</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e7%ba%a2%e7%b1%b3/" class="tag-cloud-link tag-link-253 tag-link-position-83" style="font-size: 14px;">红米</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e5%94%af%e7%be%8e/" class="tag-cloud-link tag-link-129 tag-link-position-84" style="font-size: 14px;">唯美</a></li>
	<li><a href="https://m.bcoderss.com/tag/iphonexr/" class="tag-cloud-link tag-link-220 tag-link-position-85" style="font-size: 14px;">iphoneXR</a></li>
	<li><a href="https://m.bcoderss.com/tag/6k/" class="tag-cloud-link tag-link-866 tag-link-position-86" style="font-size: 14px;">6K</a></li>
	<li><a href="https://m.bcoderss.com/tag/galaxy/" class="tag-cloud-link tag-link-412 tag-link-position-87" style="font-size: 14px;">Galaxy</a></li>
	<li><a href="https://m.bcoderss.com/tag/nokia/" class="tag-cloud-link tag-link-494 tag-link-position-88" style="font-size: 14px;">Nokia</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e8%bf%90%e5%8a%a8/" class="tag-cloud-link tag-link-57 tag-link-position-89" style="font-size: 14px;">运动</a></li>
	<li><a href="https://m.bcoderss.com/tag/harmonyos/" class="tag-cloud-link tag-link-1043 tag-link-position-90" style="font-size: 14px;">HarmonyOS</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e5%a5%b3%e7%94%9f/" class="tag-cloud-link tag-link-178 tag-link-position-91" style="font-size: 14px;">女生</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e9%b8%bf%e8%92%99/" class="tag-cloud-link tag-link-1042 tag-link-position-92" style="font-size: 14px;">鸿蒙</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e5%b0%8f%e7%b1%b311/" class="tag-cloud-link tag-link-885 tag-link-position-93" style="font-size: 14px;">小米11</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e4%b8%89%e6%98%9fnote9/" class="tag-cloud-link tag-link-147 tag-link-position-94" style="font-size: 14px;">三星note9</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e4%b8%89%e6%98%9fs9/" class="tag-cloud-link tag-link-81 tag-link-position-95" style="font-size: 14px;">三星s9</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e4%b8%aa%e6%80%a7/" class="tag-cloud-link tag-link-259 tag-link-position-96" style="font-size: 14px;">个性</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e5%a4%a9%e7%a9%ba/" class="tag-cloud-link tag-link-196 tag-link-position-97" style="font-size: 14px;">天空</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e6%8f%92%e7%94%bb/" class="tag-cloud-link tag-link-402 tag-link-position-98" style="font-size: 14px;">插画</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e5%ae%87%e5%ae%99/" class="tag-cloud-link tag-link-275 tag-link-position-99" style="font-size: 14px;">宇宙</a></li>
	<li><a href="https://m.bcoderss.com/tag/%e7%a7%91%e6%8a%80/" class="tag-cloud-link tag-link-54 tag-link-position-100" style="font-size: 14px;">科技</a></li>
</ul>
</div>

			 <script>
			 	$(function(){
			 		$.post('https://m.bcoderss.com/wp-admin/admin-ajax.php',{action:'is_vip'},function(data){
			 			console.log(data+'======');
			 			if(data == 1){
			 				$(".user img").after('<img class="vip_logo" src="https://m.bcoderss.com/wp-content/themes/new_wallpaper/img/vip.png">');
			 			}
			 		});
			 	})


			 </script>
			




	<div id="" class="date-cover" style="display: none;">
		<select name="year" id="year"></select>
		<select name="month" id="month"></select>
		<a class="dateS" href="javascript:;">确定</a>

		<a class="closeS" href="javascript:;"><i class="fa fa-times" aria-hidden="true"></i></a>

	</div>


	


	<style>

	.date_text {
    font-size: 20px;
    margin-left: 10px;
    margin-top: 60px;
    margin-bottom: -44px;
}


.closeS {
    position: absolute;
    margin-top: 0px !important;
    right: 7px;
    top: 6px;
    padding: 15px;
}

.closeS i{
	 margin-top: 0px !important;
}

	.date-cover *{
		margin-top:50px;
	}
		.date-cover{
			position: fixed;
	
    height: 150px;
    width: 100%;
    background: white;
    bottom: 0px;
    text-align: center;
    z-index: 999;
	background-color: hsla(0,0%,89.8%,.8);
    background: hsla(0,0%,100%,.3);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);

		}

		.dateS{
			    display: inline-block;
    height: 32px;
    padding: 0 11px;
    font-size: 14px;
    line-height: 29px;
    background-color: #3cb46e;
    color: white;
    border: 1px solid transparent;
    border-radius: 4px;
    box-shadow: 0 1px 1px rgb(0 0 0 / 4%);
    transition: all .2s ease-in-out;
    text-align: center;
		}




	</style>

	<script>
		$(function(){
			var date  = new Date();

			var nowY = date.getFullYear();
			var nowM = date.getMonth()+1;

			console.log(nowM);
		

			for(var i=Number(nowY);i >= 2018; i--){
					
				$("#year").append('<option value="'+i+'">'+i+'年</option>');
			}


			for(var j=1;j<= 12;j++){
					
				$("#month").append('<option value="'+j+'">'+j+'月</option>');
			}


			$(".date").click(function(event) {
				$(".date-cover").fadeToggle();
			});

			$(".closeS").click(function(event) {
				$(".date-cover").fadeOut();
			});

			$(".dateS").click(function(event) {
				window.location.href="https://m.bcoderss.com/"+$("#year").val()+'/'+$("#month").val();
			});
		})

	</script>








<div class="home-content">
<ul class="wallpaper" id="main" role="main">

           
	   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/10/13/%e9%9b%aa%e4%b9%8b%e4%b8%8b%e9%9b%aa%e4%b9%834k%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b8/" alt="雪之下雪乃4k手机壁纸" title="雪之下雪乃4k手机壁纸">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/10/雪之下雪乃4k手机壁纸-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="雪之下雪乃4k手机壁纸" title="雪之下雪乃4k手机壁纸" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/10/13/109784/" alt="超市黑色长发女孩百褶裙乐福鞋4k手机壁纸" title="超市黑色长发女孩百褶裙乐福鞋4k手机壁纸">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/10/超市黑色长发女孩百褶裙乐福鞋4k手机壁纸-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="超市黑色长发女孩百褶裙乐福鞋4k手机壁纸" title="超市黑色长发女孩百褶裙乐福鞋4k手机壁纸" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/09/03/%e5%8a%a8%e6%bc%ab%e6%b5%b7%e8%b4%bc%e7%8e%8b/" alt="动漫海贼王" title="动漫海贼王">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/09/1_1630636350-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="动漫海贼王" title="动漫海贼王" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/09/03/%e9%99%88%e7%91%b6-%e7%be%8e%e5%a5%b3-%e5%90%88%e5%8d%81-%e8%99%94%e8%af%9a-4k%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b82160x3840/" alt="陈瑶 美女 合十 虔诚 4k手机壁纸2160×3840" title="陈瑶 美女 合十 虔诚 4k手机壁纸2160×3840">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/09/1_1630636152-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="陈瑶 美女 合十 虔诚 4k手机壁纸2160x3840" title="陈瑶 美女 合十 虔诚 4k手机壁纸2160x3840" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/08/29/touhou-4k%e5%8a%a8%e6%bc%ab%e5%a3%81%e7%ba%b8/" alt="Touhou 4K动漫壁纸" title="Touhou 4K动漫壁纸">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/08/915703-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="Touhou 4K动漫壁纸" title="Touhou 4K动漫壁纸" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/08/29/violet-evergarden%e7%b4%ab%e7%bd%97%e5%85%b0%e6%b0%b8%e6%81%92%e8%8a%b1%e5%9b%ad4k%e5%8a%a8%e6%bc%ab%e5%a3%81%e7%ba%b8/" alt="violet evergarden(紫罗兰永恒花园)4K动漫壁纸" title="violet evergarden(紫罗兰永恒花园)4K动漫壁纸">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/08/918697-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="violet evergarden(紫罗兰永恒花园)4K动漫壁纸" title="violet evergarden(紫罗兰永恒花园)4K动漫壁纸" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/08/29/%e8%9c%98%e8%9b%9b%e4%be%a03-4k%ef%bc%883840x1440%ef%bc%89%e5%a3%81%e7%ba%b8%e4%b8%8b%e8%bd%bd/" alt="蜘蛛侠3 4K(3840×1440)壁纸下载" title="蜘蛛侠3 4K(3840×1440)壁纸下载">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/08/923018-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="蜘蛛侠3 4K(3840x1440)壁纸下载" title="蜘蛛侠3 4K(3840x1440)壁纸下载" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/08/29/%e8%9c%98%e8%9b%9b%e4%be%a03-4k%e5%a3%81%e7%ba%b8%e4%b8%8b%e8%bd%bd/" alt="蜘蛛侠3 4K壁纸下载" title="蜘蛛侠3 4K壁纸下载">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/08/923068-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="蜘蛛侠3 4K壁纸下载" title="蜘蛛侠3 4K壁纸下载" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/08/29/%e8%9c%98%e8%9b%9b%e4%be%a03%e7%94%b5%e5%bd%b14k%e5%a3%81%e7%ba%b8%e4%b8%8b%e8%bd%bd/" alt="蜘蛛侠3电影4K壁纸下载" title="蜘蛛侠3电影4K壁纸下载">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/08/923235-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="蜘蛛侠3电影4K壁纸下载" title="蜘蛛侠3电影4K壁纸下载" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/08/29/%e3%80%8a%e7%8c%8e%e9%b9%b0%e4%b8%8e%e5%86%ac%e5%85%b5%e3%80%8bthe-falcon-and-the-winter-soldier%e7%94%b5%e5%bd%b1%e5%a3%81%e7%ba%b8%e5%9b%be%e7%89%87/" alt="《猎鹰与冬兵》,The Falcon and the Winter Soldier电影壁纸图片" title="《猎鹰与冬兵》,The Falcon and the Winter Soldier电影壁纸图片">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/08/923352-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="《猎鹰与冬兵》,The Falcon and the Winter Soldier电影壁纸图片" title="《猎鹰与冬兵》,The Falcon and the Winter Soldier电影壁纸图片" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/08/05/%e5%8e%9f%e7%a5%9e-%e7%94%98%e9%9b%a8-%e9%bb%91%e8%89%b2%e8%a3%a4%e8%a2%9c%e7%be%8e%e8%85%bf-4k%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b82160x3840/" alt="原神 甘雨 黑色裤袜美腿 4k手机壁纸2160×3840" title="原神 甘雨 黑色裤袜美腿 4k手机壁纸2160×3840">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/08/原神-甘雨-黑色裤袜美腿-4k手机壁纸2160x3840-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="原神 甘雨 黑色裤袜美腿 4k手机壁纸2160x3840" title="原神 甘雨 黑色裤袜美腿 4k手机壁纸2160x3840" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/08/03/%e9%9b%aa%e4%b9%8b%e4%b8%8b%e9%9b%aa%e4%b9%832k%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b8/" alt="雪之下雪乃2k手机壁纸" title="雪之下雪乃2k手机壁纸">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/08/雪之下雪乃2k手机壁纸-260x534.png" class="attachment-thumbnail size-thumbnail wp-post-image" alt="雪之下雪乃2k手机壁纸" title="雪之下雪乃2k手机壁纸" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/07/26/%e5%b0%8f%e5%a5%b3%e5%84%bf%e6%9c%88%e7%89%99%e5%84%bf%e5%92%8c%e5%a5%b9%e7%9a%84%e7%97%9b%e8%bd%a6%e9%ac%bc%e5%88%804k%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b8/" alt="小女儿月牙儿,和她的痛车,鬼刀4k手机壁纸" title="小女儿月牙儿,和她的痛车,鬼刀4k手机壁纸">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/07/小女儿月牙儿和她的痛车鬼刀4k手机壁纸-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="小女儿月牙儿,和她的痛车,鬼刀4k手机壁纸" title="小女儿月牙儿,和她的痛车,鬼刀4k手机壁纸" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/06/22/%e9%9b%86%e5%8e%9f%e7%be%8e-sky-train-%e8%a1%8c%e6%9d%8e%e7%ae%b1-%e5%8c%85%e5%8c%85-4k%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b8%e7%ab%96%e7%89%882160x3840/" alt="集原美 Sky train 行李箱 包包 4k手机壁纸竖版2160×3840" title="集原美 Sky train 行李箱 包包 4k手机壁纸竖版2160×3840">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/06/集原美-Sky-train-行李箱-包包-4k手机壁纸竖版2160x3840-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="集原美 Sky train 行李箱 包包 4k手机壁纸竖版2160x3840" title="集原美 Sky train 行李箱 包包 4k手机壁纸竖版2160x3840" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/06/18/%e6%9d%8e%e6%b2%81%e6%a8%b1%e8%8a%b1%e5%85%ac%e4%b8%bb%e8%a3%994k%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b8%e7%ab%96%e5%b1%8f%e9%ab%98%e6%b8%85/" alt="李沁樱花公主裙4k手机壁纸竖屏高清" title="李沁樱花公主裙4k手机壁纸竖屏高清">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/06/李沁樱花公主裙4k手机壁纸竖屏高清-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="李沁樱花公主裙4k手机壁纸竖屏高清" title="李沁樱花公主裙4k手机壁纸竖屏高清" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/06/15/%e9%9b%86%e5%8e%9f%e7%be%8e4k%e7%ab%96%e5%b1%8f%e5%a3%81%e7%ba%b8%e6%97%a0%e6%b0%b4%e5%8d%b02160x3840/" alt="集原美4k竖屏壁纸无水印2160×3840" title="集原美4k竖屏壁纸无水印2160×3840">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/06/集原美4k竖屏壁纸无水印2160x3840-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="集原美4k竖屏壁纸无水印2160x3840" title="集原美4k竖屏壁纸无水印2160x3840" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/06/10/%e8%bf%87%e6%9c%9f%e7%b1%b3%e7%ba%bf%e7%ba%bf%e5%96%b54k%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b8/" alt="过期米线线喵4k手机壁纸" title="过期米线线喵4k手机壁纸">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/06/过期米线线喵4k手机壁纸-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="过期米线线喵4k手机壁纸" title="过期米线线喵4k手机壁纸" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/06/03/%e9%87%91%e8%89%b2%e9%95%bf%e5%8f%91%e5%a5%b3%e5%ad%a9-%e8%a3%99%e5%ad%90-%e8%bf%9e%e8%a1%a3%e8%a3%99-%e7%be%8e%e8%85%bf-%e5%ba%a7%e6%a4%85-%e5%85%a8%e9%9d%a2%e5%b1%8f%e6%89%8b%e6%9c%ba%e5%a3%81/" alt="金色长发女孩 裙子 连衣裙 美腿 座椅 全面屏手机壁纸" title="金色长发女孩 裙子 连衣裙 美腿 座椅 全面屏手机壁纸">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/06/金色长发女孩-裙子-连衣裙-美腿-座椅-全面屏手机壁纸-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="金色长发女孩 裙子 连衣裙 美腿 座椅 全面屏手机壁纸" title="金色长发女孩 裙子 连衣裙 美腿 座椅 全面屏手机壁纸" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/06/03/eva%e6%96%b0%e4%b8%96%e7%ba%aa%e7%a6%8f%e9%9f%b3%e6%88%98%e5%a3%ab%e7%bb%ab%e6%b3%a2%e4%b8%bd4k%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b8/" alt="EVA新世纪福音战士绫波丽4k手机壁纸" title="EVA新世纪福音战士绫波丽4k手机壁纸">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/06/EVA新世纪福音战士绫波丽4k手机壁纸-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="EVA新世纪福音战士绫波丽4k手机壁纸" title="EVA新世纪福音战士绫波丽4k手机壁纸" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/06/02/%e5%94%af%e7%be%8e4k%e5%b1%b1%e6%b0%b4%e9%a3%8e%e6%99%af%e5%a3%81%e7%ba%b8%e5%9b%be%e7%89%87/" alt="唯美4K山水风景壁纸图片" title="唯美4K山水风景壁纸图片">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/06/1_1622637120-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="唯美4K山水风景壁纸图片" title="唯美4K山水风景壁纸图片" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/06/02/4k-%e9%bb%91%e8%89%b2%e8%83%8c%e6%99%af-%e5%8a%a8%e6%bc%ab%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b8/" alt="4K 黑色背景 动漫手机壁纸" title="4K 黑色背景 动漫手机壁纸">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/06/1_1622637012-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="4K 黑色背景 动漫手机壁纸" title="4K 黑色背景 动漫手机壁纸" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/06/02/4k-%e7%8b%ae%e5%ad%90%e5%a3%81%e7%ba%b8/" alt="4K 狮子壁纸" title="4K 狮子壁纸">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/06/1_1622636976-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="4K 狮子壁纸" title="4K 狮子壁纸" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/05/03/%e6%96%b0%e4%b8%96%e7%ba%aa%e7%a6%8f%e9%9f%b3%e6%88%98%e5%a3%ab-%e7%bb%ab%e6%b3%a2%e4%b8%bd-4k%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b8%e7%ab%96%e5%b1%8f/" alt="新世纪福音战士 绫波丽 4k手机壁纸竖屏" title="新世纪福音战士 绫波丽 4k手机壁纸竖屏">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/05/新世纪福音战士-绫波丽-4k手机壁纸竖屏-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="新世纪福音战士 绫波丽 4k手机壁纸竖屏" title="新世纪福音战士 绫波丽 4k手机壁纸竖屏" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/04/26/4k-%e8%9c%98%e8%9b%9b%e4%be%a0-%e5%8a%a8%e6%bc%ab/" alt="4K 蜘蛛侠 动漫" title="4K 蜘蛛侠 动漫">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/04/IMG_0766-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="4K 蜘蛛侠 动漫" title="4K 蜘蛛侠 动漫" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/04/22/3840x2160-4k%e5%b0%8f%e4%b8%91%e5%a3%81%e7%ba%b8%e5%9b%be%e7%89%87/" alt="3840×2160 4K小丑壁纸图片" title="3840×2160 4K小丑壁纸图片">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/04/JOKER-with-Mjölnir_1582523291456-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="3840x2160 4K小丑壁纸图片" title="3840x2160 4K小丑壁纸图片" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/03/21/%e8%93%9d%e8%89%b2%e7%9c%bc%e7%9d%9b%e5%a5%b3%e5%ad%90%e5%b0%be%e5%b7%b4%e5%a5%b3%e5%ad%a9%e5%ad%90%e7%8c%ab%e8%80%b3%e7%8c%ab%e5%8f%af%e7%88%b1%e4%ba%8c%e6%ac%a1%e5%85%83%e5%8a%a8%e6%bc%ab4k/" alt="蓝色眼睛女子+尾巴+女孩子+猫耳+猫+可爱二次元动漫4k壁纸" title="蓝色眼睛女子+尾巴+女孩子+猫耳+猫+可爱二次元动漫4k壁纸">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/03/56859_1616210667-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="蓝色眼睛女子+尾巴+女孩子+猫耳+猫+可爱二次元动漫4k壁纸" title="蓝色眼睛女子+尾巴+女孩子+猫耳+猫+可爱二次元动漫4k壁纸" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/03/03/%e5%88%98%e6%b5%a9%e5%ad%984k%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b8%e7%ab%96%e5%b1%8f/" alt="刘浩存4k手机壁纸竖屏" title="刘浩存4k手机壁纸竖屏">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/03/刘浩存4k手机壁纸竖屏-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="刘浩存4k手机壁纸竖屏" title="刘浩存4k手机壁纸竖屏" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2021/02/22/%e6%80%a7%e6%84%9f%e7%be%8e%e5%a5%b3-4k%e8%b6%85%e6%b8%85%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b8/" alt="性感美女 4k超清手机壁纸" title="性感美女 4k超清手机壁纸">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2021/02/54821_1613781418-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="性感美女 4k超清手机壁纸" title="性感美女 4k超清手机壁纸" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2020/11/23/%e4%b8%80%e5%8a%a0oneplus-nord-n100%e6%89%8b%e6%9c%ba%e7%b3%bb%e7%bb%9f%e5%a3%81%e7%ba%b84k/" alt="一加OnePlus Nord N100手机系统壁纸4K" title="一加OnePlus Nord N100手机系统壁纸4K">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2020/11/OnePlus-Nord-N100-Wallpaper-1-YTECHB-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="一加OnePlus Nord N100手机系统壁纸4K" title="一加OnePlus Nord N100手机系统壁纸4K" /> 		
 	</a></li>
   
 		<li><a target="_blank" href="https://m.bcoderss.com/2020/11/23/%e7%94%b5%e8%84%91macos-big-sur-11-0-1%e7%b3%bb%e7%bb%9f%e5%86%85%e7%bd%ae4k%e8%b6%85%e6%b8%85%e5%a3%81%e7%ba%b8%ef%bc%8821%ef%bc%89/" alt="[电脑]macos big sur 11.0.1系统内置4K超清壁纸(21)" title="[电脑]macos big sur 11.0.1系统内置4K超清壁纸(21)">

 <img width="260" height="534" src="https://m.bcoderss.com/wp-content/uploads/2020/11/macOS-Big-Sur-Wallpaper-3-YTECHB-260x534.jpg" class="attachment-thumbnail size-thumbnail wp-post-image" alt="[电脑]macos big sur 11.0.1系统内置4K超清壁纸(21)" title="[电脑]macos big sur 11.0.1系统内置4K超清壁纸(21)" /> 		
 	</a></li>   
</ul>

<div id="nextPage"><a href="https://m.bcoderss.com/tag/4k/page/2/" >加载更多 </a></div>

</div>


<!--加载中-->
<!-- <div class="spinner"></div><br><br> -->
<!--加载中-->

<div class="gotop"></div>



<a href="#0" class="cd-top">Top</a>

<footer>
   

	<p> Copyright (C)m.bcoderss.com, All Rights Reserved. | 网站基于wordpress,购买本站同款网站模板<a href="https://wpcoder.cn/2021/07/26/wordpress%e5%a3%81%e7%ba%b8%e4%b8%bb%e9%a2%98%e6%a8%a1%e6%9d%bf/">wpcoder</a> . <a href="https://m.bcoderss.com/search/">大家都在搜</a></p>

     <script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? "https://" : "http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_1278590218'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "v1.cnzz.com/stat.php%3Fid%3D1278590218%26online%3D1%26show%3Dline' type='text/javascript'%3E%3C/script%3E"));</script>
</footer>
  
</body>
</html>

如何批量获取4K壁纸详情页的链接

python编写过程

在代码最上方引入正则表达式模块

import re

我们可以在刚才的相应内容中,找到<li>标签中的图片详情页链接

图片[2]-【python学习】零基础编写批量下载4K壁纸爬虫脚本-FancyPig's blog

图中的具体代码如下

<li><a target="_blank" href="https://m.bcoderss.com/2021/09/03/%e9%99%88%e7%91%b6-%e7%be%8e%e5%a5%b3-%e5%90%88%e5%8d%81-%e8%99%94%e8%af%9a-4k%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b82160x3840/" alt="陈瑶 美女 合十 虔诚 4k手机壁纸2160×3840" title="陈瑶 美女 合十 虔诚 4k手机壁纸2160×3840">

然后我们进行正则匹配,并输出为列表

href = re.findall('<li><a target="_blank" href="(.*?)"',response.text)[1:]
print(href)

完整代码

下面的代码已经完成了,整个4K图片的链接获取

import requests
import re

url='https://m.bcoderss.com/tag/4k/'
headers={
    'user-agent':'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1'
}
response = requests.post(url=url, headers=headers)
href = re.findall('<li><a target="_blank" href="(.*?)"',response.text)[1:]
print(href)

输出结果

['https://m.bcoderss.com/2021/10/13/%e9%9b%aa%e4%b9%8b%e4%b8%8b%e9%9b%aa%e4%b9%834k%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b8/', 'https://m.bcoderss.com/2021/10/13/109784/', 'https://m.bcoderss.com/2021/09/03/%e5%8a%a8%e6%bc%ab%e6%b5%b7%e8%b4%bc%e7%8e%8b/', 'https://m.bcoderss.com/2021/09/03/%e9%99%88%e7%91%b6-%e7%be%8e%e5%a5%b3-%e5%90%88%e5%8d%81-%e8%99%94%e8%af%9a-4k%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b82160x3840/', 'https://m.bcoderss.com/2021/08/29/touhou-4k%e5%8a%a8%e6%bc%ab%e5%a3%81%e7%ba%b8/', 'https://m.bcoderss.com/2021/08/29/violet-evergarden%e7%b4%ab%e7%bd%97%e5%85%b0%e6%b0%b8%e6%81%92%e8%8a%b1%e5%9b%ad4k%e5%8a%a8%e6%bc%ab%e5%a3%81%e7%ba%b8/', 'https://m.bcoderss.com/2021/08/29/%e8%9c%98%e8%9b%9b%e4%be%a03-4k%ef%bc%883840x1440%ef%bc%89%e5%a3%81%e7%ba%b8%e4%b8%8b%e8%bd%bd/', 'https://m.bcoderss.com/2021/08/29/%e8%9c%98%e8%9b%9b%e4%be%a03-4k%e5%a3%81%e7%ba%b8%e4%b8%8b%e8%bd%bd/', 'https://m.bcoderss.com/2021/08/29/%e8%9c%98%e8%9b%9b%e4%be%a03%e7%94%b5%e5%bd%b14k%e5%a3%81%e7%ba%b8%e4%b8%8b%e8%bd%bd/', 'https://m.bcoderss.com/2021/08/29/%e3%80%8a%e7%8c%8e%e9%b9%b0%e4%b8%8e%e5%86%ac%e5%85%b5%e3%80%8bthe-falcon-and-the-winter-soldier%e7%94%b5%e5%bd%b1%e5%a3%81%e7%ba%b8%e5%9b%be%e7%89%87/', 'https://m.bcoderss.com/2021/08/05/%e5%8e%9f%e7%a5%9e-%e7%94%98%e9%9b%a8-%e9%bb%91%e8%89%b2%e8%a3%a4%e8%a2%9c%e7%be%8e%e8%85%bf-4k%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b82160x3840/', 'https://m.bcoderss.com/2021/08/03/%e9%9b%aa%e4%b9%8b%e4%b8%8b%e9%9b%aa%e4%b9%832k%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b8/', 'https://m.bcoderss.com/2021/07/26/%e5%b0%8f%e5%a5%b3%e5%84%bf%e6%9c%88%e7%89%99%e5%84%bf%e5%92%8c%e5%a5%b9%e7%9a%84%e7%97%9b%e8%bd%a6%e9%ac%bc%e5%88%804k%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b8/', 'https://m.bcoderss.com/2021/06/22/%e9%9b%86%e5%8e%9f%e7%be%8e-sky-train-%e8%a1%8c%e6%9d%8e%e7%ae%b1-%e5%8c%85%e5%8c%85-4k%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b8%e7%ab%96%e7%89%882160x3840/', 'https://m.bcoderss.com/2021/06/18/%e6%9d%8e%e6%b2%81%e6%a8%b1%e8%8a%b1%e5%85%ac%e4%b8%bb%e8%a3%994k%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b8%e7%ab%96%e5%b1%8f%e9%ab%98%e6%b8%85/', 'https://m.bcoderss.com/2021/06/15/%e9%9b%86%e5%8e%9f%e7%be%8e4k%e7%ab%96%e5%b1%8f%e5%a3%81%e7%ba%b8%e6%97%a0%e6%b0%b4%e5%8d%b02160x3840/', 'https://m.bcoderss.com/2021/06/10/%e8%bf%87%e6%9c%9f%e7%b1%b3%e7%ba%bf%e7%ba%bf%e5%96%b54k%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b8/', 'https://m.bcoderss.com/2021/06/03/%e9%87%91%e8%89%b2%e9%95%bf%e5%8f%91%e5%a5%b3%e5%ad%a9-%e8%a3%99%e5%ad%90-%e8%bf%9e%e8%a1%a3%e8%a3%99-%e7%be%8e%e8%85%bf-%e5%ba%a7%e6%a4%85-%e5%85%a8%e9%9d%a2%e5%b1%8f%e6%89%8b%e6%9c%ba%e5%a3%81/', 'https://m.bcoderss.com/2021/06/03/eva%e6%96%b0%e4%b8%96%e7%ba%aa%e7%a6%8f%e9%9f%b3%e6%88%98%e5%a3%ab%e7%bb%ab%e6%b3%a2%e4%b8%bd4k%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b8/', 'https://m.bcoderss.com/2021/06/02/%e5%94%af%e7%be%8e4k%e5%b1%b1%e6%b0%b4%e9%a3%8e%e6%99%af%e5%a3%81%e7%ba%b8%e5%9b%be%e7%89%87/', 'https://m.bcoderss.com/2021/06/02/4k-%e9%bb%91%e8%89%b2%e8%83%8c%e6%99%af-%e5%8a%a8%e6%bc%ab%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b8/', 'https://m.bcoderss.com/2021/06/02/4k-%e7%8b%ae%e5%ad%90%e5%a3%81%e7%ba%b8/', 'https://m.bcoderss.com/2021/05/03/%e6%96%b0%e4%b8%96%e7%ba%aa%e7%a6%8f%e9%9f%b3%e6%88%98%e5%a3%ab-%e7%bb%ab%e6%b3%a2%e4%b8%bd-4k%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b8%e7%ab%96%e5%b1%8f/', 'https://m.bcoderss.com/2021/04/26/4k-%e8%9c%98%e8%9b%9b%e4%be%a0-%e5%8a%a8%e6%bc%ab/', 'https://m.bcoderss.com/2021/04/22/3840x2160-4k%e5%b0%8f%e4%b8%91%e5%a3%81%e7%ba%b8%e5%9b%be%e7%89%87/', 'https://m.bcoderss.com/2021/03/21/%e8%93%9d%e8%89%b2%e7%9c%bc%e7%9d%9b%e5%a5%b3%e5%ad%90%e5%b0%be%e5%b7%b4%e5%a5%b3%e5%ad%a9%e5%ad%90%e7%8c%ab%e8%80%b3%e7%8c%ab%e5%8f%af%e7%88%b1%e4%ba%8c%e6%ac%a1%e5%85%83%e5%8a%a8%e6%bc%ab4k/', 'https://m.bcoderss.com/2021/03/03/%e5%88%98%e6%b5%a9%e5%ad%984k%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b8%e7%ab%96%e5%b1%8f/', 'https://m.bcoderss.com/2021/02/22/%e6%80%a7%e6%84%9f%e7%be%8e%e5%a5%b3-4k%e8%b6%85%e6%b8%85%e6%89%8b%e6%9c%ba%e5%a3%81%e7%ba%b8/', 'https://m.bcoderss.com/2020/11/23/%e4%b8%80%e5%8a%a0oneplus-nord-n100%e6%89%8b%e6%9c%ba%e7%b3%bb%e7%bb%9f%e5%a3%81%e7%ba%b84k/', 'https://m.bcoderss.com/2020/11/23/%e7%94%b5%e8%84%91macos-big-sur-11-0-1%e7%b3%bb%e7%bb%9f%e5%86%85%e7%bd%ae4k%e8%b6%85%e6%b8%85%e5%a3%81%e7%ba%b8%ef%bc%8821%ef%bc%89/']

随便打开一个链接,访问一下,可以看到已经在壁纸的详情页了

图片[3]-【python学习】零基础编写批量下载4K壁纸爬虫脚本-FancyPig's blog

如何获取标题和图片地址

编写代码

仿照上面的格式,我们观察到标题是在<title>标签里存储的,图片是在<img>标签里存储的,但由于我们要处理的链接可能有多个,这里需要用到for in循环的方式来遍历列表

完整代码

import requests
import re

url='https://m.bcoderss.com/tag/4k/'
headers={
    'user-agent':'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1'
}
response = requests.post(url=url, headers=headers)
href = re.findall('<li><a target="_blank" href="(.*?)"',response.text)[1:]
for index in href:
    response_1 = requests.get(url=index, headers=headers)
    title = re.findall('<title>(.*?)</title>',response_1.text)
    img_url = re.findall('<img alt="(.*?)" title="(.*?)" src="(.*?)"',response_1.text)
print(href)
print(title)
print(img_url)

运行结果

https://m.bcoderss.com/2020/11/23/%e7%94%b5%e8%84%91macos-big-sur-11-0-1%e7%b3%bb%e7%bb%9f%e5%86%85%e7%bd%ae4k%e8%b6%85%e6%b8%85%e5%a3%81%e7%ba%b8%ef%bc%8821%ef%bc%89/
['[电脑]macos big sur 11.0.1系统内置4K超清壁纸(21) - 全面屏手机壁纸']
['https://img1.bcoderss.com/wp-content/uploads/2020/11/macOS-Big-Sur-Wallpaper-3-YTECHB-900x900.jpg']

使用文件操作模块完成下载

在文件最上方引入os模块

import os

然后设置好,我们下载图片要保存的路径

如果没有这个路径,则需要创建img路径

filename = 'img\\'

if not os_path.exsists(filename):
    os.mkdir(filename)

然后我们需要打开文件并保存

    with open(filename + title +'.jpg', mode ='wb') as f
        f.write(img_content)

完整代码

import requests
import re
import os
filename = 'img\\'

if not os.path.exists(filename):
    os.mkdir(filename)
url = 'https://m.bcoderss.com/tag/4k/page/3/'
headers={
    'user-agent':'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1'
}
response = requests.post(url=url, headers=headers)
href = re.findall('<li><a target="_blank" href="(.*?)"',response.text)[1:]
for index in href:
    response_1 = requests.get(url=index, headers=headers)
    title = re.findall('<title>(.*?)</title>',response_1.text)[0]
    img_url = re.findall('<img alt=".*?" title.*?" src="(.*?)"',response_1.text)[0]
    img_content = requests.get(url=img_url,headers=headers).content
    with open(filename + title +'.jpg', mode ='wb') as f:
        f.write(img_content)
print(title)
print(img_url)

然后,我们测试下效果,可以完成封面的下载

图片[4]-【python学习】零基础编写批量下载4K壁纸爬虫脚本-FancyPig's blog

最终代码

相关说明

为了防止采集到的图片中有特殊字符导致文件不能保存,我们还增加了过滤替换的功能。

def changer_title(name):
    new_name = re.sub(r'[\/\\:\*\?\<\>\|]','_',name)
    return new_name

爬虫爬取的分类链接页数相关参数,我们也增加了设置,这里默认是第1页到第11页

for page in range(1,11):
    url = f'https://m.bcoderss.com/bing/page/{page}/'

完整版

import requests
import re
import os
filename = 'img\\'

if not os.path.exists(filename):
    os.mkdir(filename)
def changer_title(name):
    new_name = re.sub(r'[\/\\:\*\?\<\>\|]','_',name)
    return new_name
for page in range(1,11):
    url = f'https://m.bcoderss.com/bing/page/{page}/'
headers={
    'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36'
}
response = requests.post(url=url, headers=headers)
href = re.findall('<li><a target="_blank" href="(.*?)"',response.text)[1:]
for index in href:
    response_1 = requests.get(url=index, headers=headers)
    title = re.findall('<title>(.*?)</title>',response_1.text)[0]
    title = changer_title(title)
    img_url = re.findall('<img title=".*?" src="(.*?)"',response_1.text)[0]
    img_content = requests.get(url=img_url,headers=headers).content
    with open(filename + title +'.jpg', mode ='wb') as f:
        f.write(img_content)
print(title)
print(img_url)
图片[5]-【python学习】零基础编写批量下载4K壁纸爬虫脚本-FancyPig's blog

© 版权声明
THE END
喜欢就支持一下吧
点赞33
分享
评论 共3条

请登录后发表评论