这个gist由torabot自动抓取并生成Atom feed.
注意: 公开你的cookie是一件危险的事情. 别人可能利用它来滥用你的Bangumi账户! Torabot的作者保证不会使用你的cookie做这个gist功能以外的事情. 如果你不信任torabot, 请忽略这个gist.
例子: http://torabot.com/api/source/34fd6a535090ca85a2fc.atom?chii_auth=<chii_auth_in_your_cookie>
import requests | |
from bs4 import BeautifulSoup as BS | |
import json | |
def gen(soup): | |
for tr in soup.select('tr'): | |
tds = tr.select('td.tdR4') | |
if len(tds) == 6: | |
yield tds[2].string, tds[3].string |
例子: http://torabot.com/api/source/f4b337c06bf746969244.atom?path=/group/topic/32268
把/group/topic/32268
换成你想要订阅的地址, 例如/subject/topic/4369
.
{ | |
"@jinja2": { | |
"template": {"text<": "replies.xml"}, | |
"kargs": { | |
"id": "{{ id }}", | |
"replies": { | |
"@json_decode": { | |
"@base64_decode": [{ | |
"[body]": {"@request": "http://www.v2ex.com/api/replies/show.json?topic_id={{ id }}"} | |
}] |
<feed xml:lang='zh-CN' xmlns='http://www.w3.org/2005/Atom'> | |
<id>v2ex.com/t/{{ id }}</id> | |
<link rel='alternate' type='text/html' href='http://v2ex.com/t/{{ id }}'/> | |
<title>{{ id }}</title> | |
{% for r in replies %} | |
{% if r.member.username != 'answeror' %} | |
<entry> | |
<id>{{ r.id }}</id> | |
<published>{{ datetime.fromtimestamp(r.created).strftime('%Y-%m-%dT%H:%M:%SZ') }}</published> | |
<updated>{{ datetime.fromtimestamp(r.last_modified).strftime('%Y-%m-%dT%H:%M:%SZ') }}</updated> |
这个gist可以用来订阅某个页面, 当该页面全文的md5 hash改变时, 输出的Atom feed会相应地更新. 例如订阅萝莉盟: http://rss.moe/api/source/f742582061a9b028987e?uri=http://www.loli.com/
你可以使用torabot的feed模块或者你喜欢的阅读器订阅上述链接.
<?xml version='1.0' encoding='UTF-8'?> | |
<xsl:stylesheet | |
version='1.0' | |
xmlns:xsl='http://www.w3.org/1999/XSL/Transform' | |
> | |
<xsl:output method='xml' encoding='UTF-8'/> | |
<xsl:template match='/'> | |
<feed xml:lang='en-US' xmlns='http://www.w3.org/2005/Atom'> | |
<id>nyc</id> | |
<link rel='alternate' type='text/html' href='http://www.nyc.gov/html/dot/html/home/home.shtml'/> |
<?xml version='1.0' encoding='UTF-8'?> | |
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> | |
<xsl:output method='xml' encoding='UTF-8'/> | |
<xsl:template match='/'> | |
<feed xml:lang='en-US' xmlns='http://www.w3.org/2005/Atom'> | |
<id>v2ex.com/member/{{ id }}</id> | |
<link rel='alternate' type='text/html' href='http://v2ex.com/member/{{ id }}'/> | |
<title>V2EX user replies of {{ id }}</title> | |
<xsl:for-each select='.//div[@class="dock_area"]'> | |
<entry> |