Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only 10k members are scrape. Do you have the solution to scrape more members #37

Open
rfve opened this issue Mar 19, 2023 · 14 comments
Open

Comments

@rfve
Copy link

rfve commented Mar 19, 2023

only 10k members are scrape. Do you have the solution to scrape more members

@vedthemaster
Copy link

Yes, there is limit set by telegram. I am not sure but if you can track the last scraped member's id and iterate to that id in next cycle of scraping then it might be possible.

@rfve
Copy link
Author

rfve commented Mar 26, 2023

LonamiWebs/Telethon#580

how to apply the solution here

@vedthemaster
Copy link

Yeah, this can be a one solution, according to the thread you provide you can implement solution in scraper.py at line number 85.

@rfve
Copy link
Author

rfve commented Mar 27, 2023

I don't know python very well. can you update the code

@vedthemaster
Copy link

vedthemaster commented Mar 27, 2023

Remove the line number 85 in scraper.py file with this code:

`queryKey = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
all_participants = []
channel = 'someGroupName'

for key in queryKey:
offset = 0
limit = 100
while True:
participants = client(GetParticipantsRequest(
target_group, ChannelParticipantsSearch(key), offset, limit,
hash=0 ))
if not participants.users:
break
for user in participants.users:
try:
if re.findall(r"\b[a-zA-Z]", user.first_name)[0].lower() == key:
all_participants.append(user)
except:
pass
offset += len(participants.users)
print(offset)`

@rfve
Copy link
Author

rfve commented Mar 28, 2023

unfortunately it did not work. :(

error message this ;

Traceback (most recent call last):
File "C:\tg\TelegramScraper-master\scraper.py", line 94, in
participants = client(GetParticipantsRequest(
NameError: name 'GetParticipantsRequest' is not defined

@vedthemaster
Copy link

Add this import from telethon.tl.functions.channels import GetParticipantsRequest, and it should solve the error.

@rfve
Copy link
Author

rfve commented Mar 29, 2023

I've reorganized the code. the part here needs to be corrected to come from the main query.
channel = 'hotdeals'

secondly, it does not write his scrapes to the members.csv file. what could be the reason for this.

code is ;

https://notepad.link/tQKMg

@vedthemaster
Copy link

once the all members are scraped then try to print all_participants list using print(all_participants) and also length of this list using print(f'Scraped Total Members : {len(all_participants)}'). and if there are members in this list then we can find the error in not writing to csv file .

I have updated this changes in : https://notepad.link/tQKMg

@rfve
Copy link
Author

rfve commented Mar 30, 2023

https://snipboard.io/rPMEke.jpg

unfortunately it didn't work.

@rfve
Copy link
Author

rfve commented Apr 4, 2023

is there a solution to this situation?

@rfve
Copy link
Author

rfve commented Apr 29, 2023

are you there ?

@vedthemaster
Copy link

Hey Sorry,I am little busy. But didn't find any soltion for this

@mmg-and-campus
Copy link

is that fixed ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants