morss: remove deprecated twitter/fb link handling

master
pictuga 2020-05-13 12:31:09 +02:00
parent 91be2d229e
commit 68c46a1823
1 changed files with 2 additions and 28 deletions

View File

@ -217,36 +217,10 @@ def ItemFill(item, options, feedurl='/', fast=False):
if not item.link: if not item.link:
log('no link') log('no link')
return item return True
log(item.link) log(item.link)
link = item.link
# twitter
if urlparse(feedurl).netloc == 'twitter.com':
match = lxml.html.fromstring(item.desc).xpath('//a/@data-expanded-url')
if len(match):
link = match[0]
log(link)
else:
link = None
# facebook
if urlparse(feedurl).netloc == 'graph.facebook.com':
match = lxml.html.fromstring(item.content).xpath('//a/@href')
if len(match) and urlparse(match[0]).netloc != 'www.facebook.com':
link = match[0]
log(link)
else:
link = None
if link is None:
log('no used link')
return True
# download # download
delay = -1 delay = -1
@ -262,7 +236,7 @@ def ItemFill(item, options, feedurl='/', fast=False):
delay = 24*60*60 # 24h delay = 24*60*60 # 24h
try: try:
req = crawler.adv_get(url=link, delay=delay, timeout=TIMEOUT) req = crawler.adv_get(url=item.link, delay=delay, timeout=TIMEOUT)
except (IOError, HTTPException) as e: except (IOError, HTTPException) as e:
log('http error') log('http error')