Fix Unofficial Line API Login.

自從 Line API 被 LINE 公司強制下架 carpedm20 自行逆向工程的 API,
使用該 API 必須一直使用 authToken 進行登入動作,但是有個快速解決方法。

$ pip install line && pip uninstall -y line  
$ git clone

然後進去 LINE/line 找到

line 58 裡面 ready 函數應該看起來是這樣

def ready(self):
    After login, make `client` and `client_in` instance
    to communicate with LINE server
    raise Exception("Code is removed because of the request of LINE corporation")

ready 函數整個覆蓋成下方這樣

def ready(self):
    #raise Exception("Code is removed because of the request of LINE corporation")

    self.transport    = THttpClient.THttpClient(self.LINE_HTTP_URL)
    self.transport_in = THttpClient.THttpClient(self.LINE_HTTP_IN_URL)


    self.protocol    = TCompactProtocol.TCompactProtocol(self.transport)
    self.protocol_in = TCompactProtocol.TCompactProtocol(self.transport_in)

    self._client    = CurveThrift.Client(self.protocol)
    self._client_in = CurveThrift.Client(self.protocol_in)


$ python
$ python install


附上一個簡單的 code 列出 群組數量 好友數量帳號 ID 的 Script, 僅供參考。

# -*- coding: utf-8 -*-
import line

def main():  
        client = line.LineClient("account", "password", com_name='Platform ID')
        #client = LineClient(authToken="AUTHTOKEN")
        print "Login Failed"

    print "Logged in."

    profile = client.profile
    print "Currently Profile Name Is %s" % profile

    contact_list = []
    contact_list = client.contacts
    print "Numbers of Friends : %s" % len(contact_list)

    group_list = []
    group_list = client.groups
    print "Numbers of Groups : %s" % len(group_list)   

if __name__ == '__main__':  

記得要把 Letter Sealing 關掉這樣就可以抓到 getRecentMessages 了。

Ghost Writer

There is nothing here.


Subscribe to In Th3nd

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!