|
28 | 28 | from urbandict import define |
29 | 29 | from wikipedia import summary |
30 | 30 | from wikipedia.exceptions import DisambiguationError, PageError |
| 31 | +from youtube_search import YoutubeSearch |
31 | 32 | from youtube_dl import YoutubeDL |
32 | 33 | from youtube_dl.utils import ( |
33 | 34 | ContentTooShortError, |
|
39 | 40 | UnavailableVideoError, |
40 | 41 | XAttrMetadataError, |
41 | 42 | ) |
42 | | -from youtube_search import YoutubeSearch |
43 | | - |
| 43 | +from asyncio import sleep |
44 | 44 | from userbot import BOTLOG, BOTLOG_CHATID, CMD_HELP, TEMP_DOWNLOAD_DIRECTORY, WOLFRAM_ID |
45 | 45 | from userbot.events import register |
46 | 46 | from userbot.utils import chrome, googleimagesdownload, progress |
@@ -77,7 +77,18 @@ async def carbon_api(e): |
77 | 77 | url = CARBON.format(code=code, lang=CARBONLANG) |
78 | 78 | driver = await chrome() |
79 | 79 | driver.get(url) |
80 | | - await e.edit("`Processing...\n50%`") |
| 80 | + await e.edit("`Processing..\n50%`") |
| 81 | + download_path = './' |
| 82 | + driver.command_executor._commands["send_command"] = ( |
| 83 | + "POST", '/session/$sessionId/chromium/send_command') |
| 84 | + params = { |
| 85 | + 'cmd': 'Page.setDownloadBehavior', |
| 86 | + 'params': { |
| 87 | + 'behavior': 'allow', |
| 88 | + 'downloadPath': download_path |
| 89 | + } |
| 90 | + } |
| 91 | + driver.execute("send_command", params) |
81 | 92 | driver.find_element_by_xpath("//button[@id='export-menu']").click() |
82 | 93 | driver.find_element_by_xpath("//button[contains(text(),'4x')]").click() |
83 | 94 | driver.find_element_by_xpath("//button[contains(text(),'PNG')]").click() |
|
0 commit comments