Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ fanfiction.Scraper.get_story_metadata(story_id)
* **num_follows** [int]
* **num_words** [int]: Total number of words in all chapters of the story
* **rated** [str]: The story's fiction rating. i.e. K, K+, T, M
* **summary** [str]: The summary (or description) of the work.

```
fanfiction.Scraper.scrape_story(story_id, keep_html=False)
Expand Down
4 changes: 3 additions & 1 deletion fanfiction/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def scrape_story_metadata(self, story_id):
metadata_text = metadata_div.find(class_='xgray xcontrast_txt').text
metadata_parts = metadata_text.split('-')
genres = self.get_genres(metadata_parts[2].strip())
summary = soup.find("div",{"class":"xcontrast_txt"}).text
metadata = {
'id': story_id,
'canon_type': pre_story_links[0].text,
Expand All @@ -68,7 +69,8 @@ def scrape_story_metadata(self, story_id):
'updated': int(times[0]['data-xutime']),
'published': int(times[1]['data-xutime']),
'lang': metadata_parts[1].strip(),
'genres': genres
'genres': genres,
'summary': summary
}
for parts in metadata_parts:
parts = parts.strip()
Expand Down