JimmXinu / FanFicFare

FanFicFare is a tool for making eBooks from stories on fanfiction and other web sites.
Other
754 stars 161 forks source link

Bug with wuxiaworld adapter and python 3.7.3 #404

Closed ksurl closed 5 years ago

ksurl commented 5 years ago

errors out with date format returned from the site

fanficfare -d https://www.wuxiaworld.com/novel/sage-monarch
FFF: DEBUG: 2019-06-14 19:05:56,418: cli.py(184):     OS Version:Windows-10-10.0.18362-SP0
FFF: DEBUG: 2019-06-14 19:05:56,418: cli.py(185): Python Version:3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)]
FFF: DEBUG: 2019-06-14 19:05:56,419: cli.py(186):    FFF Version:3.8.0
FFF: DEBUG: 2019-06-14 19:05:56,442: adapter_wuxiaworldcom.py(81): URL: https://www.wuxiaworld.com/novel/sage-monarch
FFF: DEBUG: 2019-06-14 19:05:56,442: configurable.py(1114): #####################################
pagecache(GET) MISS: https://www.wuxiaworld.com/novel/sage-monarch
FFF: DEBUG: 2019-06-14 19:05:57,010: configurable.py(987): Encoding:utf8
FFF: DEBUG: 2019-06-14 19:05:57,467: adapter_wuxiaworldcom.py(91): {'@context': 'http://schema.org', '@type': 'Book', '@id': 'https://www.wuxiaworld.com/novel/sage-monarch', 'name': 'Sage Monarch', 'description': 'Yang Qi is a skilled fighter, but also has the reputation of being a hedonistic "silkpants". To impress a girl, he does something monumentally stupid, and ends up having his cultivation base crippled. Furthermore, his actions put his clan in...', 'image': 'https://cdn.wuxiaworld.com/images/covers/sm.jpg?ver=dd076ba3257184a4729477a2f8445d7e1ff575d9', 'potentialAction': {'@type': 'ReadAction', 'target': {'@type': 'EntryPoint', 'actionPlatform': ['http://schema.org/DesktopWebPlatform', 'http://schema.org/MobileWebPlatform'], 'urlTemplate': 'https://www.wuxiaworld.com/novel/sage-monarch/sm-chapter-1'}}, 'url': 'https://www.wuxiaworld.com/novel/sage-monarch', 'author': {'@type': 'Person', 'name': 'Deathblade'}, 'datePublished': '2019-02-08', 'publisher': {'@type': 'Organization', 'name': 'WuxiaWorld', 'logo': 'https://www.wuxiaworld.com/img/logo.png'}}
Traceback (most recent call last):
  File "C:\Users\username\AppData\Local\Programs\Python\Python37\Scripts\fanficfare-script.py", line 11, in <module>
    load_entry_point('FanFicFare==3.8.0', 'console_scripts', 'fanficfare')()
  File "c:\users\username\appdata\local\programs\python\python37\lib\site-packages\fanficfare\cli.py", line 290, in main
    passed_personalini)
  File "c:\users\username\appdata\local\programs\python\python37\lib\site-packages\fanficfare\cli.py", line 402, in do_download
    adapter.getStoryMetadataOnly()
  File "c:\users\username\appdata\local\programs\python\python37\lib\site-packages\fanficfare\adapters\base_adapter.py", line 287, in getStoryMetadataOnly
    self.doExtractChapterUrlsAndMetadata(get_cover=get_cover)
  File "c:\users\username\appdata\local\programs\python\python37\lib\site-packages\fanficfare\adapters\base_adapter.py", line 371, in doExtractChapterUrlsAndMetadata
    return self.extractChapterUrlsAndMetadata()
  File "c:\users\username\appdata\local\programs\python\python37\lib\site-packages\fanficfare\adapters\adapter_wuxiaworldcom.py", line 96, in extractChapterUrlsAndMetadata
    self.story.setMetadata('datePublished', self._parse_date(ld['datePublished']))
  File "c:\users\username\appdata\local\programs\python\python37\lib\site-packages\fanficfare\adapters\adapter_wuxiaworldcom.py", line 78, in _parse_date
    return makeDate(text, self._dateformat)
  File "c:\users\username\appdata\local\programs\python\python37\lib\site-packages\fanficfare\adapters\base_adapter.py", line 615, in makeDate
    date = datetime.strptime(string, dateform)
  File "c:\users\username\appdata\local\programs\python\python37\lib\_strptime.py", line 577, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "c:\users\username\appdata\local\programs\python\python37\lib\_strptime.py", line 359, in _strptime
    (data_string, format))
ValueError: time data '2019-02-08' does not match format '%Y-%m-%dT%H:%M:%S+00:00'
JimmXinu commented 5 years ago

Already fixed in 40e9d6014af12adffde4e0872665ba561e3b14b0

Either wait until the next release, or use the test version available here:

pip install --extra-index-url https://testpypi.python.org/pypi --upgrade FanFicFare