1884 |
1884 |
1885 ########################################################################### |
1885 ########################################################################### |
1886 ## RSS related methods below |
1886 ## RSS related methods below |
1887 ########################################################################### |
1887 ########################################################################### |
1888 |
1888 |
1889 # TODO: RSS, extract links from page to implement RSS stuff |
|
1890 def checkRSS(self): |
1889 def checkRSS(self): |
1891 """ |
1890 """ |
1892 Public method to check, if the loaded page contains feed links. |
1891 Public method to check, if the loaded page contains feed links. |
1893 |
1892 |
1894 @return flag indicating the existence of feed links (boolean) |
1893 @return flag indicating the existence of feed links (boolean) |
1899 feeds = self.page().execJavaScript(script) |
1898 feeds = self.page().execJavaScript(script) |
1900 |
1899 |
1901 for feed in feeds: |
1900 for feed in feeds: |
1902 if feed["url"] and feed["title"]: |
1901 if feed["url"] and feed["title"]: |
1903 self.__rss.append((feed["title"], feed["url"])) |
1902 self.__rss.append((feed["title"], feed["url"])) |
1904 ## frame = self.page() |
|
1905 ## linkElementsList = frame.findAllElements("link").toList() |
|
1906 ## |
|
1907 ## for linkElement in linkElementsList: |
|
1908 ## # only atom+xml and rss+xml will be processed |
|
1909 ## if linkElement.attribute("rel") != "alternate" or \ |
|
1910 ## (linkElement.attribute("type") != "application/rss+xml" and |
|
1911 ## linkElement.attribute("type") != "application/atom+xml"): |
|
1912 ## continue |
|
1913 ## |
|
1914 ## title = linkElement.attribute("title") |
|
1915 ## href = linkElement.attribute("href") |
|
1916 ## if href == "" or title == "": |
|
1917 ## continue |
|
1918 ## self.__rss.append((title, href)) |
|
1919 |
1903 |
1920 return len(self.__rss) > 0 |
1904 return len(self.__rss) > 0 |
1921 |
1905 |
1922 def getRSS(self): |
1906 def getRSS(self): |
1923 """ |
1907 """ |