Add support for twitter

Grabs "feed" from the html page, clips tweet and article together.
master
pictuga 2013-09-25 12:37:14 +02:00
parent da14242bcf
commit 0657077191
2 changed files with 19 additions and 0 deletions

11
feedify.ini 100644
View File

@ -0,0 +1,11 @@
[twitter]
path=
http://twitter.com/*
https://twitter.com/*
title= (//strong[class=search-query]|//span[class=screen-name])/text()
items= //div[class=tweet]
item_title= (.//span[class=username]//text())[2]
item_link= .//a[class=details]/@href
item_content= .//p[class=tweet-text]

View File

@ -304,6 +304,14 @@ def Fill(item, cache, feedurl='/', fast=False, clip=False):
link = item.link link = item.link
# twitter
if urlparse.urlparse(item.link).netloc == 'twitter.com':
match = lxml.html.fromstring(item.content).xpath('//a/@data-expanded-url')
if len(match):
link = match[0]
clip = True
log(link)
# check cache and previous errors # check cache and previous errors
if link in cache: if link in cache:
content = cache.get(link) content = cache.get(link)