Answer the question
In order to leave comments, you need to log in
How to get user's posts by profile link?
Hello everyone, I don’t understand how to get the latest messages of a user based on the profile link. I got the profile link, but further - a dead end. Made the output of all messages - not all are displayed. I thought that the problem is that the browser does not see them due to the fact that you have to scroll down - wrong. Messages are no different in their structure (I'm talking about classes and tags) and the only way to select messages is through the profile link, but it does not display all messages. Tell me, how can I get all the messages in the chat, what did I do wrong?
urls = []
def get_message(link_users):
for links_user in link_users:
chat = browser.get(str(link_users[0]))
for a in browser.find_elements_by_css_selector('div > a'):
urls.append(a.get_attribute('href'))
new_list = list(filter(None, urls))
mess=[]
for b in browser.find_elements_by_class_name('media-user-name'):
mess.append(b.get_attribute('href'))
new_mess = list(mess)
for new_mess in new_mess:
print(new_mess.text)
if '[ui' in new_mess:
print('a')
else:
print('vv')
i = 0
new_url = []
while i < len(new_list):
if 'users' in new_list[i]:
new_url.append(new_list[i])
new_url = list(OrderedDict.fromkeys(new_url))
i += 1
if i == len(new_list):
break
i = 0
new_url = list(OrderedDict.fromkeys(new_url))
while i <= len(new_url):
if 'https://funpay.ru/users/3295996/' in new_url[i]:
new_url.pop(i)
i+=1
client_url = new_url[0]
time.sleep(5)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question