Skip to content

Instantly share code, notes, and snippets.

View muhammedfurkan's full-sized avatar
🙃

M.Furkan muhammedfurkan

🙃
View GitHub Profile
@x0x8x
x0x8x / fetch_all_users-telethon.py
Last active December 22, 2020 14:18
fetch all users from the specific group and print their entities
import telethon
from telethon.errors.rpcerrorlist import FloodWaitError
import asyncio
e = event
bot = c = cl = app = client
csm = client.send_message
ecid = event.chat_id
members = []
@x0x8x
x0x8x / lambda_all_participants.py
Last active December 22, 2020 14:18
Will count all users messages of the specific group and print sorted out from most talked to none with an λ
group = 'telethonchat'
print(
(
(
lambda c: (
lambda ts: "\n".join(
f"{t} messages from {u}" for t, u in sorted(ts, key=lambda t: -t[0])
)
)(
(
@x0x8x
x0x8x / aioschedule_telethon.py
Created April 21, 2020 03:25
schedules in telethon
import aioschedule as schedule
import asyncio
from telethon import TelegramClient
with TelegramClient(
os.path.abspath(fileName),
config.getint("api", "api_id"),
config.get("api", "api_hash"),
connection_retries=15,
retry_delay=3,
@semihkeskindev
semihkeskindev / tr_phone_regex_advanced.txt
Last active March 21, 2024 12:20
TR Turkey Turkish Phone Regex advanced
// 3. satırı baştan sona kopyalamanız gerekmektedir. Çalışır örneğini 5. satırdaki linkten görebilirsiniz.
/(^[0\s]?[\s]?)([(]?)([5])([0-9]{2})([)]?)([\s]?)([0-9]{3})([\s]?)([0-9]{2})([\s]?)([0-9]{2})$/g
// https://regexr.com/5005l
@vshlapakov
vshlapakov / telerss.py
Created February 6, 2020 16:25
Create RSS feeds for all defined Telegram channels
import os
import datetime
from pathlib import Path
from typing import List
from rfeed import Item, Feed, Guid, Image
from telethon import TelegramClient
from telethon.extensions.html import unparse
from telethon.tl import types
from telethon.tl.custom import Dialog, Message
@thetonus
thetonus / download.py
Last active October 18, 2022 15:29
Download file with Asyncio and Aiofiles
import asyncio
import os
from typing import List
import aiofiles
import httpx
async def download(client: httpx.AsyncClient, link: str, filename: str) -> None:
""" Download link """
@leftrk
leftrk / download.py
Created December 11, 2019 18:37
download file
def downloadFILE(url, name):
resp = requests.get(url=url, stream=True)
content_size = int(resp.headers['Content-Length']) / 1024
with open(name, "wb") as f:
print("File total size is:", content_size, 'k,start...')
for data in tqdm(iterable=resp.iter_content(1024), total=content_size + 1, unit='k', desc=name):
f.write(data)
print(name + " download finished!")
@dagvany
dagvany / ninja_nerd_list_downloader.py
Last active May 23, 2020 09:24
Ninja Nerd Science yt playlist downloader
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import subprocess
ytLists = {
'Hematology': 'https://www.youtube.com/watch?v=yF22BfXEO5g&list=PLTF9h-T1TcJh9T57G0nls2uGPzzHKMxxh',
'Biochemistry': 'https://www.youtube.com/watch?v=jJUoQMLMV2E&list=PLTF9h-T1TcJhcNo9M1VFXz6rMKT6CM_wd',
'Cardiovascular Physiology': 'https://www.youtube.com/watch?v=jU9w6w8LwqM&list=PLTF9h-T1TcJhp-1zjtApt2lVbQ2JHkY7b',
'Immunology': 'https://www.youtube.com/watch?v=LArxUakFsFs&list=PLTF9h-T1TcJj4AOPCxGxOUTH0IVmaH7_8&index=2&t=0s',
@ColinShark
ColinShark / 1.md
Last active December 25, 2021 08:51
start(), idle() and stop() multiple Pyrogram Clients at once.

OUTDATED

These are outdated as they haven't been updated for Pyrogram v1.

If you know what you're doing, feel free to use these as a guide.

For any questions, head to @PyrogramLounge.

Update

@Pokurt has updated these scripts to Pyrogram v1

@behf
behf / split.py
Last active May 14, 2020 14:59
split a long text into small chunks, it won't cut your words.
def split_message(text, length=4096, offset=200):
return [text[text.find('\n', i - offset, i + 1) if text.find('\n', i - offset, i + 1) != -1 else i:
text.find('\n', i + length - offset, i + length) if text.find('\n', i + length - offset,
i + length) != -1 else i + length] for
i
in
range(0, len(text), length)]
# Usage, Using Pyrogram