Revision: 4202
Author: misza13
Date: 2007-09-06 17:15:47 +0000 (Thu, 06 Sep 2007)
Log Message:
-----------
Fix ImagePage.fileUrl() - image page looks slightly different for .ogg files.
Bypassing using negative lookahead (bogus "image link" has a
'class="image"' following it).
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2007-09-05 17:18:41 UTC (rev 4201)
+++ trunk/pywikipedia/wikipedia.py 2007-09-06 17:15:47 UTC (rev 4202)
@@ -2120,7 +2120,7 @@
# The part after the | is required for copying .ogg files from en:, as they do
not
# have a "full image link" div. This might change in the future; on
commons, there
# is a full image link for .ogg and .mid files.
- urlR = re.compile(r'<div class="fullImageLink"
id="file">.*?<a href="(?P<url>.+?)"|<span
class="dangerousLink"><a href="(?P<url2>.+?)"',
re.DOTALL)
+ urlR = re.compile(r'<div class="fullImageLink"
id="file">.*?<a href="(?P<url>[^ ]+?)"(?!
class="image")|<span class="dangerousLink"><a
href="(?P<url2>.+?)"', re.DOTALL)
m = urlR.search(self.getImagePageHtml())
try:
url = m.group('url') or m.group('url2')
Show replies by date