蘭雅sRGB 个人笔记 https://262235.xyz
提供编程和电脑应用视频教程,工具和源代码
C, C++, Python Programming, Source Code, Video

旧Hexo博客 | Github | IP定位WebAPI | Docker Hub
编程中文文档 | 网盘分享 | 中文Linux命令

Python 爬虫WebAPI版: 批量网址转Markdown

getmd_Python爬虫.jpg

演示网址: 批量网址转Markdown

分享给别人使用,简单功能和限制数量

111.png

@app.route("/getmd/", methods=['POST', 'GET'])
def getmd(): 
    if request.method == 'POST' and request.form['passkey'] == make_passkey('262235.xyz') : 
        urls = request.form['urls']
        urls_list = check_urls(urls)
        urls = urls_lines(urls_list)
        if len(urls_list) < 5 :
            texts = '测试 PASSKEY 一次只允许最多抓取5篇文章,当前数量:' + str(len(urls_list)) + '\n'
            texts += pull_urls(urls_list)
            return render_template('getmd.html', urls=urls, texts=texts)
        else:
            texts = '文章大于5: 测试 PASSKEY 一次只允许最多抓取5篇文章,当前数量:' + str(len(urls_list)) + '\n'
            return render_template('getmd.html', urls=urls, texts=texts) 
    else:
        if request.method == 'POST' and request.form['passkey'] == 'UUID-1234-5678-1234' : 
            urls = request.form['urls']
            urls_list = check_urls(urls)
            urls = urls_lines(urls_list)
            texts = '授权 PASSKEY 无限制,当前数量:' + str(len(urls_list)) + '\n'
            texts += pull_urls(urls_list)
            return render_template('getmd.html', urls=urls, texts=texts)
        pass
    return render_template('getmd.html', passkey=make_passkey('262235.xyz'))

授权 PASSKEY 无限制,当然是自己使用,高级功能了

222.png

本原创文章自由转载,转载请注明本博来源及网址 | 当前页面:兰雅sRGB个人笔记 » Python 爬虫WebAPI版: 批量网址转Markdown