简体   繁体   English

如何直接从 Instagram 收集链接。 Python + Selenium

[英]How to collect links from Instagram direct. Python + Selenium

I need to collect links of all chats in the instagram directory.我需要收集 instagram 目录中所有聊天的链接。 My idea is this - you need to write code in order to scroll through the entire direct to the bottom and collect links in parallel.我的想法是这样的——您需要编写代码才能直接滚动到底部并并行收集链接。 But I do not know how to do it correctly, I tried with javaScript but I am very clueless about it.但我不知道如何正确地做到这一点,我试过 javaScript 但我对此一无所知。 I thought maybe I can somehow catch on to the scroll- bar and then write '"click_and_hold("PAGE_DOWN")'" but I don't know how to cling to it, in general, tell me how to implement it.我想也许我可以以某种方式抓住滚动条然后写“click_and_hold(”PAGE_DOWN")'”但我不知道如何坚持它,一般来说,告诉我如何实现它。 My last try: xpath to the div'y responsible for the chat block.我最后一次尝试:xpath 给负责聊天块的 div'y。

direct_general_list = browser.find_element_by_xpath("/html/body/div[1]/section/div/div[2]/div/div/div[1]/div[3]/div")
            while True:
                direct_general_list.send_keys(Keys.PAGE_DOWN)
                time.sleep(1)
general_path_block = browser.find_element_by_xpath("/html/body/div[1]/section/div/div[2]/div/div/div[1]/div[3]/div/div/div")
        while True:
            browser.execute_script("arguments[0].scrollTop = arguments[0].scrollTop + arguments[0].offsetHeight;", general_path_block)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 selenium python 从动态网站中检索所有链接 - How to Retrieve all links from a dynamic website with selenium python Python 收集链接后面的 URL - Python Collect URLS behind Links 如何从Twitter实体获得直接的Instagram链接? - How can I get an direct Instagram link from a twitter entity? 如何从分页指令angularjs隐藏直接页面链接? - how to hide direct page links from Pagination Directive angularjs? 无法访问 Python Selenium 中的 Instagram 帖子标题 - Trouble accessing Instagram post caption in Python Selenium 从网站调用直接图像链接以获取功能 - Call direct image links from website for a function 如何使用 Python 和 Beautiful-soup 从 Instagram 抓取标签 - How to use Python and Beautiful-soup to scrape tags from Instagram 如何使用硒从网页获取链接 - How to get links from web page using selenium 在 Instagram 更改其 API 流程后,如何使用 Python 使用 Selenium 刮取 Instagram? 我无法找到所有条目,只能找到 12 个 - How to scrape Instagram using Python using Selenium after Instagram changed their API process? I'm unable to find all the entries, can only find 12 在Python中使用Selenium进行屏幕抓取:由Javascript构建的链接 - Screen scraping with Selenium in Python: links constructed by Javascript
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM