- python脚本批量下载apk文件(应用宝和360市场)
360安卓市场下载 2000个,应用宝2000个 - 代码中的下载路径自行更改
-
运行截图
image.png
- 代码如下
# -*- coding: utf-8 -*-
import re
import urllib
import os
class class_360:
def __init__(self):
self.urllist=[]
self.baseurl='http://zhushou.360.cn/list/index/cid/1?page='
def geturl(self,pageindex):
for i in range(35,pageindex):
self.urllist.append(self.baseurl+str(i))
def spider(self):
for i in range(len(self.urllist)):
response=urllib.urlopen(self.urllist[i])
html=response.read()
link_list=re.findall(r"(?<=&url=).*?apk",html)
for url in link_list:
file_name = url.split('/')[-1]
# print file_name
file_path=os.path.join("/tmp",file_name)
print 'DOWNLOADING : ' + file_path
urllib.urlretrieve(url,file_path)
def start(self):
self.geturl(40)
self.spider()
class class_YYB:
def __init__(self):
self.urllist=[]
self.baseurl='https://android.myapp.com/myapp/category.htm?orgame=1&categoryId='
def geturl(self,pageindex):
for i in range(100,pageindex):
self.urllist.append(self.baseurl+str(i))
def spider(self):
for i in range(len(self.urllist)):
response=urllib.urlopen(self.urllist[i])
html=response.readlines()
link_list = []
for i in range(len(html)):
if 'ex_url' in html[i]:
tmp = html[i].split('ex_url="')[1]
tmp = tmp.split('"')[0]
link_list.append(tmp)
for url in link_list:
file_name = url.split('=')[1]
file_name = file_name.split('&')[0]
# print file_name
file_path=os.path.join("/tmp",file_name)
print 'DOWNLOADING : ' + file_path
urllib.urlretrieve(url,file_path)
def start(self):
self.geturl(122)
self.spider()
if __name__ == '__main__':
# # 360 应用市场
# a=class_360()
# a.start()
# 应用宝
b=class_YYB()
b.start()
网友评论