例如:插件 https://cn.wordpress.org/plugins/baidu-submit-link/
方法一:
点击高级视图(Advanced View):
然后拉到最下方,有个历史版本,可以下载老旧版本
方法二:
点击开发进展浏览代码:
不是所有插件有提供该界面,可以构造URL(vulsee.com):
https://plugins.trac.wordpress.org/browser/插件名/
或者:
https://plugins.trac.wordpress.org/log/browser/插件名/
点击进去会有项目的所有文件,基本都有历史版本,可以依次下载;
为了方便,写了一个脚本,下载对应Rev编号的插件版本:
#coding:utf-8
'''
__author__=="sonic"
__website__=="http://vulsee.com"
'''
import requests
from bs4 import BeautifulSoup
import ssl
import urllib
import os
import wget
try:
_create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
pass
else:
ssl._create_default_https_context = _create_unverified_https_context
requests.packages.urllib3.disable_warnings()
headers = {
#需要headers
}
def getpages(file):
startUrl = 'https://plugins.trac.wordpress.org/export/'
resUrl = '{}{}/{}/trunk/{}'.format(startUrl,proId,proName,file)
#print resUrl
download(resUrl)
def download(url):
savepath = './{}/{}/'.format(proName,proId)
filepaths = savepath+url.split('trunk')[-1]
fileName = url.split('trunk')[-1].split('/')[-1]
writePathname = os.getcwd() +filepaths
#writePath = writePathname.split('/')[0:-1]
print writePathname,fileName
writePath = writePathname.split(fileName)[0]
if os.path.exists(writePath)==False:
os.makedirs(writePath)
wget.download(url,writePathname)
else:
wget.download(url,writePathname)
def check(path):
url = 'https://plugins.trac.wordpress.org/browser/{}/trunk/{}?rev={}&action=inplace&range_min_secs=63679144160&range_max_secs=63726016168'.format(proName,path,proId)
html = requests.get(url, headers=headers, verify=False).content
#print (html)
soup=BeautifulSoup(html,'lxml')
files = soup.find_all("a",class_='trac-rawlink')
for file in files:
resfile = file.attrs["href"].split('?')[0].split('trunk')[-1]
getpages(resfile)
filepaths = soup.find_all("a",class_='dir')
if len(filepaths)>0:
for filepath in filepaths:
respath = filepath.attrs["href"].split('?')[0].split('trunk')[-1]
check(respath)
def main():
global proId,proName
proName = 'baidu-submit-link'
proId = 2496522
check('/')
if __name__ == '__main__':
main()