mirror of https://github.com/MISP/misp-galaxy
Add [cluster] authors
parent
3ece11b87f
commit
04c07e4774
|
@ -1,5 +1,16 @@
|
||||||
{
|
{
|
||||||
"authors": "Wikipedia",
|
"authors": [
|
||||||
|
"Graham87",
|
||||||
|
"Frietjes",
|
||||||
|
"Narky Blert",
|
||||||
|
"Pkbwcgs",
|
||||||
|
"Girth Summit",
|
||||||
|
"InternetArchiveBot",
|
||||||
|
"AnomieBOT",
|
||||||
|
"GreenMeansGo",
|
||||||
|
"MusikBot",
|
||||||
|
"Trappist the monk"
|
||||||
|
],
|
||||||
"category": "Intelligence Agencies",
|
"category": "Intelligence Agencies",
|
||||||
"description": "List of intelligence agencies",
|
"description": "List of intelligence agencies",
|
||||||
"name": "Intelligence Agencies",
|
"name": "Intelligence Agencies",
|
||||||
|
|
|
@ -155,6 +155,7 @@ if __name__ == '__main__':
|
||||||
else:
|
else:
|
||||||
print(f'Error: {content}')
|
print(f'Error: {content}')
|
||||||
|
|
||||||
|
authors = [x['name'] for x in wiki.get_authors(page_title)]
|
||||||
# Write to files
|
# Write to files
|
||||||
galaxy = Galaxy(
|
galaxy = Galaxy(
|
||||||
description="List of intelligence agencies",
|
description="List of intelligence agencies",
|
||||||
|
@ -168,7 +169,7 @@ if __name__ == '__main__':
|
||||||
galaxy.save_to_file(os.path.join(GALAXY_PATH, f'{GALAXY_NAME}.json'))
|
galaxy.save_to_file(os.path.join(GALAXY_PATH, f'{GALAXY_NAME}.json'))
|
||||||
|
|
||||||
cluster = Cluster(
|
cluster = Cluster(
|
||||||
authors="Wikipedia",
|
authors=authors,
|
||||||
category="Intelligence Agencies",
|
category="Intelligence Agencies",
|
||||||
description="List of intelligence agencies",
|
description="List of intelligence agencies",
|
||||||
name="Intelligence Agencies",
|
name="Intelligence Agencies",
|
||||||
|
|
|
@ -51,6 +51,22 @@ class WikipediaAPI():
|
||||||
response = requests.get(self.base_url, params=params)
|
response = requests.get(self.base_url, params=params)
|
||||||
data = response.json()
|
data = response.json()
|
||||||
return data['parse']['text']['*']
|
return data['parse']['text']['*']
|
||||||
|
except Exception as e:
|
||||||
|
print(f'Error: {e}')
|
||||||
|
return None
|
||||||
|
|
||||||
|
def get_authors(self, page_title):
|
||||||
|
params = {
|
||||||
|
'action': 'query',
|
||||||
|
'format': 'json',
|
||||||
|
'titles': page_title,
|
||||||
|
'prop': 'contributors',
|
||||||
|
}
|
||||||
|
try:
|
||||||
|
response = requests.get(self.base_url, params=params)
|
||||||
|
data = response.json()
|
||||||
|
page_id = next(iter(data['query']['pages']))
|
||||||
|
return data['query']['pages'][page_id]['contributors']
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f'Error: {e}')
|
print(f'Error: {e}')
|
||||||
return None
|
return None
|
Loading…
Reference in New Issue