

<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>LINE &#8211; Max的程式語言筆記</title>
	<atom:link href="https://stackoverflow.max-everyday.com/tag/line/feed/" rel="self" type="application/rss+xml" />
	<link>https://stackoverflow.max-everyday.com</link>
	<description>我要當一個豬頭，快樂過每一天</description>
	<lastBuildDate>Tue, 10 Jul 2018 13:01:08 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://stackoverflow.max-everyday.com/wp-content/uploads/2017/02/max-stackoverflow-256.png</url>
	<title>LINE &#8211; Max的程式語言筆記</title>
	<link>https://stackoverflow.max-everyday.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>LINE 貼圖網址傳回的資料分析</title>
		<link>https://stackoverflow.max-everyday.com/2017/02/line-mobile-broswer-header/</link>
					<comments>https://stackoverflow.max-everyday.com/2017/02/line-mobile-broswer-header/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Sun, 26 Feb 2017 08:40:17 +0000</pubDate>
				<category><![CDATA[Dropboxlike開發筆記]]></category>
		<category><![CDATA[電腦相關應用]]></category>
		<category><![CDATA[LINE]]></category>
		<category><![CDATA[macOS]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Windows]]></category>
		<guid isPermaLink="false">http://stackoverflow.max-everyday.com/?p=280</guid>

					<description><![CDATA[測試，使用 curl header: curl ...]]></description>
										<content:encoded><![CDATA[<p>測試，使用 curl header:</p>
<pre>curl http://line.me/R/shop/detail/8072</pre>
<p>傳回結果：</p>
<pre>&lt;html&gt;
&lt;head&gt;&lt;title&gt;302 Found&lt;/title&gt;&lt;/head&gt;
&lt;body bgcolor="white"&gt;
&lt;center&gt;&lt;h1&gt;302 Found&lt;/h1&gt;&lt;/center&gt;
&lt;hr&gt;&lt;center&gt;nginx&lt;/center&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-281" src="https://stackoverflow.max-everyday.com/wp-content/uploads/2017/02/Screenshot-2017-02-26-16.19.26.jpg" alt="" width="1144" height="334" /></p>
<hr />
<p>&nbsp;</p>
<p>測試 iOS 平台 Header</p>
<pre>curl -v -H 'User-Agent: Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10' http://line.me/R/shop/detail/8072</pre>
<p>執行結果：</p>
<pre>&lt;!DOCTYPE html&gt;
&lt;html dir="ltr"&gt;
&lt;head&gt;
&lt;meta charset="UTF-8"&gt;
&lt;meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1"&gt;
&lt;title&gt;LINE&lt;/title&gt;
&lt;link rel="stylesheet" href="//scdn.line-apps.com/n/line_urlscheme/css/line_urlscheme_1464238694.css"&gt;
&lt;script src="//scdn.line-apps.com/n/line_urlscheme/js/lc.line.scheme_1464238694.js"&gt;&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;!--CONTENTS-AREA--&gt;
&lt;div class="LyContents" role="main"&gt;
&lt;section class="MdCMN01Cont"&gt;
&lt;p class="mdCMN01Desc"&gt;
Open the LINE app to continue.

&lt;/p&gt;
&lt;div class="mdCMN01Img"&gt;&lt;img src="//scdn.line-apps.com/n/line_urlscheme/img/img_line_160830.png" alt="LINE" width="75" height="75"&gt;&lt;/div&gt;
&lt;div class="mdCMN01Btn"&gt;
&lt;button type="button" class="MdBtn03Gn01" id="jsLaunchApp" data-href="line://shop/detail/8072"&gt; Open LINE App
&lt;/button&gt;
&lt;button type="button" class="MdBtn03Gr01" id="jsInstallApp" data-href="itms-apps://itunes.apple.com/app/line-for-ipad/id913855602"&gt; Download LINE App
&lt;/button&gt;
&lt;/div&gt;
&lt;/section&gt;
&lt;!--/LyContents--&gt;&lt;/div&gt;
&lt;!--/CONTENTS-AREA--&gt;
&lt;!--/SCRIPT--&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<hr />
<p>測試 Android 平台 Header:</p>
<pre>curl -H 'User-Agent: Mozilla/5.0 (Linux; U; Android 4.1.1; en-gb; Build/KLP) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30' http://line.me/R/shop/detail/8072</pre>
<p>取得結果：</p>
<pre>&lt;!DOCTYPE html&gt;
&lt;html dir="ltr"&gt;
&lt;head&gt;
&lt;meta charset="UTF-8"&gt;
&lt;meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1"&gt;
&lt;title&gt;LINE&lt;/title&gt;
&lt;link rel="stylesheet" href="//scdn.line-apps.com/n/line_urlscheme/css/line_urlscheme_1464238694.css"&gt;
&lt;script src="//scdn.line-apps.com/n/line_urlscheme/js/lc.line.scheme_1464238694.js"&gt;&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;!--CONTENTS-AREA--&gt;
&lt;div class="LyContents" role="main"&gt;
&lt;section class="MdCMN01Cont"&gt;
&lt;p class="mdCMN01Desc"&gt;
Open the LINE app to continue.

&lt;/p&gt;
&lt;div class="mdCMN01Img"&gt;&lt;img src="//scdn.line-apps.com/n/line_urlscheme/img/img_line_160830.png" alt="LINE" width="75" height="75"&gt;&lt;/div&gt;
&lt;div class="mdCMN01Btn"&gt;
&lt;button type="button" class="MdBtn03Gn01" id="jsLaunchApp" data-href="intent://shop/detail/8072#Intent;scheme=line;action=android.intent.action.VIEW;category=android.intent.category.BROWSABLE;package=jp.naver.line.android;end"&gt; Open LINE App
&lt;/button&gt;
&lt;button type="button" class="MdBtn03Gr01" id="jsInstallApp" data-href="market://details?id=jp.naver.line.android"&gt; Download LINE App
&lt;/button&gt;
&lt;/div&gt;
&lt;/section&gt;
&lt;!--/LyContents--&gt;&lt;/div&gt;
&lt;!--/CONTENTS-AREA--&gt;
&lt;!--/SCRIPT--&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<hr />
<p>Mobile Browser會將所有與 User Agent(簡稱 UA)相關的資訊包含在User Agent String裡（平台、OS、瀏覽器、版本等），除了可以使用javascript偵測User Agent String裡的關鍵字，也可以在Web Server 上處理。</p>
<p>熱門行動的裝置的User Agent String:</p>
<p>iPad:</p>
<blockquote><p>Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10</p></blockquote>
<p>iPhone:</p>
<blockquote><p>Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16</p></blockquote>
<p>Chrome for Android Phone:</p>
<blockquote><p>Mozilla/5.0 (Linux; &lt;Android Version&gt;; &lt;Build Tag etc.&gt;) AppleWebKit/&lt;WebKit Rev&gt; (KHTML, like Gecko) Chrome/&lt;Chrome Rev&gt; Mobile Safari/&lt;WebKit Rev&gt;</p></blockquote>
<p>Chrome for Android Tablet UA:</p>
<blockquote><p>Mozilla/5.0 (Linux; &lt;Android Version&gt;; &lt;Build Tag etc.&gt;) AppleWebKit/&lt;WebKit Rev&gt;(KHTML, like Gecko) Chrome/&lt;Chrome Rev&gt; Safari/&lt;WebKit Rev&gt;</p></blockquote>
<ul>
<li><strong>Phone pattern:</strong> <code>'Android' + 'Chrome/[.0-9]* Mobile'</code></li>
<li><strong>Tablet pattern:</strong> <code>'Android' + 'Chrome/[.0-9]* (?!Mobile)'</code></li>
</ul>
<hr />
<p>電腦版 Chrome 41.0.2228.0 在 Windows 的 User Agent string:</p>
<p>Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36</p>
<p>電腦版 Chrome 在 Mac OS X 的 User Agent string:</p>
<p>Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36</p>
<p>&nbsp;</p>
<p>相關文章：History of the browser user-agent string<br />
為什麼瀏覽器 user-agent string 總是包含 Mozilla/5.0 ?<br />
<a href="http://webaim.org/blog/user-agent-string-history/">http://webaim.org/blog/user-agent-string-history/</a></p>
<p>下指令：<br />
curl -v -H &#8216;User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36&#8217; http://line.me/R/shop/detail/8072</p>
<p>執行結果：</p>
<pre> &lt; HTTP/1.1 302 Moved Temporarily
 &lt; Server: nginx
 &lt; Date: Thu, 02 Mar 2017 20:23:57 GMT
 &lt; Content-Type: text/html
 &lt; Content-Length: 154
 &lt; Connection: keep-alive
 &lt; Location: http://line.me
 &lt; Cache-Control: no-cache</pre>
<p>網址移動到 http://line.me , 應該是不支援的意思。</p>
<p>&nbsp;</p>
<h4>結論：</h4>
<ul>
<li>Android系統的行動裝置幾乎都有“Android”字眼，且多搭配webkit引擎的瀏覽器，所以可用這兩者作為關鍵字。</li>
<li>而Apple產品的User Agent String幾乎都包含iPhone字眼。</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2017/02/line-mobile-broswer-header/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>[Android] 實作LINE Login，增加按鈕到PreferenceFragment</title>
		<link>https://stackoverflow.max-everyday.com/2016/08/add-buttons-to-preferencefragment/</link>
					<comments>https://stackoverflow.max-everyday.com/2016/08/add-buttons-to-preferencefragment/#respond</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Tue, 02 Aug 2016 16:47:06 +0000</pubDate>
				<category><![CDATA[Android筆記]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[BOT]]></category>
		<category><![CDATA[LINE]]></category>
		<category><![CDATA[UI]]></category>
		<guid isPermaLink="false">http://stackoverflow.max-everyday.com/?p=56</guid>

					<description><![CDATA[在實作 LINE Login 時，送出要切換 c...]]></description>
										<content:encoded><![CDATA[<p>在實作 LINE Login 時，送出要切換 channel 從 developing 為 published 的申請，LINE 官方回email說需要在畫面上看到 LINE Loing 的 button, 由於是把 line login 放在  perferencefragment裡，但是很久很久以前在實作 PreferenceFragment 時, 發現沒有 button 可以用, 無法做設定參數以外的事情,很久以前的解法是要分成2個 xml 檔案，或同一個xml 放2個 layout，解決完的畫面如下:</p>
<p><a href="http://max-everyday.com/wp-content/uploads/2016/08/Screenshot_2014-10-15-19-30-41.png"><img decoding="async" class="alignnone wp-image-1065 size-medium" src="http://max-everyday.com/wp-content/uploads/2016/08/Screenshot_2014-10-15-19-30-41-500x500.png" alt="Screenshot_2014-10-15-19-30-41" width="500" height="500" /></a></p>
<p>在研究了一下 <a href="https://github.com/haiwen/seadroid">seafile</a> 的作法，他也沒有解決這個問題，可能是沒有這個需求，seafile 的作法在是 layout/preference_list_fragment.xml 裡放多個 layout, listview 的部份留給 preference fragment 使用。</p>
<hr />
<p>我發現，照著 solar/<a href="https://gist.github.com/solar/1002049/">IconPreference.java</a> 使用的範例，可以做出 button preference 也可以在程式碼裡動態地修改 button 裡的文字。解決完的畫面如下:</p>
<p><a href="http://max-everyday.com/wp-content/uploads/2016/08/Screenshot_2016-08-03-03-37-03_com.miui_.home_.png"><img decoding="async" class="alignnone wp-image-1066 size-medium" src="http://max-everyday.com/wp-content/uploads/2016/08/Screenshot_2016-08-03-03-37-03_com.miui_.home_-281x500.png" alt="Screenshot_2016-08-03-03-37-03_com.miui.home" width="281" height="500" /></a></p>
<p>只是，比較特別的是 Fragment 裡的 ListView 用來顯示 Preference, Preference 被建立後 protected void onBindView(View view) 的時間點在 Fragment onCreate() 或  Fragment 的 onCreateView 之後，所以無法直接塞 onClick 事件給自定設定的 ButtonPreference 來使用，解法是把要做的事件先放到 新建立的ButtonPreference 裡，等 ButtonPreference 在 onBindView 後，並存取到 button 時，再用 setOnClickListener() 來執行該方法。</p>
<p>從畫面可以看到，原本有button 的應該長的像他上面那行，用Facebook 登入，是用文字。會想挑戰這個解法是因為 LINE Developer 回信給我，說「LINE Login」 的按鈕，規格不符。於是我就從<a href="https://developers.line.me/web-login/setting-up-login-button">網頁版</a>下載了圖片＋文字來用，但很怪，LINE 他們只提供了&#8221;Log In&#8221; 的多國語言字串，卻沒提供 Log Out 的。</p>
<p>整組程式都寫好，最後要送出申請為「已發佈」(Published) 被 LINE 的人打搶，被打搶的Email:</p>
<figure id="attachment_2286" aria-describedby="caption-attachment-2286" style="width: 1344px" class="wp-caption alignnone"><a href="http://max-everyday.com/wp-content/uploads/2016/08/Screenshot-2017-01-04-17.21.45.jpg"><img loading="lazy" decoding="async" class="wp-image-2286 size-full" src="http://max-everyday.com/wp-content/uploads/2016/08/Screenshot-2017-01-04-17.21.45.jpg" width="1344" height="1156" /></a><figcaption id="caption-attachment-2286" class="wp-caption-text">Request was reject by our review criteria.</figcaption></figure>
<p>Facebook login 和 LINE Login 相比：</p>
<ul>
<li>Facebook在設定開發者的憑證(Android Package Signature) 上面比LINE 方便，可以同時設定 developing ／released 的碼.</li>
<li>Facebook 使用者多。</li>
<li>Facebook 允許developer 拿到 user 公開的 id, photo 和 email, LINE 不能拿到公開 LINE ID。</li>
<li>Facebook 的 status 從 developing 切換到 published 不需要「先」通過人工審核，切換一下很快，所有的人都可以存取我們的App，並立即取得facebook 帳號的授權。</li>
<li>比較特別的是當使用我們facebook App 的人多了，facebook 會寄通知信來，要求在 facebook 的設定裡增加隱私權的宣告，那也很簡單，網路上有很多產生獸，點一點就完成了。</li>
</ul>
<hr />
<h4>相關網址：</h4>
<ul>
<li><a href="https://developers.line.me/line-login/overview">https://developers.line.me/line-login/overview</a></li>
<li><a href="https://developers.line.me/web-login/setting-up-login-button">https://developers.line.me/web-login/setting-up-login-button</a></li>
<li><a href="https://developers.line.me/channel-console/publish-app">https://developers.line.me/channel-console/publish-app<br />
</a>Every Channel has a status. To publish your application, you must change the status of your Channel to PUBLISHED.</li>
<li>[Android]實作Facebook login<br />
<a href="http://max-everyday.com/2016/09/android-facebook-login/">http://max-everyday.com/2016/09/android-facebook-login/</a></li>
<li>關於LineBot(7) &#8211; 使用Line Login實現oAuth SSO(單一登入)<br />
<a href="http://studyhost.blogspot.tw/2016/12/linebot7-line-loginoauth-sso.html">http://studyhost.blogspot.tw/2016/12/linebot7-line-loginoauth-sso.html</a></li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2016/08/add-buttons-to-preferencefragment/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>用python 檢查LINE ID 是不是存在</title>
		<link>https://stackoverflow.max-everyday.com/2016/07/python-line-bot-find-userid/</link>
					<comments>https://stackoverflow.max-everyday.com/2016/07/python-line-bot-find-userid/#comments</comments>
		
		<dc:creator><![CDATA[max-stackoverflow]]></dc:creator>
		<pubDate>Fri, 29 Jul 2016 17:20:32 +0000</pubDate>
				<category><![CDATA[Python筆記]]></category>
		<category><![CDATA[BOT]]></category>
		<category><![CDATA[LINE]]></category>
		<category><![CDATA[Python]]></category>
		<guid isPermaLink="false">http://stackoverflow.max-everyday.com/?p=84</guid>

					<description><![CDATA[我想知道某一個 LINE ID, 是不是存在的，...]]></description>
										<content:encoded><![CDATA[<p>我想知道某一個 LINE ID, 是不是存在的，研究了LINE官方的 LINE BOT:<br />
<a href="https://developers.line.me/restful-api/overview">https://developers.line.me/restful-api/overview</a></p>
<p>發現並對我而言，官方目前提供的API我都用不到，這些API似乎是開放給一般的公司行號用，針對LINE官方的BOT這一篇寫的還不錯：</p>
<p>[教學] Line BOT API<br />
<a href="http://huli.logdown.com/posts/726082-line-bot-api-tutorial">http://huli.logdown.com/posts/726082-line-bot-api-tutorial</a></p>
<hr />
<h4>相關文章：</h4>
<p>用 LINE API 打造自動回話機器人-2015/8/24更新<br />
<a href="https://www.mxp.tw/2015/04/30/%E7%94%A8-line-api-%E6%89%93%E9%80%A0%E8%87%AA%E5%8B%95%E5%9B%9E%E8%A9%B1%E6%A9%9F%E5%99%A8%E4%BA%BA/">https://www.mxp.tw/2015/04/30/%E7%94%A8-line-api-%E6%89%93%E9%80%A0%E8%87%AA%E5%8B%95%E5%9B%9E%E8%A9%B1%E6%A9%9F%E5%99%A8%E4%BA%BA/</a></p>
<p>Python Line API<br />
<a href="http://dev.im-bot.com/line/">http://dev.im-bot.com/line/</a></p>
<p>韓國神人 Taehoon Kim 的 LINE BOT：<a href="https://github.com/carpedm20/LINE"><br />
https://github.com/carpedm20/LINE</a></p>
<p>Documentation : <a href="http://carpedm20.github.io/line/">http://carpedm20.github.io/line/</a><br />
Developer Mailing List: <a href="https://groups.google.com/forum/#!forum/line-python-developer">Google Group</a></p>
<p>使用 LINE API 傳送訊息，但目前仍有 authToken 時間過期問題<br />
<a href="http://ssorc.tw/5907">http://ssorc.tw/5907</a></p>
<p>[心得] Cacti+Line群組告警<br />
<a href="https://www.ptt.cc/bbs/MIS/M.1414213987.A.7EF.html">https://www.ptt.cc/bbs/MIS/M.1414213987.A.7EF.html</a></p>
<p>但是最新版的程式被LINE公司要求移除一些code所以無法使用賬號密碼登入<br />
只能用authtoken登入,所以我們改用舊版一點的程式<br />
<a href="https://pypi.python.org/pypi/line/0.0.8">https://pypi.python.org/pypi/line/0.0.8</a></p>
<p>一些被刪掉的code, 在 0.0.8 版裡找的到。目前我是用 <a href="https://pypi.python.org/pypi/line">0.8.0</a> 版。</p>
<p>切換到 0.0.8 或是 <a href="https://pypi.python.org/pypi/line/0.7.1">0.7.1</a> 或是 0.8.0 都有不同的問題要決解。</p>
<ul>
<li>首先第1步要解決的登入問題，新版沒辦法登入，無法跑出要求手機輸入驗證碼，我是用 0.7.1 的 code, 讓驗證碼顯示到手機上。</li>
<li>接著是取得 access token，這個我也是用 0.7.1 或 用 <a href="https://pypi.python.org/pypi/line/0.5.2">0.5.2</a> 都可以。</li>
<li>最後，是要從 0.0.8 版取得部份被刪除的程式碼到 0.8.0 版來用。</li>
</ul>
<hr />
<p>我遇到的問題，和下面這篇文章遇到的問題一樣：</p>
<p>why make private method ? some thing like _findContactByUserid() in client.py<br />
<a href="https://groups.google.com/forum/#!searchin/line-python-developer/userid/line-python-developer/9b0MuBlkozs/4-M8hRQXBgAJ">https://groups.google.com/forum/#!searchin/line-python-developer/userid/line-python-developer/9b0MuBlkozs/4-M8hRQXBgAJ</a></p>
<hr />
<p>I got the same error in this method:</p>
<p><a href="http://max-everyday.com/wp-content/uploads/2016/07/Screen-Shot-2016-07-30-at-04.51.17.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-1047" src="http://max-everyday.com/wp-content/uploads/2016/07/Screen-Shot-2016-07-30-at-04.51.17.jpg" alt="Screen Shot 2016-07-30 at 04.51.17" width="958" height="198" /></a><br />
Error: maximum recursion depth exceeded</p>
<p>I fixed this error by copy findContactByUserid as a new method in client.py, api.py, CurveThrift.py</p>
<p>I add new debug code to print message in CurveThrift.py in method:<br />
def findContactByUserid(self, userid):</p>
<p>but the result is code not be executed, after copy exist code to new method the new method is executed!<br />
after fix, userid could be search:</p>
<p><a href="http://max-everyday.com/wp-content/uploads/2016/07/Screen-Shot-2016-07-30-at-04.55.32.jpg"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-1046" src="http://max-everyday.com/wp-content/uploads/2016/07/Screen-Shot-2016-07-30-at-04.55.32-1024x355.jpg" alt="Screen Shot 2016-07-30 at 04.55.32" width="740" height="257" /></a></p>
<p>修改好後，就可以查 LINE ID 了，查失敗的結果會是有專門的 exception:</p>
<p>Error: Cannot find userid: XXX</p>
<hr />
<p>你可能會問，我怎麼知道要改這些行？ 因為我一直在try error 和看作者的 source code, trace 再 trace, 看了好幾個小時了, 還是看不懂作者在寫什麼東西，還好加 debug code 來 print 很簡單，初學者都會。</p>
<p>遇把作者 github 上的 issue, commit history, google group 上的討論看了一輪，結論：沒什麼幫助。</p>
<hr />
<p>結合 line id 的 database，並連結上 line server 進行 userid 的檢查：</p>
<p><a href="http://max-everyday.com/wp-content/uploads/2016/07/Screenshot-2016-07-30-18.38.19.jpg"><img loading="lazy" decoding="async" class="alignnone wp-image-1051 size-medium" src="http://max-everyday.com/wp-content/uploads/2016/07/Screenshot-2016-07-30-18.38.19-474x500.jpg" alt="Screenshot 2016-07-30 18.38.19" width="474" height="500" /></a></p>
<p>LINE BOT 就完成了，真感動，真的是 May the LINE be with you&#8230;</p>
<hr />
<p>上面的方法，已經不能用了，python 程式是對的可以用，但中間的 library 聽說需要調整才行。</p>
<p>接著出現的解法是透過 QR code 登入：<br />
LineVodka<br />
<a href="https://github.com/merkremont/LineVodka">https://github.com/merkremont/LineVodka</a></p>
<p>上面解法只適用到 2017年11月，LINE官方的伺服器修改了相關的程式碼，目前會顯示這個錯誤：</p>
<pre>File "/LineVodka/LineAlpha/LineThrift/TalkService.py", line 3490, in recv_getLastOpRevision
raise result.e
LineAlpha.LineThrift.ttypes.TalkException: TalkException(parameterMap=None, reason='LOG_OUT', code=8)</pre>
<hr />
<p>另一個解法，使用LINE 官方的 BOT API：</p>
<p>這個限制是，BOT最多只能服務50個人，超過的話要付費。</p>
<p><a href="https://pypi.org/project/line-bot-sdk/">https://pypi.org/project/line-bot-sdk/</a></p>
<p>這個要先 create a channel：<br />
<a href="https://developers.line.me/en/docs/line-login/getting-started/">https://developers.line.me/en/docs/line-login/getting-started/</a></p>
<p>Integrating LINE Login with your web app<br />
<a href="https://developers.line.me/en/docs/line-login/web/integrate-line-login/">https://developers.line.me/en/docs/line-login/web/integrate-line-login/</a></p>
<p>相關教學：</p>
<ul>
<li>邦妮教學：連結 LINE@ 帳號<br />
<a href="https://medium.com/botbonnie/%E9%82%A6%E5%A6%AE%E6%95%99%E5%AD%B8-%E9%80%A3%E7%B5%90-line-%E5%B8%B3%E8%99%9F-75ec33791f4e">https://medium.com/botbonnie/%E9%82%A6%E5%A6%AE%E6%95%99%E5%AD%B8-%E9%80%A3%E7%B5%90-line-%E5%B8%B3%E8%99%9F-75ec33791f4e</a></li>
<li>LINE BOT 實戰 ( 原理篇 )<br />
<a href="http://www.oxxostudio.tw/articles/201701/line-bot.html">http://www.oxxostudio.tw/articles/201701/line-bot.html</a><br />
<a href="http://www.oxxostudio.tw/articles/201701/line-bot-2.html">http://www.oxxostudio.tw/articles/201701/line-bot-2.html</a></li>
</ul>
<hr />
<p>看看新的 line-py:</p>
<p><a href="https://github.com/fadhiilrachman/line-py">https://github.com/fadhiilrachman/line-py</a></p>
<p>目前 bot，會造成帳號的部份功能被ban:</p>
<p>Sometimes administrators regulate your account. The best workaround is don&#8217;t use api or don&#8217;t be bad user like kicker. If you want to avoid it but want to use api too, please see below list.</p>
<h2><a id="user-content-rules" class="anchor" href="https://github.com/Dosugamea/l-api-tips/wiki/Account-Regulatory#rules" aria-hidden="true"></a>Rules</h2>
<ul>
<li>Talk Regulatory
<ul>
<li>Happen when you send too many messages.</li>
</ul>
</li>
<li>AddContact Regulatory
<ul>
<li>Happen when you add too many contacts in a day.</li>
</ul>
</li>
<li>Group Change Regulatory
<ul>
<li>Happen when you Invite,Kickout,Change Name,Change Invite Link too many times.</li>
</ul>
</li>
<li>Timeline Post Regulatory
<ul>
<li>Happen when you made a too many posts in a time.</li>
</ul>
</li>
<li>Timeline Comment Regulatory
<ul>
<li>Happen when you made a too many comments in a time.</li>
</ul>
</li>
</ul>
<h2><a id="user-content-if-got-regulatory" class="anchor" href="https://github.com/Dosugamea/l-api-tips/wiki/Account-Regulatory#if-got-regulatory" aria-hidden="true"></a>If got Regulatory</h2>
<p>It can login, but some features can&#8217;t use. For example, Talk Regulatory, Messages are undelivered.<br />
Usually take a from 3 days to 1 week to get unban.(maybe)<br />
If banned for more than 1 week, you will have to recreate an account.</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://stackoverflow.max-everyday.com/2016/07/python-line-bot-find-userid/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>
