takker-privateに新聞記事を移すscript
面倒なのでやめた
/icons/done.icon移動は全て完了している
Scriptの実装
/icons/Python.iconをつかう
04:01:23 できた
code:script.py
import json
with open('takker-memex.json') as json_data:
page_data = json.load(json_data)
newspaper_data = {'pages': [page for page in page_data'pages' print(f'Got {len(newspaper_data"pages")} pages') with open('output.json', 'w') as output:
json.dump(newspaper_data, output, indent=4, ensure_ascii=False)
04:33:44 #nikkei_scrapから検索するver.
code:script2.py
import json
import re
nikkei_scraps = []
with open('nikkei_scrap.json') as json_data:
page_data = json.load(json_data)
with open('takker-memex.json') as json_data:
page_data = json.load(json_data)
newspaper_data = {'pages': [page for page in page_data'pages' if (page'title' in nikkei_scraps) and re.search('日本経済新聞|NIKKEI|日経', page'title')]} print(f'Got {len(newspaper_data"pages")} pages') with open('output.json', 'w') as output:
json.dump(newspaper_data, output, indent=4, ensure_ascii=False)