First of all, *** Reading meter information cannot be exported ***. It's clogged. thank you for your hard work.
However, the purpose of export *** is to extract past information ***, so it's okay if you can forcibly extract it for the time being. It feels like a pseudo-export (I'm not doing such a big deal).
I used to use a reading meter, but I thought it wasn't very convenient to use. I decided, "Better yet, let's manage and record readings with spreadsheets! ***".
The information I wanted *** was about the reading date, title, and author name of the book I read (+ α number of pages). I didn't write all my impressions, and I thought I wouldn't manage them in a spreadsheet, so I didn't need them (I wonder if I can record my impressions in a notebook or write them in a book keyword). Web scraping is also dull, and I feel like there is an easy way.
*** There was an easy way. *** ***
I was able to transfer the reading meter records to a spreadsheet ~.
--Environment: Python 3.7.4 --Reading meter information --Reading date --Title --Author name
This was a surprisingly blind spot. I had never used the "text only" function, but I thought "it's really usable!" *** The biggest point of this article ***. The rest is a copy. Easy victory. I think you can boil or bake with your creativity.
Sometimes there is one without information (image below). Sometimes the title and author name are in the same cell. Please correct as appropriate. I fixed it while running the program. That may be easier to understand.
For the time being, name it ʻinput.csv`.
I wrote it with brain death while watching the animation. I made it for myself so it's shit dirty. Please forgive me because it was a throw-away program that ended once I wrote it.
main.py
import csv
import pandas as pd
RESULT_CSV_TITLE = 'output.csv'
date_list = []
title_person_list = []
page_list = []
df = pd.DataFrame()
with open('input.csv', mode='r', encoding='utf-8') as f:
all_row = csv.reader(f)
for row in all_row:
#Remove whitespace and extra columns
if len(row) == 0 or row[0] == 'To edit':
continue
#date
try:
if 'Unknown date' in row[0] :
date_list.append(row[0])
continue
date_split = row[0].split('/')
year = date_split[0]
month = date_split[1]
day = date_split[2]
date_list.append(f'{year}/{month}/{day}')
continue
except:
pass
#page
try:
page = int(row[0])
page_list.append(page)
continue
except:
pass
#List of titles and authors
title_person_list.append(row[0])
title_list = title_person_list[::2]
person_list = title_person_list[::-2]
# print(len(date_list))
# print(len(page_list))
# print(len(title_list))
# print(len(person_list))
person_list.reverse()
df['date'] = date_list
df['title'] = title_list
df['Author'] = person_list
df['page'] = page_list
print(df)
df.to_csv(RESULT_CSV_TITLE, index=False)
Since I am looking at the result using PyCharm, it looks like the image shown below. It feels like the date, title, author name, and number of pages.
After that, please boil or bake. I copied all the contents of ʻoutput.csv` into a spreadsheet and separated them with commas.
*** If you don't understand anything about the program, please contact the DM at @yuki_imamura_ ***. I hope I can help you.
No, I've used a lot of reading management and recording apps, but they're all subtle. After all, it's better to manage it yourself with Google Spreadsheets.
I think that you can extract reading impressions by using web scraping (I have not seen the terms of service), but this time I did not need it, so I did it easily. If there is a person who absolutely needs it, I will make a program, so please skip it as well.
The number of pages is ... I wonder if I can use it as a motivation index.
So let's enjoy reading life to the fullest!
I hope it will be helpful for you.
-Reading Meter: Record the books you read and meet new ones -Google Spreadsheets Comma Separated Tips
Recommended Posts