FandomPage class¶
- class fandom.FandomPage(wiki, language, title=None, pageid=None, redirect=True, preload=False)¶
Contains data from a fandom page. Uses property methods to filter data from the raw HTML.
Warning
Do not manually init fandom.FandomPage. Instead call
fandom.page()
.- Variables
title – The title of the page
pageid – The page id of the page
language – The language of the page
wiki – The wiki the page is on
url – The url to the page
- property content¶
Text content of each section of the page, excluding images, tables, and other data. The content is returned as dict, imitating the section and subsection structure of the page.
Note
If you just want the plain text of the page without the section structure, you can use FandomPage.plain_text
- Returns
- property plain_text¶
The plain text contents of a page.
Note
If you want the section and subsection structure of the page as well as the text, you can use FandomPage.content.
- Returns
- property revision_id¶
Revision ID of the page.
Note
The revision ID is a number that uniquely identifies the current version of the page. It can be used to create the permalink or for other direct API calls.
- Returns
- section(section_title: str)¶
Get the plain text content of a section from self.sections. Returns None if section_title isn’t found, otherwise returns a str.
Warning
When calling this function, subheadings in the section you asked for are part of the plain text. If you want more control of what data you get, you should use FandomPage.content