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 |
1889 # TODO: RSS, extract links from page to implement RSS stuff |
1890 ## def checkRSS(self): |
1890 def checkRSS(self): |
1891 ## """ |
1891 """ |
1892 ## Public method to check, if the loaded page contains feed links. |
1892 Public method to check, if the loaded page contains feed links. |
1893 ## |
1893 |
1894 ## @return flag indicating the existence of feed links (boolean) |
1894 @return flag indicating the existence of feed links (boolean) |
1895 ## """ |
1895 """ |
1896 ## self.__rss = [] |
1896 self.__rss = [] |
1897 ## |
1897 |
|
1898 script = Scripts.getFeedLinks() |
|
1899 feeds = self.page().execJavaScript(script) |
|
1900 |
|
1901 for feed in feeds: |
|
1902 if feed["url"] and feed["title"]: |
|
1903 self.__rss.append((feed["title"], feed["url"])) |
1898 ## frame = self.page() |
1904 ## frame = self.page() |
1899 ## linkElementsList = frame.findAllElements("link").toList() |
1905 ## linkElementsList = frame.findAllElements("link").toList() |
1900 ## |
1906 ## |
1901 ## for linkElement in linkElementsList: |
1907 ## for linkElement in linkElementsList: |
1902 ## # only atom+xml and rss+xml will be processed |
1908 ## # only atom+xml and rss+xml will be processed |
1908 ## title = linkElement.attribute("title") |
1914 ## title = linkElement.attribute("title") |
1909 ## href = linkElement.attribute("href") |
1915 ## href = linkElement.attribute("href") |
1910 ## if href == "" or title == "": |
1916 ## if href == "" or title == "": |
1911 ## continue |
1917 ## continue |
1912 ## self.__rss.append((title, href)) |
1918 ## self.__rss.append((title, href)) |
1913 ## |
1919 |
1914 ## return len(self.__rss) > 0 |
1920 return len(self.__rss) > 0 |
1915 |
1921 |
1916 def getRSS(self): |
1922 def getRSS(self): |
1917 """ |
1923 """ |
1918 Public method to get the extracted RSS feeds. |
1924 Public method to get the extracted RSS feeds. |
1919 |
1925 |