def __get_details(self, url, muti, name, page, index_str): resp = self.session.get(url) resp.encoding = "utf8" if not self.__check_if_need_relogin(resp): return bs_data = bs_4(resp.text, "lxml") uid, sid = Parser.get_uid_and_sid(bs_data) if not any((uid, sid)): return details, person, notice, img = Cursor.get_model_details(uid, sid) try: person_datas, username = Parser.get_person_data(bs_data) if not person: person_datas.update( { "uid": uid, "user": username, "regtime": Parser.get_reg_date(bs_data, "1999-01-01"), } ) person = Cursor.create_person(person_datas) else: Cursor.update_person(person_datas, uid) person = person[0].uid if not notice: notice = Cursor.create_notice({"sid": sid}) else: notice = notice[0].sid detailImages = None detailContent = Parser.get_detail_content(bs_data) if not img: urls = Parser.get_img_urls(bs_data) img = Cursor.create_img( {"sid": sid, "img": urls, "detail": detailContent} ) detailImages = self.__save_pics(urls, sid) else: img = img[0].sid current_year = moment.now().year real_up_time = Parser.get_up_time(bs_data, current_year) details_datas = Parser.get_details( bs_data, current_year, real_up_time, muti ) if not details: details_datas.update( { "sid": sid, "user": person, "area": muti["area"], "title": muti["title"], "detailurl": url, "img": img, "notice": notice, } ) details = Cursor.create_details(details_datas) self.__make_msg(details, detailContent, detailImages, sid, username) else: Cursor.update_details(details_datas, sid) short_msg = f'[{name}:{page}:{index_str}]-{real_up_time}- {muti["title"]}' success(short_msg) if not details else warning(short_msg) except KeyboardInterrupt: exit() except Exception as e: error(f"[run-->__get_details]: {e}") self.__save_error("__get_details.html", resp)