diff options
author | Michele Calgaro <[email protected]> | 2023-01-14 16:34:44 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2023-01-15 10:25:12 +0900 |
commit | 900386ad4615a3dbbc04501ef24c5a43385c6078 (patch) | |
tree | e7c547f76f2100bd99be8962fe7a07c1a64d1c34 /knewsticker-scripts/fyensget.py | |
parent | 8293cbe18989cabc30375754087091a53a78b3ee (diff) | |
download | tdeaddons-900386ad4615a3dbbc04501ef24c5a43385c6078.tar.gz tdeaddons-900386ad4615a3dbbc04501ef24c5a43385c6078.zip |
Drop python2 support.r14.1.0
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'knewsticker-scripts/fyensget.py')
-rwxr-xr-x | knewsticker-scripts/fyensget.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/knewsticker-scripts/fyensget.py b/knewsticker-scripts/fyensget.py index d93e13a..bfdae96 100755 --- a/knewsticker-scripts/fyensget.py +++ b/knewsticker-scripts/fyensget.py @@ -15,7 +15,7 @@ ### along with this program; if not, write to the Free Software ### Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -import urllib, re,string +import urllib.request, urllib.parse, urllib.error, re,string ################################################################################ # Groups of interest @@ -29,7 +29,7 @@ articleBase = "http://www.fyens.dk/" # Query the sections ################################################################################ def readSections(): - FILE=urllib.urlopen(base+"Menu.php") + FILE=urllib.request.urlopen(base+"Menu.php") REG=re.compile("<a href=\"([^\"]*)\" target=\"Indhold\" class=\"Overskrift.\">(.*?)</a><br>") result=[] line=FILE.readline() @@ -46,20 +46,20 @@ def readSections(): # Fetch articles from a single section ################################################################################ def readSection( url, title ): - FILE=urllib.urlopen(base+url) + FILE=urllib.request.urlopen(base+url) REG=re.compile("<a href=\"([^\"]*)\" class=\"Overskrift.\">(.*?)</a>") line = FILE.readline() while line: match = REG.search(line) if match: - print "<item>\n\t<title>" + title + ": " +match.group(2) + "</title>" - print "\t<link>"+articleBase+match.group(1)+"</link>\n</item>" + print("<item>\n\t<title>" + title + ": " +match.group(2) + "</title>") + print("\t<link>"+articleBase+match.group(1)+"</link>\n</item>") line=FILE.readline() ################################################################################ # Print Header ################################################################################ -print """<?xml version="1.0" encoding="ISO-8859-1"?> +print("""<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd"> <rss version="0.91"> @@ -68,7 +68,7 @@ print """<?xml version="1.0" encoding="ISO-8859-1"?> <language>dk</language> <link>http://www.fyens.dk/</link> <description>Fyens Stiftstidende</description> -""" +""") ################################################################################ # Main @@ -81,8 +81,8 @@ for (url, title) in l: ################################################################################ # Print footer. ################################################################################ -print """ +print(""" </channel> </rss> -""" +""") |