Skip to content

Commit c22c8f1

Browse files
committed
Support images with no author specified
1 parent e07dd38 commit c22c8f1

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

bot/text_parsers.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,15 @@ def get_image_information(site, title):
6868
parsed_text = mw.parse(page.text())
6969
wikicode = parsed_text.filter_templates()
7070

71+
author = None
72+
7173
for i in wikicode:
7274
try:
7375
item = i.get("author").value
7476
author = item.strip_code()
7577
break
7678
except ValueError:
7779
pass
78-
79-
try:
80-
item = i.get("Author").value
81-
author = item.strip_code()
82-
break
83-
except ValueError:
84-
author = None
8580

8681
source_link = f"https://commons.wikimedia.org/wiki/File:{title}".replace(" ", "_")
8782

0 commit comments

Comments
 (0)