mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2025-12-28 11:45:19 +01:00
Minor fixes to adapter_asianfanficscom.
This commit is contained in:
parent
48a3955147
commit
118371b819
3 changed files with 70 additions and 26 deletions
|
|
@ -1864,6 +1864,47 @@ continue_on_chapter_error:true
|
|||
## Site dedicated to these categories/characters/ships
|
||||
extracategories:Star Trek
|
||||
|
||||
[www.asianfanfics.com]
|
||||
## Some sites require login (or login for some rated stories) The
|
||||
## program can prompt you, or you can save it in config. In
|
||||
## commandline version, this should go in your personal.ini, not
|
||||
## defaults.ini.
|
||||
#username:YourName
|
||||
#password:yourpassword
|
||||
|
||||
## Some sites also require the user to confirm they are adult for
|
||||
## adult content. In commandline version, this should go in your
|
||||
## personal.ini, not defaults.ini.
|
||||
#is_adult:true
|
||||
|
||||
## Additional metadata entries.
|
||||
extra_valid_entries:tags,characters,upvotes,subscribers,views
|
||||
tags_label:Tags
|
||||
characters_label:Characters
|
||||
upvotes_label:Upvotes
|
||||
subscribers_label:Subscribers
|
||||
views_label:Views
|
||||
|
||||
include_in_category:tags
|
||||
|
||||
#extra_titlepage_entries:upvotes,subscribers,views
|
||||
|
||||
## This is a workaround to replace AFF's abbreviated chapter titles
|
||||
## present in chapter list. Uncomment this to remove the usual,
|
||||
## shorter chapter title.
|
||||
#chapter_start:<?xml version="1.0" encoding="UTF-8"?>
|
||||
# <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
# <html xmlns="http://www.w3.org/1999/xhtml">
|
||||
# <head>
|
||||
# <title>${chapter}</title>
|
||||
# <link href="stylesheet.css" type="text/css" charset="UTF-8" rel="stylesheet"/>
|
||||
# <meta name="chapterurl" content="${url}"></meta>
|
||||
# <meta name="chapterorigtitle" content="${origchapter}"></meta>
|
||||
# <meta name="chaptertoctitle" content="${tocchapter}"></meta>
|
||||
# <meta name="chaptertitle" content="${chapter}"></meta>
|
||||
# </head>
|
||||
# <body>
|
||||
|
||||
[www.asexstories.com]
|
||||
## Some sites also require the user to confirm they are adult for
|
||||
## adult content. Uncomment by removing '#' in front of is_adult.
|
||||
|
|
|
|||
|
|
@ -23,12 +23,13 @@ class AsianFanFicsComAdapter(BaseSiteAdapter):
|
|||
BaseSiteAdapter.__init__(self, config, url)
|
||||
|
||||
self.decode = ["utf8",
|
||||
"Windows-1252"] # 1252 is a superset of iso-8859-1.
|
||||
# Most sites that claim to be
|
||||
# iso-8859-1 (and some that claim to be
|
||||
# utf8) are really windows-1252.
|
||||
|
||||
|
||||
"Windows-1252"] # 1252 is a superset of
|
||||
# iso-8859-1. Most sites that
|
||||
# claim to be iso-8859-1 (and
|
||||
# some that claim to be utf8)
|
||||
# are really windows-1252.
|
||||
|
||||
|
||||
self.username = ""
|
||||
self.password = ""
|
||||
self.is_adult=False
|
||||
|
|
@ -76,7 +77,7 @@ class AsianFanFicsComAdapter(BaseSiteAdapter):
|
|||
else:
|
||||
params['username'] = self.getConfig("username")
|
||||
params['password'] = self.getConfig("password")
|
||||
|
||||
|
||||
params['from_url'] = url
|
||||
params['csrf_aff_token'] = data.split('input type="hidden" name="csrf_aff_token" value="')[1].split('"')[0]
|
||||
loginUrl = 'https://' + self.getSiteDomain() + '/login/check'
|
||||
|
|
@ -139,7 +140,7 @@ class AsianFanFicsComAdapter(BaseSiteAdapter):
|
|||
## Title
|
||||
a = soup.find('h1', {'id': 'story-title'})
|
||||
self.story.setMetadata('title',stripHTML(a))
|
||||
|
||||
|
||||
# Find authorid and URL from... author url.
|
||||
alist = soup.find('div', {'class': 'main-meta__sec'})
|
||||
alist = alist.find('span', text='Author(s)')
|
||||
|
|
@ -194,18 +195,18 @@ class AsianFanFicsComAdapter(BaseSiteAdapter):
|
|||
a = a.find('span',text='Characters')
|
||||
if a:
|
||||
self.story.addToList('characters', a.nextSibling)
|
||||
|
||||
|
||||
# published on
|
||||
a = soup.find('span', text='Published')
|
||||
a = a.parent.find('time')
|
||||
self.story.setMetadata('datePublished', makeDate(a['datetime'], self.dateformat))
|
||||
|
||||
|
||||
# updated on
|
||||
a = soup.find('span', text='Updated')
|
||||
if a:
|
||||
a = a.parent.find('time')
|
||||
self.story.setMetadata('dateUpdated', makeDate(a['datetime'], self.dateformat))
|
||||
|
||||
|
||||
# upvote, subs, and views
|
||||
a = soup.find('div',{'class':'title-meta'})
|
||||
spans = a.findAll('span', recursive=False)
|
||||
|
|
@ -213,7 +214,7 @@ class AsianFanFicsComAdapter(BaseSiteAdapter):
|
|||
self.story.addToList('subscribers', re.search('\(([^)]+)', spans[1].find('span').text).group(1))
|
||||
if enumerate(spans) == 2: # views can be private
|
||||
self.story.addToList('views', spans[2].find('span').text.split()[0])
|
||||
|
||||
|
||||
# cover art in the form of a div before chapter content
|
||||
if get_cover:
|
||||
cover_url = ""
|
||||
|
|
@ -243,4 +244,4 @@ class AsianFanFicsComAdapter(BaseSiteAdapter):
|
|||
raise exceptions.FailedToDownload("Error downloading Chapter: %s! Missing required element!" % url)
|
||||
|
||||
if None == soup:
|
||||
raise exceptions.FailedToDownload("Error downloading Chapter: %s! Missing required element!" % url)
|
||||
raise exceptions.FailedToDownload("Error downloading Chapter: %s! Missing required element!" % url)
|
||||
|
|
|
|||
|
|
@ -1907,19 +1907,21 @@ include_in_category:tags
|
|||
|
||||
#extra_titlepage_entries:upvotes,subscribers,views
|
||||
|
||||
## This is a workaround to replace AFF's abbreviated chapter titles present in chapter list
|
||||
chapter_start:<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>${chapter}</title>
|
||||
<link href="stylesheet.css" type="text/css" charset="UTF-8" rel="stylesheet"/>
|
||||
<meta name="chapterurl" content="${url}"></meta>
|
||||
<meta name="chapterorigtitle" content="${origchapter}"></meta>
|
||||
<meta name="chaptertoctitle" content="${tocchapter}"></meta>
|
||||
<meta name="chaptertitle" content="${chapter}"></meta>
|
||||
</head>
|
||||
<body>
|
||||
## This is a workaround to replace AFF's abbreviated chapter titles
|
||||
## present in chapter list. Uncomment this to remove the usual,
|
||||
## shorter chapter title.
|
||||
#chapter_start:<?xml version="1.0" encoding="UTF-8"?>
|
||||
# <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
# <html xmlns="http://www.w3.org/1999/xhtml">
|
||||
# <head>
|
||||
# <title>${chapter}</title>
|
||||
# <link href="stylesheet.css" type="text/css" charset="UTF-8" rel="stylesheet"/>
|
||||
# <meta name="chapterurl" content="${url}"></meta>
|
||||
# <meta name="chapterorigtitle" content="${origchapter}"></meta>
|
||||
# <meta name="chaptertoctitle" content="${tocchapter}"></meta>
|
||||
# <meta name="chaptertitle" content="${chapter}"></meta>
|
||||
# </head>
|
||||
# <body>
|
||||
|
||||
[www.asexstories.com]
|
||||
## Some sites also require the user to confirm they are adult for
|
||||
|
|
|
|||
Loading…
Reference in a new issue