Dependent Origination

Archive for May 2020

It was my first time solving a programming related problem yesterday, in over six years since I retired 🙂

The problem is how to get all the comments of this post. It is a post about a sick monk who has been in ICU for over a week. The post is asking for prayers and messages for him. And it got 800+ comments. So we want all the comments out of Facebook so that they can be read to the monk.

First things first, we did it, and for free. Below you can find some main steps about how.

  1. Graph API Explorer is a very good tool.  Use it. Explore its functions. I got all the comments by using it.
  2. This Reddit post from two years ago helped me get started greatly. At least, it tells me that this is a task that can be finished with a single HTTP GET.  And it has an example link (https://graph.facebook.com/244944385603396_1599585250139296/Comments) that I can directly copy in the API explorer. Hope!
  3. Bummer! It didn’t work. However, by checking out the explorer interface, the focus was soon on access token.
  4. Now, the entire game is about how do you generate an access token that the API is happy to accept and then give you all the comments.
  5. Use the account that is the Page admin. Three blue dots, you can play with their contents to get the desired access token. Don’t forget to “generate a token” again any time you change something.
  6. The final selection: “Page Comments” (app name), “get_app_token” (token type), “pages_read_user_content” (permission)
  7. Now we got comments!
  8. But not all of them? Change the “limit” parameter (in the top left window of the API explorer).
  9. And you can even select fields that you want in the JSON results.

Other helpful notes.

  1. If I use the “user token” to get comments, I can only get comments made by me. It will tell me how many comments are out there, but it will only return those comments made by me. The debug message reads it is a privacy issue.
  2. Cannot get the commenters’ names or user_id’s. “from” field is grayed out. I figure it must be the design of the api only to return aggregate information, with no identifying power.
  3. How to get your post id? Click on the published time under the post in your feed. It will go to another page. The url has the post id. You can safely ignore those Google analytics fields after the post id.
  4. Use filter (stream) can return comments in chronological order. “summary” in chronological order probably won’t work as you want.
  5. limit = 1000 then we got all 800+ comments in one go. No need to do pagination.
  6. Huge amount of thanks to two error messages. One tells me that I need an app token to continue. This (and looking at the interface for a long time) made me realize that I can change app name and token type, so the game could keep on going. Another error message tells me that manage_pages is deprecated and leaves me a link in documentation to read about it. Reading the documentation (and looking at the error message and interface, back and forth, for a long time) made me realize I don’t need to change the token type from app token to page token, I only need to change the permission type. Two significant steps in figuring out the final parameters. Hooray for those who write error messages with a compassionate heart 🙂
  7. It is ok to feel frustrated along the way. But press on. I can do it. Just need to calm down and think. Or look at it, for a long time 🙂
  8. later command used to get the comments from JSON result: grep “message” comments_raw.txt | cut -d: -f2 > comments.txt
  9. user friendlier way: JSON -> CSV

在Netflix上面看的。讲三个highschool seniors。在高中的最后一年,彼此爱上了。。。一个是Chinese 移民 Ellie Chu(这就是老美电影里面的移民了,其实连这位移民姑娘她爸爸,我觉得估计都是ABC,哈哈),形象非常老套,其貌不扬,看起来没有什么sexual attraction,但是是个很感性,很爱思考人生重大问题的小姑娘。副业就是替本年级的其他那些学校的风头人物写各种class essays, book reports等等。很能写,可以就一个主题,同时交上六篇不同的文章来。

另外一个是高中的运动明星,特别典型的美国人。在这个华盛顿州的小镇出生成长,从来没去过其他任何地方。家里世代是做香肠的。有四个兄弟姐妹,他是老小。表面上笨笨的,说话也说不出来什么。爱上了本校第一美女,可是也只会说She is pretty, I like her laugh, She is different。很不擅言辞。但是其实逼急了说的可好了。比方说被Ellie逼着说出了自己为什么不去外地上大学。妈妈非常在乎这个外婆传下来的香肠生意。可是他的哥哥姐姐们都没兴趣。如果他不继续做,就没人做了。It is breaking either her heart or mine。在好几个类似的关键时刻,都是这个看起来四肢发达头脑简单的Paul讲出了直达人心的语言。

本来Paul是找Ellie来帮他写情书给Aster的。Aster是本校第一美女,相当地popular。男朋友也是本校最有风头的任务。可是Aster其实是一个蛮有性格的姑娘,很爱看书,虽然知道自己与众不同,可是却一直按照大家认为她应该是怎样的在生活,交男朋友,和其他美女们厮混。

总之,一开始的时候是Paul爱上了Aster,找了枪手Ellie来代写情书。但是在写情书的过程中,Ellie自己爱上了Aster,Paul爱上了Ellie。

影片开始的时候的一小段动画蛮好看的。人本来是两个头,四只手,四只脚很高兴地生活着。但是God一分为二,每个人都要花掉一生的时间去寻找自己的另外一半。假如找到了,就圆满,高兴,快乐到了顶点。最后的结尾?显然不再同意这个结论了。

关于what is love。还挺好看的。最后的结论稍微弱了一点,但是还是比大团圆好看多了。


May 2020
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

Twitter

Flickr Photos