wangzhibo
2025-07-30 245253cd9e0ebaad3b9b4efbfae8c0e3090afc9b
auto_media_publisher/uploaders/uploader_shipinhao.py
@@ -15,7 +15,7 @@
        await page.click('input[placeholder="请选择发表时间"]')
        str_month = str(self.publish_datetime.month) if self.publish_datetime.month > 9 else "0" + str(self.publish_datetime.month)
        str_month = str(self.scheduled_time.month) if self.scheduled_time.month > 9 else "0" + str(self.scheduled_time.month)
        current_month = str_month + "月"
        # 获取当前的月份
        page_month = await page.inner_text('span.weui-desktop-picker__panel__label:has-text("月")')
@@ -32,14 +32,14 @@
            if 'weui-desktop-picker__disabled' in await element.evaluate('el => el.className'):
                continue
            text = await element.inner_text()
            if text.strip() == str(self.publish_datetime.day):
            if text.strip() == str(self.scheduled_time.day):
                await element.click()
                break
        # 输入小时部分(假设选择11小时)
        await page.click('input[placeholder="请选择时间"]')
        await page.keyboard.press("Control+KeyA")
        await page.keyboard.type(str(self.publish_datetime.hour))
        await page.keyboard.type(str(self.scheduled_time.hour))
        # 选择标题栏(令定时时间生效)
        await page.locator("div.input-editor").click()
@@ -49,7 +49,7 @@
        await page.locator('div.media-status-content div.tag-inner:has-text("删除")').click()
        await page.get_by_role('button', name="删除", exact=True).click()
        file_input = page.locator('input[type="file"]')
        await file_input.set_input_files(self.path_video)
        await file_input.set_input_files(self.path_media)
    async def add_short_title(self, page):
        short_title_element = page.get_by_text("短标题", exact=True).locator("..").locator(
@@ -165,7 +165,7 @@
            self.logger.info(f'[+]正在上传-------{self.title}.mp4')
            await page.wait_for_url(CONTENT_UPLOAD_URL, timeout=120000)
            file_input = page.locator('input[type="file"]')
            await file_input.set_input_files(self.path_video)
            await file_input.set_input_files(self.path_media)
            # 填充标题和话题
            await self.add_title_tags(page)
            # 添加商品
@@ -176,7 +176,7 @@
            await self.add_original(page)
            # 检测上传状态
            await self.detect_upload_status(page)
            if self.publish_datetime != 0:
            if self.scheduled_time != 0:
                await self.set_schedule_time_tencent(page)
            # 添加短标题
            await self.add_short_title(page)
@@ -189,5 +189,5 @@
           
            return True
        except Exception as e:
            self.logger.error(f"{self.user} upload video {self.path_video} fails, error is :{e}")
            self.logger.error(f"{self.user} upload video {self.path_media} fails, error is :{e}")
            return False