1 Star 1 Fork 1

Neilyoz / DouYinAndInsDownloader

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
InsDownload.py 1020 Bytes
一键复制 编辑 原始数据 按行查看 历史
Neilyoz 提交于 2019-12-03 00:40 . first commit
#!/usr/bin/env python
# coding: utf-8
from flask import Flask, render_template, request
import requests
from bs4 import BeautifulSoup
app = Flask(__name__)
proxies = {
'http': 'http://127.0.0.1:1087',
'https': 'http://127.0.0.1:1087'
}
def download_single_file(file_url):
"""
读取url内容,获取url对应的用户图片
:param file_url:
:return:
"""
f = requests.get(file_url, proxies=proxies)
html_source = f.text
soup = BeautifulSoup(html_source, 'html.parser')
meta_tag = soup.find_all('meta', {'property': 'og:image'})
img_url = meta_tag[0]['content']
return img_url
@app.route("/", methods=['POST', 'GET'])
def index():
if request.method == 'POST':
url = request.form['url']
img_file = download_single_file(url)
input_text = url
return render_template('index.html', img_file=img_file, input_text=input_text)
else:
return render_template('index.html')
if __name__ == "__main__":
app.run(debug=True)
Python
1
https://gitee.com/neilyoz/DouYinAndInsDownloader.git
git@gitee.com:neilyoz/DouYinAndInsDownloader.git
neilyoz
DouYinAndInsDownloader
DouYinAndInsDownloader
master

搜索帮助