Web Module
New in version 0.1.0.
Internet-related automation features that extend PyXA scripting functionality.
Classes:
|
An RSS feed reader. |
|
An item or entry in an RSS feed. |
|
The content of an RSS entry. |
|
|
|
- class PyXA.Additions.Web.RSSFeed(url: str | XAURL)[source]
Bases:
XAObject
An RSS feed reader.
New in version 0.1.0.
Methods:
items
()Retrieves all item and/or entry tags in the RSS feed as
RSSItem
objects.refetch
()Resends the GET request for the RSS feed URL and updates this object's data accordingly.
- items() RSSItemList [source]
Retrieves all item and/or entry tags in the RSS feed as
RSSItem
objects.- Returns:
The list of items and/or entries
- Return type:
- Example:
>>> import PyXA >>> reader = PyXA.RSSFeed("http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topsongs/limit=10/xml") >>> print(reader.items()) <<class 'PyXA.extensions.XAWeb.RSSItemList'>['Hold Me Closer - Elton John & Britney Spears', 'Only Ever Wanted - Timcast', "I Ain't Worried - OneRepublic", 'wait in the truck - HARDY & Lainey Wilson', 'Bring Me to Life - Evanescence', 'Running Up That Hill (A Deal with God) - Kate Bush', 'Beer With My Friends - Kenny Chesney & Old Dominion', 'American Pie (Full Length Version) - Don Mclean', 'She Had Me At Heads Carolina - Cole Swindell', 'You Proof - Morgan Wallen']>
New in version 0.1.0.
- refetch()[source]
Resends the GET request for the RSS feed URL and updates this object’s data accordingly.
- Example:
Get the top 10 songs on iTunes every hour
>>> import PyXA >>> from time import sleep >>> reader = PyXA.RSSFeed("http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topsongs/limit=10/xml") >>> while True: >>> reader.refetch() >>> print(reader.items()) >>> sleep(3600)
New in version 0.1.0.
- class PyXA.Additions.Web.RSSItem(properties)[source]
Bases:
XAObject
An item or entry in an RSS feed.
New in version 0.1.0.
Attributes:
The author of the entry
The category of the entry
The comments of the entry
The raw content of the entry
The copyright text of the entry
The description of the entry
The media idea enclosed in the entry
The hyperlink to the entry
The most recent publication date of the entry
The third-party source of the entry
All text within the entry (not just the description/content text!)
The title of the RSS entry
The raw XML of the entry
Methods:
links
()Retrieves the URL referenced by each link tag as a list of
XABase.XAURL
objects.- property author: str
The author of the entry
- property category: str
The category of the entry
- property comments: str
The comments of the entry
- property content: type
The raw content of the entry
- property copyright: str
The copyright text of the entry
- property description: str
The description of the entry
- property enclosure: str
The media idea enclosed in the entry
- property link: str | None
The hyperlink to the entry
- links() List[XAURL] [source]
Retrieves the URL referenced by each link tag as a list of
XABase.XAURL
objects.- Returns:
The list of link URLs
- Return type:
List[XABase.XAURL]
- Example:
>>> import PyXA >>> reader = PyXA.RSSFeed("http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topsongs/limit=10/xml") >>> item = reader.items()[0] >>> print(item.links()) [<<class 'PyXA.XABase.XAURL'>https://audio-ssl.itunes.apple.com/itunes-assets/AudioPreview122/v4/7a/24/60/7a246091-cef8-1df4-1435-a107ed3c6980/mzaf_8623157179635634843.plus.aac.p.m4a>, <<class 'PyXA.XABase.XAURL'>https://music.apple.com/us/album/hold-me-closer-single/1641082201?uo=2>, <<class 'PyXA.XABase.XAURL'>https://music.apple.com/us/album/hold-me-closer/1641082201?i=1641082205&uo=2>]
New in version 0.1.0.
- property publication_date: str | None
The most recent publication date of the entry
- property source: str
The third-party source of the entry
- property text: str
All text within the entry (not just the description/content text!)
- property title: str
The title of the RSS entry
- property xml: str
The raw XML of the entry
- class PyXA.Additions.Web.RSSItemContent(properties)[source]
Bases:
XAObject
The content of an RSS entry.
New in version 0.1.0.
Attributes:
The raw html of the content
The visible text of the content
Methods:
images
()Retrieves the image referenced by each image element as a list of
XABase.XAImage
objects.links
()Retrieves the URL referenced by each anchor element as a list of
XABase.XAURL
objects.- property html: str
The raw html of the content
- images() List[XAImage] [source]
Retrieves the image referenced by each image element as a list of
XABase.XAImage
objects.- Returns:
The list of images
- Return type:
List[XABase.XAImage]
- Example:
>>> import PyXA >>> reader = PyXA.RSSFeed("http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topsongs/limit=10/xml") >>> content = reader.items()[0].content >>> print(content.images()) [<PyXA.XABase.XAImage object at 0x10635ee80>, <PyXA.XABase.XAImage object at 0x10635ebb0>]
New in version 0.1.0.
- links() List[XAURL] [source]
Retrieves the URL referenced by each anchor element as a list of
XABase.XAURL
objects.- Returns:
The list of link URLs
- Return type:
List[XABase.XAURL]
- Example:
>>> import PyXA >>> reader = PyXA.RSSFeed("http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topsongs/limit=10/xml") >>> content = reader.items()[0].content >>> print(content.links()) [<<class 'PyXA.XABase.XAURL'>https://music.apple.com/us/album/hold-me-closer/1641082201?i=1641082205&uo=2>, <<class 'PyXA.XABase.XAURL'>https://music.apple.com/us/album/hold-me-closer/1641082201?i=1641082205&uo=2>, <<class 'PyXA.XABase.XAURL'>https://music.apple.com/us/album/hold-me-closer-single/1641082201?uo=2>, <<class 'PyXA.XABase.XAURL'>https://music.apple.com/us/artist/elton-john/54657?uo=2>, <<class 'PyXA.XABase.XAURL'>https://music.apple.com/us/genre/music-pop/id14?uo=2>]
New in version 0.1.0.
- property text: str
The visible text of the content
- class PyXA.Additions.Web.RSSItemContentList(properties)[source]
Bases:
XAList
Methods:
html
()Gets the raw HTML of each item in the list.
images
()Gets the images contained in each item of the list as
XABase.XAImage
objects.links
()Gets the links contained in each item of the list as
XABase.XAURL
objects.text
()Gets the text of each item in the list.
- html() List[str] [source]
Gets the raw HTML of each item in the list.
- Returns:
The list of HTML strings
- Return type:
List[str]
New in version 0.1.0.
- images() List[XAImage] [source]
Gets the images contained in each item of the list as
XABase.XAImage
objects.- Returns:
The list of links
- Return type:
List[XABase.XAImage]
New in version 0.1.0.
- links() List[XAURL] [source]
Gets the links contained in each item of the list as
XABase.XAURL
objects.- Returns:
The list of links
- Return type:
List[XABase.XAURL]
New in version 0.1.0.
- class PyXA.Additions.Web.RSSItemList(properties)[source]
Bases:
XAList
Methods:
author
()Gets the author of each item in the list.
category
()Gets the category of each item in the list.
comments
()Gets the comments of each item in the list.
content
()Gets the content of each item as
RSSItemContent
objects.Gets the copyright of each item in the list.
Gets the description of each item as
RSSItemContent
objects.Gets the enclosure of each item in the list.
link
()Gets the link of each item in the list.
links
()Gets the links contained in each item of the list as
XABase.XAURL
objects.Gets the publication date of each item in the list.
source
()Gets the source of each item in the list.
text
()Gets the text of each item in the list.
title
()Gets the title of each item in the list.
xml
()Gets the raw XML of each item in the list.
- author() List[str] [source]
Gets the author of each item in the list.
- Returns:
The list of RSS item authors
- Return type:
List[str]
New in version 0.1.0.
- category() List[str] [source]
Gets the category of each item in the list.
- Returns:
The list of RSS item categories
- Return type:
List[str]
New in version 0.1.0.
- comments() List[str] [source]
Gets the comments of each item in the list.
- Returns:
The list of RSS item comments
- Return type:
List[str]
New in version 0.1.0.
- content() RSSItemContentList [source]
Gets the content of each item as
RSSItemContent
objects.- Returns:
The list of item contents
- Return type:
New in version 0.1.0.
- copyright() List[str] [source]
Gets the copyright of each item in the list.
- Returns:
The list of RSS item copyrights
- Return type:
List[str]
New in version 0.1.0.
- description() RSSItemContentList [source]
Gets the description of each item as
RSSItemContent
objects.- Returns:
The list of item descriptions
- Return type:
New in version 0.1.0.
- enclosure() List[str] [source]
Gets the enclosure of each item in the list.
- Returns:
The list of RSS item enclosures
- Return type:
List[str]
New in version 0.1.0.
- link() List[str] [source]
Gets the link of each item in the list.
- Returns:
The list of RSS item links
- Return type:
List[str]
New in version 0.1.0.
- links() List[XAURL] [source]
Gets the links contained in each item of the list as
XABase.XAURL
objects.- Returns:
The list of links
- Return type:
List[XABase.XAURL]
New in version 0.1.0.
- publication_date() List[datetime] [source]
Gets the publication date of each item in the list.
- Returns:
The list of RSS item publication dates
- Return type:
List[datetime]
New in version 0.1.0.
- source() List[str] [source]
Gets the source of each item in the list.
- Returns:
The list of RSS item sources
- Return type:
List[str]
New in version 0.1.0.
- text() List[str] [source]
Gets the text of each item in the list.
- Returns:
The list of RSS item texts
- Return type:
List[str]
New in version 0.1.0.