Заметки электроника
Простое - надёжнее!
Меню
  • Главная
  • Погода
  • Заметки
  • Календарь
  • Фотогалерея
  • Песни
  • Чтиво
  • Программы
  • Скачать
  • Связь и ссылки
  • Чехия
  • Lavka

Живёшь в Чехии?

Копия шестирёнки быстро и без спец. инструмента

  • Печать
  • E-mail
Информация о материале
Автор: Super User
Родительская категория: Заметки
Категория: Жизнь
Создано: 16 июня 2022
Обновлено: 16 июня 2022
Просмотров: 1037
Звезда не активнаЗвезда не активнаЗвезда не активнаЗвезда не активнаЗвезда не активна

Telegram: automatically add members to your group (python + telethon)

  • Печать
  • E-mail
Информация о материале
Автор: Super User
Родительская категория: Заметки
Категория: Программирование
Создано: 12 июня 2022
Обновлено: 12 июня 2022
Просмотров: 4913
Звезда не активнаЗвезда не активнаЗвезда не активнаЗвезда не активнаЗвезда не активна
Users collected by previous published script
from telethon.sync import TelegramClient
from telethon.tl.functions.messages import GetDialogsRequest
from telethon.tl.types import InputPeerEmpty, InputPeerChannel, InputPeerUser
from telethon.errors.rpcerrorlist import PeerFloodError, UserPrivacyRestrictedError
from telethon.tl.functions.channels import InviteToChannelRequest
import sys
import csv
import traceback
import time
import logging
import traceback
from telethon import errors

api_id = xxxxxxxxx
api_hash = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
phone = '+7xxxxxxxxxxx'
client = TelegramClient(phone, api_id, api_hash)

logging.basicConfig(filename='app.log', filemode='w', format='%(message)s')
 
client.connect()
if not client.is_user_authorized():
    client.send_code_request(phone)
    client.sign_in(phone, input('Enter the code: '))
 
input_file = sys.argv[1]
users = []
with open(input_file, encoding='UTF-8') as f:
    rows = csv.reader(f,delimiter=",",lineterminator="\n")
    next(rows, None)
    for row in rows:
        user = {}
        user['username'] = row[0]
        user['id'] = int(row[1])
#        user['access_hash'] = int(row[2])
        user['name'] = row[3]
        users.append(user)
 
chats = []
last_date = None
chunk_size = 200
groups=[]
 
result = client(GetDialogsRequest(
             offset_date=last_date,
             offset_id=0,
             offset_peer=InputPeerEmpty(),
             limit=chunk_size,
             hash = 0
         ))
chats.extend(result.chats)
 
for chat in chats:
    try:
        if chat.megagroup== True:
            groups.append(chat)
    except:
        continue
 
print('Choose a group to add members:')
i=0
for group in groups:
    print(str(i) + '- ' + group.title)
    i+=1
 
g_index = input("Enter a Number: ")
target_group=groups[int(g_index)]
 
target_group_entity = InputPeerChannel(target_group.id,target_group.access_hash)
 
mode = int(input("Enter 1 to add by username or 2 to add by ID: "))
waittime = 10
print(len(users))
for user in users:
    
    try:
        print ("Adding {}".format(user['id']))
        logging.warning("Adding {} ,".format(user['id']))
        if mode == 1:
            if user['username'] == "":
                continue
            user_to_add = client.get_input_entity(user['username'])
        elif mode == 2:
            user_to_add = client.get_entity(user['id'])
        else:
            sys.exit("Invalid Mode Selected. Please Try Again.")
        client(InviteToChannelRequest(target_group_entity,[user_to_add]))
        #client.send_message(user['id'], 'Hi! please join my group....')
        print("Waiting {} Seconds...".format(waittime))
        time.sleep(10)
    except PeerFloodError:
        print("Getting Flood Error from telegram. Script is stopping now. Please try again after some time.")
        logging.warning("Flood")
        print(traceback.format_exc())
        exit()
    except UserPrivacyRestrictedError:
        print("The user's privacy settings do not allow you to do this. Skipping. Sending message")
        client.send_message(user['id'], 'Hi! please join my group....')
        logging.warning("privacy settings")
    except errors.FloodWaitError as e:
        print('Flood wait for ', e.seconds)
        time.sleep(e.seconds)
        
    except  errors.UsernameInvalidError:
        print('NAME ERROR')
    except:
        traceback.print_exc()
        print("Unexpected Error")
        logging.warning("Unexpected Error")
        print("Print traceback {} Seconds...".format(waittime))
        #print(traceback.format_exc())
        #exit()
        continue

Telegram: collect all users from a group (using python and telethon)

  • Печать
  • E-mail
Информация о материале
Автор: Super User
Родительская категория: Заметки
Категория: Программирование
Создано: 12 июня 2022
Обновлено: 12 июня 2022
Просмотров: 3805

Рейтинг: 4 / 5

Звезда активнаЗвезда активнаЗвезда активнаЗвезда активнаЗвезда не активна
from telethon.sync import TelegramClient
from telethon.tl.functions.messages import GetDialogsRequest
from telethon.tl.types import InputPeerEmpty
import csv
 
api_id = xxxxxxx
api_hash = 'xxxxxxxxxxxxxxxxxxxxxxxxxx'
phone = '+7xxxxxxxxxxx'
client = TelegramClient(phone, api_id, api_hash)
 
client.connect()
if not client.is_user_authorized():
    client.send_code_request(phone)
    client.sign_in(phone, input('Enter the code: '))
 
 
chats = []
last_date = None
chunk_size = 200
groups=[]
 
result = client(GetDialogsRequest(
             offset_date=last_date,
             offset_id=0,
             offset_peer=InputPeerEmpty(),
             limit=chunk_size,
             hash = 0
         ))
chats.extend(result.chats)
 
for chat in chats:
    try:
        if chat.megagroup== True:
            groups.append(chat)
    except:
        continue
 
print('Choose a group to scrape members from:')
i=0
for g in groups:
    print(str(i) + '- ' + g.title)
    i+=1
 
g_index = input("Enter a Number: ")
target_group=groups[int(g_index)]
 
print('Fetching Members...')
all_participants = []
all_participants = client.get_participants(target_group, aggressive=True)
 
print('Saving In file...')
with open("members.csv","w",encoding='UTF-8') as f:
    writer = csv.writer(f,delimiter=",",lineterminator="\n")
    writer.writerow(['username','user id', 'access hash','name','group', 'group id'])
    for user in all_participants:
        if user.username:
            username= user.username
        else:
            username= ""
        if user.first_name:
            first_name= user.first_name
        else:
            first_name= ""
        if user.last_name:
            last_name= user.last_name
        else:
            last_name= ""
        name= (first_name + ' ' + last_name).strip()
        writer.writerow([username,user.id,user.access_hash,name,target_group.title, target_group.id])      
print('Members scraped successfully.')

Tracking: LoRaWAN+GPS and BLE/WiFi fingerprinting with HERE Tracking, i-KNN algorithm

  • Печать
  • E-mail
Информация о материале
Автор: Super User
Родительская категория: Заметки
Категория: Лаборатория
Создано: 11 июня 2022
Обновлено: 11 июня 2022
Просмотров: 872
Звезда не активнаЗвезда не активнаЗвезда не активнаЗвезда не активнаЗвезда не активна
Collect:
1.https://www.researchgate.net/profile/Loizos-Kanaris/publication/315839931_Fusing_Bluetooth_Beacon_Data_with_Wi-Fi_Radiomaps_for_Improved_Indoor_Localization/links/58eb6ce24585153b60c95e13/Fusing-Bluetooth-Beacon-Data-with-Wi-Fi-Radiomaps-for-Improved-Indoor-Localization.pdf?origin=publication_detail
2. https://lora-alliance.org/lora_products/abeeway-micro-tracker/
3. https://www.u-blox.com/en/blogs/tech/ultra-low-power-gps-u-blox-m10 (ULP GPS)
4. https://eu.mouser.com/new/maxim-integrated/maxim-max2769c-receiver/ (ULP GPS)
5.occupancy detection https://www.thethingsnetwork.org/device-repository/devices/elsys/ems-desk/

ARPA TRCVR collection: preparation

  • Печать
  • E-mail
Информация о материале
Автор: Super User
Родительская категория: Заметки
Категория: Электроника / cхемотехника
Создано: 10 июня 2022
Обновлено: 10 июня 2022
Просмотров: 998
Звезда не активнаЗвезда не активнаЗвезда не активнаЗвезда не активнаЗвезда не активна
1. POWER AMPLIFIER
a. 144MHz Gain 24dB DC 5V Ultra Low Noise Amplifier LNA SMA-K Connector Module (30 dB), 10mW
b. MMZ09332BT1 RF Amplifier, InGaP HBT, 2 Stages, 130MHz to 1000MHz, 30db Gain, 3V to 5V, HVQFN-12
c. https://www.mouser.in/datasheet/2/976/CMX902_ds-1591679.pdf
d. https://www.mouser.in/datasheet/2/609/643120f-1271368.pdf (max gain close  needed F., 0.15W)
e.https://www.mouser.in/datasheet/2/976/CMX901_ds-1591670.pdf   (temperature dem - more power in lower T)

  1. LoraWAN alternatives SigFox, ARPA, SWARM
  2. LiteVNA - connection to PC
  3. PCB manufacturers in EU
  4. Оплодотворение 3D анимация

Страница 57 из 197

  • 52
  • 53
  • 54
  • ...
  • 56
  • 57
  • 58
  • 59
  • ...
  • 61

Back to Top

© 2026 Заметки электроника

Top.Mail.Ru