assetstore.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:unity 作者: awolfly9 项目源码 文件源码
def get_categories(self, response):
        self.write_file(self.dir_plugins + 'categories.json', response.body)

        # ????? json ??
        categories = json.loads(response.body)

        for category in categories.get('categories'):
            name = category.get('name', '')
            subs = category.get('subs', '')
            dir_name = self.dir_plugins + name
            utils.make_dir(dir_name)

            if subs is not '':
                self.get_all_subs(subs, dir_name)
            else:
                # ????
                name = category.get('name', '')
                count = category.get('count', 0)
                id = category.get('id', 0)
                child_subs = category.get('subs', '')

                plugin = {}
                plugin['name'] = name
                plugin['count'] = count
                plugin['id'] = id
                plugin['dir_name'] = dir_name
                if child_subs == '':
                    plugin['child'] = 'yes'
                else:
                    plugin['child'] = 'no'

                self.plugin_list.append(plugin)

        for plugin in self.plugin_list:
            id = plugin.get('id', '')
            count = plugin.get('count')
            dir_name = plugin.get('dir_name')
            name = plugin.get('name')

            yield Request(
                    url = 'https://www.assetstore.unity3d.com/api/en-US/search/results.json?q=' + 'category:' + id + \
                          '&rows=' + count + '&page=' + str(1) + '&order_by=popularity' + '&engine=solr',
                    method = 'GET',
                    dont_filter = True,
                    headers = self.headers,
                    meta = {
                        'dir_name': dir_name,
                        'name': name,
                        'id': id,
                        'download_timeout': 60,
                        'is_proxy': False,
                    },
                    callback = self.get_plugin_list,
                    errback = self.error_parse,
            )

    # ??????? unity ??
    # ????????????
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号