Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
requests==2.23.0 # Make HTTP requests
beautifulsoup4==4.8.2 # Parse HTML responses
colorlog==4.1.0 # Extensive console logging
tqdm==4.43.0 # Progressbar for downloads
requests==2.31.0 # Make HTTP requests
beautifulsoup4==4.12.3 # Parse HTML responses
colorlog==6.8.2 # Extensive console logging
tqdm==4.66.1 # Progressbar for downloads
setuptools==69.0.3
10 changes: 5 additions & 5 deletions wikiraider/actions/ActionParse.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ def run(self):
colorlog.getLogger().info('In the meantime the consumers are already processing the pages...')

for xml_file in xml_files:
for event, element in xml.etree.cElementTree.iterparse(open(xml_file, 'r')):
for event, element in xml.etree.cElementTree.iterparse(open(xml_file, 'r', encoding='utf-8', errors='ignore')):
if element.tag.endswith('page'):
title = element.find('.//{http://www.mediawiki.org/xml/export-0.10/}title')
revision = element.find('.//{http://www.mediawiki.org/xml/export-0.10/}revision')
text = revision.find('.//{http://www.mediawiki.org/xml/export-0.10/}text')
title = element.find('.//{http://www.mediawiki.org/xml/export-0.11/}title')
revision = element.find('.//{http://www.mediawiki.org/xml/export-0.11/}revision')
text = revision.find('.//{http://www.mediawiki.org/xml/export-0.11/}text')

element.clear()

Expand All @@ -121,7 +121,7 @@ def on_finish(self):
colorlog.getLogger().info('Found a total of {} word(s).'.format(len(self.queue.results)))

if len(self.queue.results) >= 10:
colorlog.getLogger().info('Here are 10 of them {}.'.format(random.sample(self.queue.results, 10)))
colorlog.getLogger().info('Here are 10 of them {}.'.format(random.sample(list(self.queue.results), 10)))

colorlog.getLogger().info('Writing all words to a file...')
WriterHelper.write_to_txt(self.get_wiki_name(), self.queue.results)
Expand Down