1 Star 1 Fork 0

郭少强/deeplearning-note

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
scrape-line-stamp.py 1.19 KB
一键复制 编辑 原始数据 按行查看 历史
Mario Cho 提交于 6年前 . fixed errata
import requests
import os
from bs4 import BeautifulSoup
def rem(str):
str0 = str.split("(")[1]
return str0.split(";")[0]
setname = 0
#chara = "&character=" + str(10)
chara = ""
for page in range(1,11):
ranking_url = 'https://store.line.me/stickershop/showcase/top_creators/ja?taste=1'+ str(chara) + '&page=' + str(page)
ran = requests.get(ranking_url)
soup0 = BeautifulSoup(ran.text, 'lxml')
stamp_list = soup0.find_all(class_="mdCMN02Li")
for i in stamp_list:
target_url = "https://store.line.me" + i.a.get("href")
r = requests.get(target_url)
setname += 1
new_dir_path = str(setname)
os.makedirs(new_dir_path, exist_ok = True)
soup = BeautifulSoup(r.text, 'lxml')
span_list = soup.findAll("span", {"class":"mdCMN09Image"})
fname = 0
for i in span_list:
fname += 1
imgsrc = rem(i.get("style"))
req = requests.get(imgsrc)
if r.status_code == 200:
f = open( str(setname) + "/" + str(fname) + ".png", 'wb')
f.write(req.content)
f.close()
print("finished downloading page: " + str(page) + " , set: ~" + str(setname) )
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/guo_shaoqiang/deeplearning-note.git
git@gitee.com:guo_shaoqiang/deeplearning-note.git
guo_shaoqiang
deeplearning-note
deeplearning-note
master

搜索帮助