-
Notifications
You must be signed in to change notification settings - Fork 0
/
parse.py
67 lines (59 loc) · 2.17 KB
/
parse.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import requests
from bs4 import BeautifulSoup
import vk_api
from vk_api import VkUpload
from vk_api.longpoll import VkLongPoll, VkEventType
from datetime import datetime, date, time
import time
import requests
from bs4 import BeautifulSoup
url = 'http://www.hentai-foundry.com/pictures/user/Sparrow'
headers = {'user-agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36'}
cock = {
'PHPSESSID':'6rCnUuIW0bwqvyHDgr3mLZILYZh8X1bDTY4-wIXelbxhu54f'
}
page = requests.get(url, headers = headers, cookies =cock)
soup = BeautifulSoup(page.content, 'html.parser')
source_picture = list()
for link in soup.find_all('a',{'class':'thumbLink'}):
source_picture.append(link.get('href'))
print(link.get('href'))
#cdresult = soup.find(id = id_obj).text
#http://www.hentai-foundry.com/pictures/user/Sparrow/831884/Wendys-Handy
def parser(id_obj):
url = 'https://a55.agorov.org/'
headers = {'user-agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36'}
page = requests.get(url, headers = headers)
soup = BeautifulSoup(page.content, 'html.parser')
result = soup.find(id = id_obj).text
return result
def message_vk(mes):
token = "20df76bd47c10e08c770927485ec32df51c7d8833a9df961151e59e910abfce2dc3a277c063f19e8f2b1a"
vk_session = vk_api.VkApi(token=token)
longpoll = VkLongPoll(vk_session)
vk = vk_session.get_api()
vk.messages.send(user_id=307049558, message=mes, random_id = 0)
def if_time(day, ras_day):
if datetime.today().strftime("%A") == day:
rasp = parser(ras_day)
return rasp
else:
pass
day_list = {'Sunday':'raspisSun',
'Monday':'raspisMon',
'Tuesday':'raspisTue',
'Wednesday':'raspisWed',
'Thurday':'raspisThu',
'Friday':'raspisFri',
'Saturday':'raspisSat'}
def main():
while True:
for day, day_rasp in day_list.items():
mess = if_time(day,day_rasp)
try:
message_vk(mess)
time.sleep(86400)
except:
return main()
if __name__ == "__main__":
main()