forked from UsergeTeam/Userge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
few formatings and webss.py for screenshots
Signed-off-by: Udith <[email protected]>
- Loading branch information
Showing
15 changed files
with
96 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,5 @@ emoji | |
wget | ||
nest_asyncio | ||
requests | ||
pySmartDL | ||
pySmartDL | ||
selenium |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
from userge.utils import Config, logging | ||
from userge.core import Userge, Filters, get_collection | ||
from userge.core import Userge, Filters, get_collection, Message | ||
|
||
|
||
userge = Userge() # userge is the client name | ||
userge = Userge() # userge is the client name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
from ._userge import Userge, Filters | ||
from ._database import get_collection | ||
from ._userge import Userge, Filters, Message | ||
from ._database import get_collection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from .client import Userge, Filters | ||
from .client import Userge, Filters, Message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from userge import userge, Message | ||
from selenium import webdriver | ||
from selenium.webdriver.firefox.options import Options | ||
from time import time | ||
import os | ||
|
||
profile = webdriver.FirefoxProfile() | ||
profile.accept_untrusted_certs = True | ||
options = Options() | ||
options.headless = True | ||
options.set_capability("marionette", False) | ||
|
||
|
||
@userge.on_cmd("webss", about="__Get snapshot of a website__") | ||
async def webss(message: Message): | ||
await message.edit("`Processing`") | ||
try: | ||
path = await getimg(message.input_str) | ||
except Exception as e: | ||
await message.err(str(e), del_in=10) | ||
else: | ||
await userge.send_document(message.chat.id, path, caption=message.input_str) | ||
if os.path.isfile(path): | ||
os.remove(path) | ||
await message.delete() | ||
|
||
|
||
async def getimg(url): | ||
driver = webdriver.Firefox(executable_path='resources/geckodriver', | ||
options=options, | ||
firefox_profile=profile) | ||
try: | ||
driver.get(url) | ||
except Exception: | ||
raise | ||
else: | ||
path = f'./screenshot/{time()}screenshot.png' | ||
driver.save_screenshot(path) | ||
return path | ||
finally: | ||
driver.quit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,4 @@ | |
runcmd, | ||
humanbytes, | ||
time_formatter | ||
) | ||
) |
Oops, something went wrong.