ผมอยู่กับ Twitter มาเกือบปี ราวๆ 10 เดือน SMS เป็นสิ่งที่ทำให้ Twitter มีประโยชน์มากถึงมากที่สุด เจอประกาศหยุด SMS เมื่อเช้าทำเอานิ่งไปพักใหญ่ ใน getsatisfaction ก็บ่นกันยาว ใน search ก็ไม่ใช่น้อย ความจริงก็คือ ทุกคนคงใช้ SMS กันหมด แค่ 250 ข้อความต่อสัปดาห์มันเกินพอ ผมยังใช้ไม่เคยถึง 50 ด้วยซ้ำ แต่เนื่องจากคนใช้กันเยอะ เวลาจ่ายเนี่ย Twitter รับภาระคนเดียวล้วนๆ ซึ่งไม่ยุติธรรม ผมเห็นด้วยเต็มที่ เมื่อถึงเวลาก็ต้องหยุดให้บริการ และวันนี้ก็คือเวลานั้น
ใครควรรับผิดชอบค่าใช้จ่ายส่วนนี้?
It is not easy to use both Twitter and NokNok at the same time. My effort is noknok.py written in Python. That means you need basic knowledge to run Python or else it might be a kind of nightmare. @iake made noknok.exe based on noknok.py; however, you have to run it manually. If you forget to run, nothing happen.
Sadly, there is no official APIs for NokNok yet. Don't worry. Most of the time we don't need APIs. If there is noknok.py, it is possible to have more and more. Today the wait is over. SedThink is available to help you.
โค้ดคราวที่แล้วมีบั๊ก มีคนเจอด้วย นิดหน่อย ตกไปสองบรรทัด
diff --git a/noknok.py b/noknok.py index 82e260f..8c30159 100644 --- a/noknok.py +++ b/noknok.py @@ -199,6 +199,8 @@ Commands: runonce(self.nok, q, eval(query), since_id,self._save_since_id) def _save_since_id(self, since_id): + if not self.conf.has_section('twitter'): + self.conf.add_section('twitter') self.conf.set('twitter', 'since_id', str(since_id)) self.conf.write(open(self.options.config, 'w'))
ถ้าไม่ได้สร้างไฟล์ noknok.conf ไว้ตั้งแต่แรกก็อาจจะเจอปัญหาเล็กๆ น้อยๆตอนพยายามเขียน
diff --git a/noknok.py b/noknok.py index 8c30159..f7bb15a 100644 --- a/noknok.py +++ b/noknok.py @@ -151,7 +151,7 @@ Commands: command = self.args[0] else: command = 'twitterforever' - method = getattr(self, 'do_%s' % self.args[0]) + method = getattr(self, 'do_%s' % command) if not method: print 'unknown command' return
สคริปต์ noknok.py เมื่อวันก่อนทำเอาหลายคนกลายเป็นสแปม เพราะพยายามจะเอาไปรันใน cron ยกตัวอย่างเช่น @pruet คราวนี้เลยแก้ตัวใหม่ ใส่ไฟล์คอนฟิกให้อันนึง อย่างน้อยก็เอาไว้เก็บว่าเคย sync ถึงไหนแล้ว และแถมด้วยการติดตามเพื่อนทุกคนของคนที่ต้องการ
เนื่องจาก NokNok ยังไม่มี APIs ผมก็ขี้เกียจทำ regexp สุดท้ายเลยตัดสินใจใช้ XPath ของ lxml ซะเลย ดูเหมือนว่าจะไม่มี lxml บนวินโดส์ ยังไม่รู้จะแก้ปัญหาให้ยังไง คำแนะนำตอนนี้คือ ลงลินุกซ์