예제 #1
0
파일: __init__.py 프로젝트: forestjiang/wet
    def login(self):
        response = fetch(
            "http://m.douban.com/"
        )

        set_cookie = response.getheader('Set-Cookie')
        self.cookies = sc2cs(set_cookie)

        self.session = response.getheader('location').split('=', 1)[-1]

        response = fetch(
            "http://m.douban.com/",
            data = {
                'form_email': self.username,
                'form_password': self.password,
                'redir': '',
                'user_login': '******',
                'session': self.session
            },
            headers = {
                'Referer': 'http://m.douban.com/',
                'Cookie': self.cookies,
            }
        )
        set_cookie = response.getheader('Set-Cookie')
        self.cookies += "; " + sc2cs(set_cookie)

        return response
예제 #2
0
파일: __init__.py 프로젝트: ifduyue/wet
    def login(self):
        response = fetch("http://m.facebook.com/")

        m = re.search('''name="post_form_id" value="([^"]+?)"''', response.body)
        self.post_form_id = m.group(1)

        response = fetch(
            "https://www.facebook.com/login.php?m=m&refsrc=http%3A%2F%2Fm.facebook.com%2F&refid=0",
            data={
                "lsd": "off",
                "charset_test": "€,´,€,´,水,Д,Є",
                "version": "1",
                "ajax": "1",
                "width": "1280",
                "pxr": "1",
                "email": self.username,
                "pass": self.password,
                "submit": "Log In",
                "post_form_id": self.post_form_id,
            },
            headers={"Referer": "http://m.facebook.com/"},
        )

        set_cookie = response.getheader("Set-Cookie")
        self.cookies = sc2cs(set_cookie)

        url = response.getheader("location")
        response = fetch(url, headers={"Referer": "http://m.facebook.com/", "Cookie": self.cookies})

        self.post_form_id = re.search('''name="post_form_id" value="([^"]+?)"''', response.body).group(1)
        self.fb_dtsg = re.search('''name="fb_dtsg" value="([^"]+?)"''', response.body).group(1)

        return response
예제 #3
0
def pub2fanfou(username, password, status):
    #获取表单token
    response = urlfetch.fetch(
        "http://m.fanfou.com/"
    )
    token = re.search('''name="token".*?value="(.*?)"''', response.body).group(1)
    
    #登录
    response = urlfetch.fetch(
        "http://m.fanfou.com/",
        data = {
            'loginname': username,
            'loginpass': password,
            'action': 'login',
            'token': token,
            'auto_login': '******',
        },
        headers = {
            "Referer": "http://m.fanfou.com/",
        }
    )
    
    #cookies
    cookies = urlfetch.sc2cs(response.getheader('Set-Cookie'))
    print cookies
    
    #获取表单token
    response = urlfetch.fetch(
        "http://m.fanfou.com/home",
        headers = {
            'Cookie': cookies,
            'Referer': "http://m.fanfou.com/home",
        }
    )
    token = re.search('''name="token".*?value="(.*?)"''', response.body).group(1)
    
    #发布状态
    response = urlfetch.fetch(
        "http://m.fanfou.com/",
        data = {
            'content': status,
            'token': token,
            'action': 'msg.post',
        },
        headers = {
            'Cookie': cookies,
            'Referer': "http://m.fanfou.com/home",
        }
    )
예제 #4
0
    def login(self):
        response = fetch("http://m.douban.com/")

        set_cookie = response.getheader('Set-Cookie')
        self.cookies = sc2cs(set_cookie)

        self.session = response.getheader('location').split('=', 1)[-1]

        response = fetch("http://m.douban.com/",
                         data={
                             'form_email': self.username,
                             'form_password': self.password,
                             'redir': '',
                             'user_login': '******',
                             'session': self.session
                         },
                         headers={
                             'Referer': 'http://m.douban.com/',
                             'Cookie': self.cookies,
                         })
        set_cookie = response.getheader('Set-Cookie')
        self.cookies += "; " + sc2cs(set_cookie)

        return response
예제 #5
0
    def login(self):
        response = fetch(
            'http://3g.renren.com/login.do?autoLogin=true',
            headers={'Referer': 'http://m.renren.com/'},
            data={
                'email': self.username,
                'password': self.password,
                'origURL': '',
                'login': '******',
            },
        )

        self.update_url = "http://3g.renren.com/status/wUpdateStatus.do?"
        self.update_url += response.getheader('location').split('?', 1)[-1]
        self.cookies = sc2cs(response.getheader('Set-Cookie'))

        return response
예제 #6
0
파일: __init__.py 프로젝트: ifduyue/wet
    def login(self):
        response = fetch("http://m.fanfou.com/")
        token = re.search('''name="token".*?value="(.*?)"''',
                          response.body).group(1)

        response = fetch("http://m.fanfou.com/",
                         data={
                             'loginname': self.username,
                             'loginpass': self.password,
                             'action': 'login',
                             'token': token,
                             'auto_login': '******',
                         },
                         headers={
                             "Referer": "http://m.fanfou.com/",
                         })
        set_cookie = response.getheader('Set-Cookie')
        self.cookies = sc2cs(set_cookie)
        return response.body
예제 #7
0
    def login(self):
        response = fetch("http://m.facebook.com/")

        m = re.search('''name="post_form_id" value="([^"]+?)"''',
                      response.body)
        self.post_form_id = m.group(1)

        response = fetch(
            "https://www.facebook.com/login.php?m=m&refsrc=http%3A%2F%2Fm.facebook.com%2F&refid=0",
            data={
                'lsd': 'off',
                'charset_test': "€,´,€,´,水,Д,Є",
                'version': '1',
                'ajax': '1',
                'width': '1280',
                'pxr': '1',
                'email': self.username,
                'pass': self.password,
                'submit': 'Log In',
                'post_form_id': self.post_form_id,
            },
            headers={
                'Referer': 'http://m.facebook.com/',
            })

        set_cookie = response.getheader('Set-Cookie')
        self.cookies = sc2cs(set_cookie)

        url = response.getheader('location')
        response = fetch(
            url,
            headers={
                'Referer': 'http://m.facebook.com/',
                'Cookie': self.cookies,
            },
        )

        self.post_form_id = re.search(
            '''name="post_form_id" value="([^"]+?)"''', response.body).group(1)
        self.fb_dtsg = re.search('''name="fb_dtsg" value="([^"]+?)"''',
                                 response.body).group(1)

        return response
예제 #8
0
파일: __init__.py 프로젝트: forestjiang/wet
    def login(self):
        response = fetch(
            'http://3g.renren.com/login.do?autoLogin=true',
            headers = {
                'Referer': 'http://m.renren.com/'
            },
            data = {
                'email': self.username,
                'password': self.password,
                'origURL': '',
                'login': '******',
            },
        )

        self.update_url = "http://3g.renren.com/status/wUpdateStatus.do?"
        self.update_url += response.getheader('location').split('?', 1)[-1]
        self.cookies = sc2cs(response.getheader('Set-Cookie'))
        
        return response
예제 #9
0
파일: __init__.py 프로젝트: forestjiang/wet
 def login(self):
     response = fetch(
         "http://m.fanfou.com/"
     )
     token = re.search('''name="token".*?value="(.*?)"''', response.body).group(1)
     
     response = fetch(
         "http://m.fanfou.com/",
         data = {
             'loginname': self.username,
             'loginpass': self.password,
             'action': 'login',
             'token': token,
             'auto_login': '******',
         },
         headers = {
             "Referer": "http://m.fanfou.com/",
         }
     )
     set_cookie = response.getheader('Set-Cookie')
     self.cookies = sc2cs(set_cookie)
     return response.body