azhuge233/SteamDB-FreeGames

encoding error

6-- opened this issue · 3 comments

6-- commented

Hi,

Thanks for your great work!

I keep getting this error

2021-06-18 02:23:01,167 - SteamDB-FreeGames - ------------------- Start job -------------------
2021-06-18 02:23:01,167 - SteamDB-FreeGames - Loading previous records...
2021-06-18 02:23:01,183 - SteamDB-FreeGames - Done
2021-06-18 02:23:01,183 - SteamDB-FreeGames - Loading the page...
2021-06-18 02:23:11,327 - SteamDB-FreeGames - Done
2021-06-18 02:23:11,327 - SteamDB-FreeGames - Start processing data...
Traceback (most recent call last):
  File "C:\Users\Administrator\Desktop\SteamDB-FreeGames-master\app.py", line 163, in <module>
    main()
  File "C:\Users\Administrator\Desktop\SteamDB-FreeGames-master\app.py", line 157, in main
    start_process(previous=previous, db_free_page_soup=html)
  File "C:\Users\Administrator\Desktop\SteamDB-FreeGames-master\app.py", line 74, in start_process
    start_time = utc2cst(start_time)
  File "C:\Users\Administrator\Desktop\SteamDB-FreeGames-master\app.py", line 46, in utc2cst
    return cst_date.strftime("%Y 年 %m 月 %d 日 %H:%M")
UnicodeEncodeError: 'locale' codec can't encode character '\u5e74' in position 3: encoding error

Thanks for the feedback.
I've updated the code to fix this, I can't test it since the script is running fine on my computer, so please let me know if this works.
Instead of doing git pull, you can simply change the code at line 46

return cst_date.strftime("%Y 年 %m 月 %d 日 %H:%M")

to

return cst_date.strftime("%Y {y} %m {m} %d {d} %H:%M").format(y='年', m='月', d='日')
6-- commented

it worked!

Thanks a lot!

If its possible that we can also get the list of this site (shows all free games on few sites):
https://www.indiegamebundles.com/category/free/

I've never seen this site before, nice source to get free games, I'll look into it when I'm free.
I have another repository: EpicBundle-FreeGames, it scrapes EpicBundle Free Games Page, which is basically the same as https://www.indiegamebundles.com/category/free/. Quite similar to this repo, it sends notification through Telegram Bot too, you just need to fill the Bot Token and ChatID.