parent
09868227db
commit
e92dc0c83a
|
@ -12,6 +12,7 @@ from PIL import ImageDraw
|
||||||
|
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
|
|
||||||
|
YEAR = "2017"
|
||||||
GALLERY_URL = "http://htt-phototeam.de/gallery.json"
|
GALLERY_URL = "http://htt-phototeam.de/gallery.json"
|
||||||
|
|
||||||
INPUT_RES = 1440
|
INPUT_RES = 1440
|
||||||
|
@ -36,7 +37,7 @@ def get_random_photo():
|
||||||
resp = requests.get(GALLERY_URL)
|
resp = requests.get(GALLERY_URL)
|
||||||
json = resp.json()
|
json = resp.json()
|
||||||
|
|
||||||
year = pick_random_key(json['photos'])
|
year = YEAR
|
||||||
photographer = pick_random_key(json['photos'][year])
|
photographer = pick_random_key(json['photos'][year])
|
||||||
category = pick_random_key(json['photos'][year][photographer])
|
category = pick_random_key(json['photos'][year][photographer])
|
||||||
|
|
||||||
|
|
13
rss.py
13
rss.py
|
@ -7,7 +7,7 @@ import feedparser
|
||||||
from lxml import html
|
from lxml import html
|
||||||
|
|
||||||
URLS_LIST = 'urls.lst'
|
URLS_LIST = 'urls.lst'
|
||||||
RSS_URL = 'http://www.hoellenberg-trophy.de/index.php?format=feed&type=rss'
|
RSS_URL = 'https://htt-spirkelbach.de/feed/'
|
||||||
|
|
||||||
def load_old_urls():
|
def load_old_urls():
|
||||||
urls = []
|
urls = []
|
||||||
|
@ -35,11 +35,12 @@ def get_new_items():
|
||||||
for item in sorted(rss.entries, key=lambda x: x.published_parsed):
|
for item in sorted(rss.entries, key=lambda x: x.published_parsed):
|
||||||
url = item.link
|
url = item.link
|
||||||
if not (url in old_urls):
|
if not (url in old_urls):
|
||||||
text = html.fromstring(item.description).text_content()
|
if len(item.description) > 0:
|
||||||
if len(text) > 1:
|
text = html.fromstring(item.description).text_content()
|
||||||
text = ' '.join(text.split())
|
if len(text) > 1:
|
||||||
new_items += [u'%s…\n%s' % (text[0:80], url)]
|
text = ' '.join(text.split())
|
||||||
old_urls += [url]
|
new_items += [u'%s…\n%s' % (text[0:80], url)]
|
||||||
|
old_urls += [url]
|
||||||
|
|
||||||
save_old_urls(old_urls)
|
save_old_urls(old_urls)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue