我试图在python中编写一个脚本,登录http://insta.friendorfollow.com/
并获取没有关注的人员列表.我想使用"请求模块",到目前为止我做了很多尝试,没有运气.我的代码如下:
import requests, re f = open('file', 'w') r = requests.get('http://insta.friendorfollow.com/') next_url = re.findall(ur'> f, g.text
有人可以告诉我我做错了什么吗?什么是正确的方式来做到这一点.一个脚本将非常感激.
一切都很好,
#!/usr/bin/env python username = "username" password = "password" from selenium import webdriver from selenium.webdriver.common.keys import Keys import re driver = webdriver.PhantomJS() driver.get("http://insta.friendorfollow.com") driver.find_elements_by_tag_name("a")[1].click() print "Perimene file....".upper() driver.find_element_by_name('username').send_keys(username) driver.find_element_by_name('password').send_keys(password) driver.find_element_by_class_name("button-green").click() try: driver.find_elements_by_name("allow")[1].click() except: pass f = open(username+".txt", 'w') malakes = re.findall(ur'data-id=\"([0-9]*)\"', driver.page_source)[::-1] for malakas in malakes: print >> f, malakas f.close() driver.quit()