猫史档案馆


【Python作品分享】编程猫工作室排行【作品秀】

用户:冷鱼闲风冷鱼闲风查看:7 回复:9 评论:7 创建时间:2020-04-11T12:50:25


【作品展示】

center_image

 

【作品介绍】

根据获取官方的数据,实时更新工作室排名,打开py据可以获取工作室排名。

1.支持查看前200名工作室

2.支持查看工作室成员

3.支持查看工作室成员的介绍

 

【作品源代码】

import requests
import json
import easygui

def gzs():

    # 获取编程猫工作室排行JSON
    r = requests.get(
        'https://api.codemao.cn/web/shops/ranking?start=1&end=200')
    r.encoding = 'utf-8'
    r = r.text
    # 以上是把界面里面的JSON提取出来,方便下面的调用!
    r = json.loads(r)
   
    # 编程猫个人姓名
    name=[]
    idd=[]
    for i in range(200):
        name.append("第"+str(i+1)+"名:"+r['items'][i]['name'])
        idd.append(r['items'][i]['work_subject_id'])
        i += 1
    dic = dict(map(lambda x, y: [x, y], name, idd))
    choices = easygui.choicebox(msg='以下是工作室排行前200名!',
                                title='编程猫工作室排行前200',
                                choices=name)
    index = ''.join(choices)

    # 获取编程猫工作室排行JSON
    rr = requests.get(
        'https://api.codemao.cn/web/shops/'+str(dic[index])+'/users?limit=40&offset=0')
    rr.encoding = 'utf-8'
    rr = rr.text
    # 以上是把界面里面的JSON提取出来,方便下面的调用!
    rr = json.loads(rr)
    print(rr)
    name = []
    idd=[]
    for i in range(40):
        try:
            name.append(rr['items'][i]['name'])
            idd.append(rr['items'][i]['user_id'])
            i += 1
        except:
            dic = dict(map(lambda x, y: [x, y], name, idd))
            choices = easygui.choicebox(msg='以下是'+index+'的成员!',
                                title='编程猫工作室成员',
                                choices=name)
            index = ''.join(choices)
    # 获取编程猫工作室成员JSON
            r = requests.get(
                        'https://api.codemao.cn/api/user/info/detail/'+str(dic[index]))
            r.encoding = 'utf-8'
            r = r.text
    # 以上是把界面里面的JSON提取出来,方便下面的调用!
            r = json.loads(r)
            namee = r['data']['userInfo']['user']['nickname']
            qm = r['data']['userInfo']['user']['description']
            zz = r['data']['userInfo']['user']['doing']
            tjzp = r['data']['userInfo']['work']['name']
            tjzpid = r['data']['userInfo']['work']['id']
            easygui.msgbox(msg="用户名称:"+namee+"\n用户介绍:"+qm+"\n用户正在做:"+zz+"\n用户推荐作品:"+tjzp,
                   title="编程猫用户资料", ok_button="好的")
            break




    
       

    


gzs()



 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
闪电劈死你闪电劈死你

我ctrl+c了哦~

点赞1


评论


陈年老按陈年老按

Niceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

666

点赞1


评论


程序侯程序侯

顶顶顶顶顶顶顶顶顶底!!!!!!!!!!!!!!!!!!!!!!!!

点赞1


评论


Lai追求Lai追求

看样子是个大佬,有兴趣加入我们源计划吗emotion_doge

点赞1


评论


86135clc86135clc

{"order":632,"name":"编程猫官方","work_subject_id":228,"total_score":-998,"level":4,"created_at":15喵571732,"wuhan_medal":false}
第一个大神工作室-998分。。。。

点赞1


评论


cool-creepercool-creeper

加个搜索框

点赞1


评论


dounsm36dounsm36

666

点赞0


评论


煤黑烧饼煤黑烧饼

编程猫有详细关于这个api的用法的文档吗

点赞0


评论


YDS星辰之上YDS星辰之上

爬虫库get!

点赞0


评论