Skip to content

Commit

Permalink
update.
Browse files Browse the repository at this point in the history
  • Loading branch information
turbou committed Nov 28, 2023
1 parent 034be5d commit a1bdfa8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions work/java_support_tech.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import difflib
import shutil
import html
import hashlib

def main():
url = 'https://docs.contrastsecurity.jp/ja/java-supported-technologies.html'
Expand Down Expand Up @@ -37,7 +38,9 @@ def main():
pubdate = datetime.strptime(pubdate_str, '%B %d, %Y')
continue
id_str = elem.get("id")
id_hash = hashlib.md5(id_str.encode()).hexdigest()
url = 'https://docs.contrastsecurity.jp/ja/java-supported-technologies.html#%s' % id_str
guid = 'https://docs.contrastsecurity.jp/ja/java-supported-technologies.html#%s' % id_hash
title = elem.select_one('h2.title').text
text_buffer = []
for elem2 in elem.select('p'):
Expand All @@ -54,15 +57,15 @@ def main():
res_str = '\n'.join(res)
if (len(res_str.strip()) > 0):
print('Found diff: ', title)
item_dict[title] = (url, res_str)
item_dict[title] = (url, res_str, guid)
shutil.move('/files/%s.tmp' % title, '/files/%s.txt' % title)
except IndexError:
continue

if pubdate is None:
pubdate = datetime.date.today()
for k, v in item_dict.items():
feed.add_item(title=k, link=v[0], description=html.escape(''.join(['<p>{0}</p>'.format(s) for s in v[1].splitlines()])), pubdate=pubdate)
feed.add_item(title=k, link=v[0], description=''.join(['<p>{0}</p>'.format(s) for s in v[1].splitlines()]), pubdate=pubdate, unique_id=v[2])

if len(item_dict) > 0:
str_val = feed.writeString('utf-8')
Expand Down

0 comments on commit a1bdfa8

Please sign in to comment.