├── README.md ├── api.py ├── app.py └── templates └── index.html /README.md: -------------------------------------------------------------------------------- 1 | # lanzou 2 | 3 | 4 | ## 用法: 5 | 6 | 把图片的后缀名改成zip再上传到蓝奏云上,获取文件的分享链接如 ,再自己构成链接,这就是图床的链接。 7 | 8 | ## 原理: 9 | 10 | , 其实就是我服务器通过解析分享链接然后重定向下载直链,从而获取资源,你也可以通过这个直接获取其它文件的下载直链,不限于做图床。 11 | 12 | -------------------------------------------------------------------------------- /api.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import bs4 3 | import re 4 | 5 | session = requests.session() 6 | 7 | 8 | def get_zhilian(share_url): 9 | index_url = 'https://www.lanzous.com' 10 | headers = { 11 | 'Upgrade-Insecure-Requests': '1', 12 | "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", 13 | "accept-encoding": "gzip, deflate, br", 14 | "accept-language": "zh-CN,zh;q=0.9", 15 | "cache-control": "max-age=0", 16 | "user-agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3672.400 QQBrowser/10.4.3448.400" 17 | } 18 | share_html_text = session.get(url=share_url, headers=headers).text 19 | share_html_bs4 = bs4.BeautifulSoup(share_html_text, "lxml") 20 | src_url = share_html_bs4.find('iframe', attrs={'class': 'ifr2'})['src'] 21 | downloads_url = index_url + src_url 22 | headers_d = { 23 | "x-requested-with": "XMLHttpRequest", 24 | "Accept-Language": "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2", 25 | "origin": "https://www.lanzous.com", 26 | "referer": downloads_url, 27 | 'Connection': 'keep-alive', 28 | 'Upgrade-Insecure-Requests': '1', 29 | "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", 30 | "accept-encoding": "gzip, deflate, br", 31 | "accept-language": "zh-CN,zh;q=0.9", 32 | "cache-control": "max-age=0", 33 | "user-agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3672.400 QQBrowser/10.4.3448.400" 34 | } 35 | downloads_page = session.get(url=downloads_url, headers=headers).text 36 | try: 37 | sign = re.search('sign.{89}', downloads_page).group()[7:89] 38 | except: 39 | sign = re.search('var ajaxup = \'.{0,100}\';', downloads_page).group()[13:-2] 40 | 41 | ajaxm_url = 'https://www.lanzous.com/ajaxm.php' 42 | 43 | data = { 44 | 'action': 'downprocess', 45 | 'sign': sign, 46 | 'ves': 1 47 | } 48 | file_data = session.post(url=ajaxm_url, data=data, headers=headers_d).json() 49 | zhilian = str(file_data['dom']) + '/file/' + str(file_data['url']) + '=' 50 | return zhilian 51 | 52 | 53 | if __name__ == '__main__': 54 | i = 0 55 | while True: 56 | i = i + 1 57 | print(i) 58 | print(get_zhilian('https://www.lanzous.com/i6aa3hg')) 59 | -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, redirect, url_for, render_template, request, g 2 | from api import get_zhilian 3 | 4 | app = Flask(__name__) 5 | 6 | 7 | 8 | @app.route('/') 9 | def index(): 10 | 11 | return "hello" 12 | 13 | @app.route('/img') 14 | def test(): 15 | try: 16 | url = request.args.get("url") 17 | except: 18 | url='' 19 | return redirect(get_zhilian(url)) 20 | 21 | 22 | if __name__ == '__main__': 23 | app.run() 24 | -------------------------------------------------------------------------------- /templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------------------------------------