Wir haben der zuvor erstellten [* Ich habe mit Python * eine App für die Benachrichtigung über Netznachrichten erstellt] eine 2-Kanal-Post-Benachrichtigungsfunktion hinzugefügt (http://qiita.com/NoB__G/items/5be8a927d804bbb57c06).
Fügen Sie der zuletzt erstellten Net News-Benachrichtigungsanwendung eine Funktion zum Benachrichtigen von Posts über 2-Kanal-Threads hinzu. Ziel-Threads, die nicht oft gepostet werden, aber überprüft werden sollen. Das Benachrichtigungslayout entspricht dem der Netto-Nachrichtenbenachrichtigung.
・ Darstellung bei Benachrichtigung (klicken Sie auf das Symbol, um zum Ziel-Thread zu springen)

・ Ohne Benachrichtigung auf Lager

Eine Liste der Nachrichten-Flash-Threads (Abneigungen) in Python abrufen.
Erstellt in allen 2 Schritten
mdfmonitor.py
def _get_text(self, url):
    try:
        l=[]
        if (url.find("blog.esuteru") >= 0): 
            title = urladrs = icon = []
            for line in requests.get(url).iter_lines():
                # get title
                if line.find("<h2>") >= 0:
                    title = re.sub(".*html\">", "", line)
                    title = re.sub("</a>.*", "", title)
                # get url 
                if line.find("<h2>") >= 0:
                    urladrs = re.sub(".*href=\"", "", line)
                    urladrs = re.sub("\">.*", "", urladrs)
                # get icon
                if re.search("<img src=.* class=\"pict.*\"", line):
                    icon = re.sub("\s.*<a.*img src=\"", "", line)
                    icon = re.sub("\" width.*", "", icon)
                if title and urladrs and icon:
                    l.append([title, urladrs, icon])
                    title = urladrs = icon = []
        elif (url.find("2ch.sc") >= 0): 
            for line in requests.get(url).iter_lines():
                if re.search("<dt>.*<br>", line):
                    comment = re.sub("<dt>.*<dd>", "", line)
                    comment = re.sub(" <br> ", " ", comment)
                    comment = re.sub("<br><br>", "", comment)
                    comment = re.sub("<a href=.*gt;", ">>", comment)
                    comment = re.sub("</a>", "", comment)
                    comment =  unicode(comment, "cp932", 'ignore')
                    comment =  comment.encode('utf-8')
                    l.append([comment, url, "http://www.2ch.sc/img/2ch-logo-fix.gif"])
        return l
    except requests.exceptions.ConnectionError:
        raise ConnectionError("Monitor can't connect the server of url you added.")
newsmoniter.py
tmp $ diff -u org/newsmoniter.py new/newsmoniter.py 
--- org/newsmoniter.py	2015-01-28 22:14:51.000000000 +0900
+++ new/newsmoniter.py	2015-01-28 22:14:32.000000000 +0900
@@ -9,10 +9,15 @@
 
 # append file to mdfmonitor instance
 monitor.add_url("http://blog.esuteru.com")
+monitor.add_url("http://nozomi.2ch.sc/test/read.cgi/pcqa/1419898591/l50")
 
 for mdf in monitor.monitor():
     for title, urladrs, icon in mdf.diff:
-        cmd = "/usr/local/bin/terminal-notifier -title new! -message \"{0}\" -open {1} -sound Submarine -appIcon {2}".format(title, urladrs, icon)
+        if (mdf.url.find("2ch.sc") >= 0):
+            sitename = "2 Kanal"
+        else:
+            sitename = "Entwurf Hachima"
+        cmd = "/usr/local/bin/terminal-notifier -title {0} -message \"{1}\" -open {2} -sound Submarine -appIcon {3}".format(sitename, title, urladrs, icon)
         f2 = open("/usr/local/bin/news_cmd.sh", "w")
         f2.write(cmd)
         os.chmod("/usr/local/bin/news_cmd.sh", 0777)
Portieren Sie dieses Tool auf Pfeffer und zeigen Sie neue Artikel auf Ihrem Brusttablett an. Lassen Sie auch Pfeffer die Nachricht sprechen.
・ OS X Mavericks 10.9.5 ・ Python 2.7.5 ・ Terminal-Notifier 1.6.1