Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

бобылев тимофей ат 20 #26

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
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
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/xmljson.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions belmondo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from urllib.request import urlopen
from json import loads
from itertools import groupby


url = 'https://ru.wikipedia.org/w/api.php?action=query&format=json&prop=revisions&rvlimit=500&titles=%D0%91%D0%B5%D0%BB%D1%8C%D0%BC%D0%BE%D0%BD%D0%B4%D0%BE,_%D0%96%D0%B0%D0%BD-%D0%9F%D0%BE%D0%BB%D1%8C'
data = loads(urlopen(url).read().decode('utf8'))
edits_data = groupby([edit['timestamp'][:10] for edit in data['query']['pages']['192203']['revisions']])


def find_max_edits(data_about_edits):
date = ''
max_edits = 0
for d, edits in data_about_edits:
count_edits = len(list(edits))
if max_edits < count_edits:
max_edits = count_edits
date = d
print(date, max_edits)


find_max_edits(edits_data)
"""
Дата смерти определилась правильно, но данной метрикой, пользоваться нельзя
т.к. в жизни может произойти множество событий, которые повлекут правки
(новая неожданная информация о человеке, раскрытие тайни и т.д.)
"""
17 changes: 17 additions & 0 deletions dradskiy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from urllib.request import urlopen
from json import loads
from itertools import groupby


url = 'https://ru.wikipedia.org/w/api.php?action=query&format=json&prop=revisions&rvlimit=500&titles=%D0%93%D1%80%D0%B0%D0%B4%D1%81%D0%BA%D0%B8%D0%B9,_%D0%90%D0%BB%D0%B5%D0%BA%D1%81%D0%B0%D0%BD%D0%B4%D1%80_%D0%91%D0%BE%D1%80%D0%B8%D1%81%D0%BE%D0%B2%D0%B8%D1%87'
data = loads(urlopen(url).read().decode('utf8'))
edits_data = groupby([edit['timestamp'][:10] for edit in data['query']['pages']['183903']['revisions']])

for date, edits in edits_data:
print(date, len(list(edits)))

#Всплеск правок произошел 2021-11-28 их количество 153
#В этот день умер Градский



Loading