Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from datetime import datetime
- import requests
- import time
- import json
- timestampAFTER=1661990400
- timestampBEFORE=1664668800
- timeNOW = datetime.now().date()
- time_r = f'{timeNOW}'.split('-')
- time_p = '[{}.{}.{}]'.format(time_r[2], time_r[1], time_r[0])
- print(time_p)
- s = requests.get('https://vimetop.ru/moders')
- j = str(s.content)
- moderlist = j.split('<script>var moders_list = ')[1]
- moderlist = moderlist.split(';</script>')[0]
- res = json.loads(moderlist)
- moders = [i for i in res.keys()]
- print(moders)
- mods = ['Alice_2', 'D_3_N_4_K', 'VerM3L', 'FuNNyman', 'TBO9I_HaBEKU', 'Flash_Gaming_', 'constellationn', 'Mr_AHrEJL', 'AlesteZ']
- preds = {}
- for moder in moders:
- s = requests.get(f'https://forum.vimeworld.com/search/?&q=Меры%20Закрыто%20принята%20отклонена&type=forums_topic&author={moder}&nodes=41&search_and_or=or&start_after={timestampAFTER}&start_before={timestampBEFORE}&updated_after={timestampAFTER}&updated_before={timestampBEFORE}&sortby=relevancy')
- t = str(s.content)
- t = t.split(' ')
- try:
- index = t.index('\\xd1\\x80\\xd0\\xb5\\xd0\\xb7\\xd1\\x83\\xd0\\xbb\\xd1\\x8c\\xd1\\x82\\xd0\\xb0\\xd1\\x82</p>\\n<div')-1 # 1 результат
- count = t[index]
- count = count.replace('\\xe2\\x80\\xaf', '')
- preds[moder] = count.replace('\\xc2\\xa0', '')
- except:
- try:
- index = t.index('\\xd1\\x80\\xd0\\xb5\\xd0\\xb7\\xd1\\x83\\xd0\\xbb\\xd1\\x8c\\xd1\\x82\\xd0\\xb0\\xd1\\x82\\xd0\\xbe\\xd0\\xb2</p>\\n<div')-1 #5 - 20 результатов
- count = t[index]
- count = count.replace('\\xe2\\x80\\xaf', '')
- preds[moder] = count.replace('\\xc2\\xa0', '')
- except:
- try:
- index = t.index('\\xd1\\x80\\xd0\\xb5\\xd0\\xb7\\xd1\\x83\\xd0\\xbb\\xd1\\x8c\\xd1\\x82\\xd0\\xb0\\xd1\\x82\\xd0\\xb0</p>\\n<div')-1 # 2, 3, 4 результата
- count = t[index]
- count = count.replace('\\xe2\\x80\\xaf', '')
- preds[moder] = count.replace('\\xc2\\xa0', '')
- except:
- pass
- print(f'Progress [{moders.index(moder)+1}/{len(moders)}]')
- for moder in preds.keys():
- preds[moder] = int(preds[moder])
- sorted_tuple = sorted(preds.items(), key = lambda x: int(x[1]))
- sorted_tuple_reversed = reversed(sorted_tuple)
- sorted_dict = dict(sorted_tuple_reversed)
- for moder in sorted_dict:
- print(f'{moder} закрыл {preds[moder]} жалоб за месяц. {time_p}')
- # link 2 - https://forum.vimeworld.com/search/?&q=Меры%20Закрыто%20принята%20отклонена&type=forums_topic&quick=1&author={moder}&nodes=9&search_and_or=or&start_after=1654041600&start_before=1656633600&updated_after=1654041600&updated_before=1656633600&sortby=relevancy
- preds = {}
- for moder in mods:
- s = requests.get(f'https://forum.vimeworld.com/search/?&q=Меры%20Закрыто%20принята%20отклонена&type=forums_topic&quick=1&author={moder}&nodes=9&search_and_or=or&start_after={timestampAFTER}&start_before={timestampBEFORE}&updated_after={timestampAFTER}&updated_before={timestampBEFORE}&sortby=relevancy')
- t = str(s.content)
- t = t.split(' ')
- try:
- index = t.index('\\xd1\\x80\\xd0\\xb5\\xd0\\xb7\\xd1\\x83\\xd0\\xbb\\xd1\\x8c\\xd1\\x82\\xd0\\xb0\\xd1\\x82</p>\\n<div')-1 # 1 результат
- count = t[index]
- preds[moder] = count.replace('\\xc2\\xa0', '')
- except:
- try:
- index = t.index('\\xd1\\x80\\xd0\\xb5\\xd0\\xb7\\xd1\\x83\\xd0\\xbb\\xd1\\x8c\\xd1\\x82\\xd0\\xb0\\xd1\\x82\\xd0\\xbe\\xd0\\xb2</p>\\n<div')-1 #5 - 20 результатов
- count = t[index]
- preds[moder] = count.replace('\\xc2\\xa0', '')
- except:
- try:
- index = t.index('\\xd1\\x80\\xd0\\xb5\\xd0\\xb7\\xd1\\x83\\xd0\\xbb\\xd1\\x8c\\xd1\\x82\\xd0\\xb0\\xd1\\x82\\xd0\\xb0</p>\\n<div')-1 # 2, 3, 4 результата
- count = t[index]
- preds[moder] = count.replace('\\xc2\\xa0', '')
- except:
- pass
- print(f'Progress [{mods.index(moder)+1}/{len(mods)}]')
- sorted_tuple = sorted(preds.items(), key = lambda x: int(x[1]))
- sorted_tuple_reversed = reversed(sorted_tuple)
- sorted_dict = dict(sorted_tuple_reversed)
- for moder in sorted_dict:
- print(f'{moder} закрыл {preds[moder]} жалоб за месяц. {time_p}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement