def get_schedule(self) -> [Schedule]: query_date = time.strptime(self.query_date, '%Y/%m/%d') query_year = time.strftime('%Y', query_date) query_month = time.strftime('%m', query_date) query_day = int(time.strftime('%d', query_date)) schedule_list_url = 'http://www.ske48.co.jp/schedule/calendar.php?y={year}&m={month}'.format( year=query_year, month=query_month) schedule_list_html = self._get_html(schedule_list_url) schedule_list = [] event_list = schedule_list_html.select( 'table[title="SCHEDULE"] > a[name="{day}"] + tr li'.format( day=query_day)) for event in event_list: category = event.get('class')[0] event_link = event.find('a').get('href') members = self._get_event_detail(event_link, category) schedule = Schedule() schedule.event_type = self.category.get(category, '') schedule.title = event.find('a').string schedule.members = members schedule_list.append(schedule) return schedule_list
def get_schedule(self) -> [Schedule]: query_date = time.strptime(self.query_date, '%Y/%m/%d') query_year = time.strftime('%Y', query_date) query_month = time.strftime('%m', query_date) query_day = int(time.strftime('%d', query_date)) schedule_list_url = 'http://www.hkt48.jp/schedule/{year}/{month}/'.format( year=query_year, month=query_month) schedule_list_html = self._get_html(schedule_list_url) schedule_list = [] event_list = schedule_list_html.select( 'th[id="day{query_day}"] + td p'.format(query_day=query_day)) for event in event_list: category = event.get('class')[0] schedule = Schedule() schedule.event_type = self.CATEGORY.get(category, '') schedule.title = event.get_text().strip() schedule_list.append(schedule) return schedule_list
def get_schedule(self) -> [Schedule]: get_time = time.strptime(self.query_date, '%Y/%m/%d') year = time.strftime('%Y', get_time) month = time.strftime('%m', get_time) day = time.strftime('%d', get_time) body = {'month': month, 'year': year, 'category': 0} url = 'https://www.akb48.co.jp/public/api/schedule/calendar/' response_json = requests.post(url, data=body).json() today_key = year + '_' + month + '_' + str(int(day)) members_api = 'https://www.akb48.co.jp/public/api/member/list/' members_dic = requests.post(members_api).json()["data"] # print(json.dumps(response_json, ensure_ascii=False)) if today_key not in response_json["data"]["thismonth"]: return [] today_list = response_json["data"]["thismonth"][today_key] schedule_list = [] for schedule_dic in today_list: schedule = Schedule() schedule.title = schedule_dic["title"] if schedule_dic["parent_category"] in self.category: schedule.event_type = self.category[ schedule_dic["parent_category"]] schedule.start_time = schedule_dic["date"][-8:-3] schedule.end_time = schedule_dic["end_date"][-8:-3] if schedule_dic["member"]: member_key_list = schedule_dic["member"].split(',') else: member_key_list = [] # print(member_key_list) if members_dic and len(member_key_list) > 0: members_name_list = [] for member_no in member_key_list: if member_no in members_dic: name = members_dic[member_no]["name"].replace('\t', '') members_name_list.append(name) schedule.members = members_name_list schedule_list.append(schedule) # print(today_list) return schedule_list
def data_output(self, datas, ngt_type): for data in datas['items']: schedule = Schedule() # print('summary: ', data['summary']) schedule.title = data['summary'] schedule.event_type = ngt_type if 'dateTime' in data['start']: # print('start: ', data['start']['dateTime']) schedule.start_time = data['start']['dateTime'][11:16] if int(schedule.start_time[0:2]) <= 3: schedule.start_time = str(int(schedule.start_time[0:2]) + 24) + schedule.start_time[2:] if 'dateTime' in data['end']: # print('end: ', data['end']['dateTime']) schedule.end_time = data['end']['dateTime'][11:16] if int(schedule.end_time[0:2]) < 3: schedule.end_time = str(int(schedule.end_time[0:2]) + 24) + schedule.end_time[2:] if 'date' in data['start']: # print('start: ', data['start']['date']) schedule.start_time = "" if 'date' in data['end']: # print('end: ', data['end']['date']) schedule.end_time = "" if 'description' in data: # print('description: ', data['description']) schedule.description = data['description'] if 'location' in data: # print('location: ', data['location']) schedule.location = data['location'] self.schedule_list.append(schedule)
def get_schedule(self) -> [Schedule]: schedule_list = [] schedule_list.append(Schedule()) return schedule_list