def md_init(proid_array): array = [] for id in proid_array: dict = {} dict['pro_id'] = int(id) id_url = 'https://zhongchou.modian.com/item/%d' % int(id) try: dict['url_short'] = setting.get_short_url(id_url) except Exception as e: dict['url_short'] = 'https://m.modian.com/project/%d' % int(id) dict['url_long'] = 'https://m.modian.com/project/%d' % int(id) detail = getDetail(id) dict['name'] = detail['data'][0]['pro_name'] array.append(dict) return array
def getScheme(self, i): datas = self.response['data']['cards'][i] # 转换为短网址 url = setting.get_short_url(str(datas['scheme'])) return str(url)