鱼C论坛

 找回密码
 立即注册
12
返回列表 发新帖
楼主: 风百默

[已解决]哪位大佬帮帮我,我这里那错了?

[复制链接]
发表于 2022-5-9 20:58:34 | 显示全部楼层
风百默 发表于 2022-5-9 20:57
大佬,我不加代理IP了,我这样试了一下为什么错了?
import urllib.request
import os

代码?
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2022-5-9 21:08:51 | 显示全部楼层


import urllib.request
import os
a = 'https://cdn.huaon.com/images/2022/0209/974cc74222f63b6cb8af667198e1feb6db144761.png?x-oss-process=style/wt750'
b = 'https://cdn.huaon.com/images/2022/0209/a4d5a7f49bce89bab8322a0ff8eb05ed8ac75dc3.png?x-oss-process=style/wt750'
c = 'https://cdn.huaon.com/images/2022/0209/d4adfed092c98bb7c039e38f0ef9fa34ede01c65.png?x-oss-process=style/wt750'
d = 'https://cdn.huaon.com/images/2022/0209/a70a02908b7534286ae7eb2b924c2dd9779a4837.png?x-oss-process=style/wt750'
e = 'https://cdn.huaon.com/images/2022/0210/efbd4dbee868df1419eb63f05b2f7db351109df6.png?x-oss-process=style/wt750'
f = 'https://cdn.huaon.com/images/2022/0210/b5a1329e58424f58f548293e3666d5dc55f5217d.png?x-oss-process=style/wt750'
g = 'https://cdn.huaon.com/images/2022/0210/78e857f7afec592a4c6f6e26cc2d6f5ee9c25349.png?x-oss-process=style/wt750'
h = 'https://cdn.huaon.com/images/2022/0210/60aec57a50e9721172a92876dccaed9bb87ecbfb.png?x-oss-process=style/wt750'
img_addrs = [a,b,c,d,e,f,g,h]

def url_open(url):
    req = urllib.request.Request(url)
    req.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 SLBrowser/8.0.0.4153 SLBChan/105')
    response = urllib.request.urlopen(req)            
    html = response.read()
    return html

def save_imgs(folder):
         for i in range(0,8):
             filename = '统计图'+str(i)+'.png'
             with open(filename, 'wb') as f:
                 
                img = url_open(img_addrs[i])
                f.write(img)
   
def download_mm(folder='OOXX'):
    if not os.path.exists(folder):               
        os.mkdir(folder)
    os.chdir(folder)
    save_imgs(folder)

if __name__ == '__main__':
    download_mm()
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2022-5-9 21:13:09 | 显示全部楼层
import urllib.request
import os
a = 'https://cdn.huaon.com/images/2022/0209/974cc74222f63b6cb8af667198e1feb6db144761.png?x-oss-process=style/wt750'
b = 'https://cdn.huaon.com/images/2022/0209/a4d5a7f49bce89bab8322a0ff8eb05ed8ac75dc3.png?x-oss-process=style/wt750'
c = 'https://cdn.huaon.com/images/2022/0209/d4adfed092c98bb7c039e38f0ef9fa34ede01c65.png?x-oss-process=style/wt750'
d = 'https://cdn.huaon.com/images/2022/0209/a70a02908b7534286ae7eb2b924c2dd9779a4837.png?x-oss-process=style/wt750'
e = 'https://cdn.huaon.com/images/2022/0210/efbd4dbee868df1419eb63f05b2f7db351109df6.png?x-oss-process=style/wt750'
f = 'https://cdn.huaon.com/images/2022/0210/b5a1329e58424f58f548293e3666d5dc55f5217d.png?x-oss-process=style/wt750'
g = 'https://cdn.huaon.com/images/2022/0210/78e857f7afec592a4c6f6e26cc2d6f5ee9c25349.png?x-oss-process=style/wt750'
h = 'https://cdn.huaon.com/images/2022/0210/60aec57a50e9721172a92876dccaed9bb87ecbfb.png?x-oss-process=style/wt750'
img_addrs = [a,b,c,d,e,f,g,h]

def url_open(url):
    req = urllib.request.Request(url)
    req.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 SLBrowser/8.0.0.4153 SLBChan/105')
    response = urllib.request.urlopen(req)             
    html = response.read()
    return html

def save_imgs(folder):
         for i in range(0,8):
             filename = '统计图'+str(i)+'.png'
             with open(filename, 'wb') as f:
                 
                img = url_open(img_addrs[i])
                f.write(img)
   
def download_mm(folder='OOXX'):
    if not os.path.exists(folder):                
        os.mkdir(folder)
    os.chdir(folder)
    save_imgs(folder)

if __name__ == '__main__':
    download_mm()
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2022-5-9 21:14:32 | 显示全部楼层
import urllib.request
import os
a = 'https://cdn.huaon.com/images/2022/0209/974cc74222f63b6cb8af667198e1feb6db144761.png?x-oss-process=style/wt750'
b = 'https://cdn.huaon.com/images/2022/0209/a4d5a7f49bce89bab8322a0ff8eb05ed8ac75dc3.png?x-oss-process=style/wt750'
c = 'https://cdn.huaon.com/images/2022/0209/d4adfed092c98bb7c039e38f0ef9fa34ede01c65.png?x-oss-process=style/wt750'
d = 'https://cdn.huaon.com/images/2022/0209/a70a02908b7534286ae7eb2b924c2dd9779a4837.png?x-oss-process=style/wt750'
e = 'https://cdn.huaon.com/images/2022/0210/efbd4dbee868df1419eb63f05b2f7db351109df6.png?x-oss-process=style/wt750'
f = 'https://cdn.huaon.com/images/2022/0210/b5a1329e58424f58f548293e3666d5dc55f5217d.png?x-oss-process=style/wt750'
g = 'https://cdn.huaon.com/images/2022/0210/78e857f7afec592a4c6f6e26cc2d6f5ee9c25349.png?x-oss-process=style/wt750'
h = 'https://cdn.huaon.com/images/2022/0210/60aec57a50e9721172a92876dccaed9bb87ecbfb.png?x-oss-process=style/wt750'
img_addrs = [a,b,c,d,e,f,g,h]

def url_open(url):
    req = urllib.request.Request(url)
    req.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 SLBrowser/8.0.0.4153 SLBChan/105')
    response = urllib.request.urlopen(req)             
    html = response.read()
    return html

def save_imgs(folder):
         for i in range(0,8):
             filename = '统计图'+str(i)+'.png'
             with open(filename, 'wb') as f:
                 
                img = url_open(img_addrs[i])
                f.write(img)
   
def download_mm(folder='OOXX'):
    if not os.path.exists(folder):                
        os.mkdir(folder)
    os.chdir(folder)
    save_imgs(folder)

if __name__ == '__main__':
    download_mm()
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2022-5-9 21:15:29 | 显示全部楼层
import urllib.request
import os
a = 'https://cdn.huaon.com/images/2022/0209/974cc74222f63b6cb8af667198e1feb6db144761.png?x-oss-process=style/wt750'
b = 'https://cdn.huaon.com/images/2022/0209/a4d5a7f49bce89bab8322a0ff8eb05ed8ac75dc3.png?x-oss-process=style/wt750'
c = 'https://cdn.huaon.com/images/2022/0209/d4adfed092c98bb7c039e38f0ef9fa34ede01c65.png?x-oss-process=style/wt750'
d = 'https://cdn.huaon.com/images/2022/0209/a70a02908b7534286ae7eb2b924c2dd9779a4837.png?x-oss-process=style/wt750'
e = 'https://cdn.huaon.com/images/2022/0210/efbd4dbee868df1419eb63f05b2f7db351109df6.png?x-oss-process=style/wt750'
f = 'https://cdn.huaon.com/images/2022/0210/b5a1329e58424f58f548293e3666d5dc55f5217d.png?x-oss-process=style/wt750'
g = 'https://cdn.huaon.com/images/2022/0210/78e857f7afec592a4c6f6e26cc2d6f5ee9c25349.png?x-oss-process=style/wt750'
h = 'https://cdn.huaon.com/images/2022/0210/60aec57a50e9721172a92876dccaed9bb87ecbfb.png?x-oss-process=style/wt750'
img_addrs = [a,b,c,d,e,f,g,h]

def url_open(url):
    req = urllib.request.Request(url)
    req.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 SLBrowser/8.0.0.4153 SLBChan/105')
    response = urllib.request.urlopen(req)             
    html = response.read()
    return html

def save_imgs(folder):
         for i in range(0,8):
             filename = '统计图'+str(i)+'.png'
             with open(filename, 'wb') as f:
                 
                img = url_open(img_addrs[i])
                f.write(img)
   
def download_mm(folder='OOXX'):
    if not os.path.exists(folder):                
        os.mkdir(folder)
    os.chdir(folder)
    save_imgs(folder)

if __name__ == '__main__':
    download_mm()
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2022-5-9 21:18:33 | 显示全部楼层

大佬发不了了
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2022-5-9 21:19:17 | 显示全部楼层

这个发不了了
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2022-5-9 22:14:36 | 显示全部楼层
风百默 发表于 2022-5-9 19:35
大佬这个协议怎么找,我访问的网站是这个https://www.huaon.com/channel/distdata/782329.html

协议好像就俩个 http和https 哈哈 你学代理用法的时候应该提到过的吧 就看开头就行了,这个是https代表网页是安全的 好像是这个意思
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-11-18 10:30

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表