[7]
Blessed | 14:42 | 조회 560 |SLR클럽
[11]
특수스섹대 | 14:37 | 조회 971 |SLR클럽
[10]
ㄷㄷㄷ | 14:32 | 조회 804 |SLR클럽
[7]
마티맥플라이 | 14:23 | 조회 834 |SLR클럽
[9]
유진★아빠 | 14:14 | 조회 840 |SLR클럽
[11]
KAMS™ | 14:09 | 조회 1312 |SLR클럽
[33]
hsdfhxcb | 14:15 | 조회 1274 |SLR클럽
[10]
fullestlife | 14:06 | 조회 1393 |SLR클럽
[21]
교복소녀 | 13:59 | 조회 966 |SLR클럽
[14]
ㄷㄷㄷ | 13:50 | 조회 1044 |SLR클럽
[11]
Lv.7.피시기 | 13:43 | 조회 677 |SLR클럽
[16]
로보마켓 | 13:36 | 조회 960 |SLR클럽
[54]
PowerofLove | 13:31 | 조회 551 |SLR클럽
[7]
Blessed | 13:26 | 조회 868 |SLR클럽
[7]
2024 | 13:30 | 조회 1025 |SLR클럽
댓글(10)
어케하는건가요?
상단 텔레그램 링크로 조인하시면 됩니다.
아아.. 개발 말씀이신가요?
개발하는건가여 이게? 오호
ㅋㅋ 사실 개발은 아니고요 그냥 신기해서 소스보고 따라한거예요. ㅎㅎㅎㅎ
그걸 알려달라는
이거용?
#!/usr/bin/env python
# encoding=utf-8
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
import requests
import time
from bs4 import BeautifulSoup
import telegram
bot = telegram.Bot(token='11111111111111111111111111111111111111111111111')
if __name__ == '__main__':
# 제일 최신 게시글의 번호 저장
latest_num = 0
while True:
req = requests.get('http://www.slrclub.com/bbs/zboard.php?id=free')
html = req.text
soup = BeautifulSoup(html, 'html.parser')
posts = soup.find("table", {"id" : "bbs_list"})
post_num = posts.find("td", {"class" : "list_num no_att"}).text
# 제일 최신 게시글 번호와 30초 마다 크롤링한 첫번째 게시글의 번호 비교
# 비교 후 같지 않으면 최신 게시글 업데이트 된 것으로 텔레그램 봇으로 업데이트 메시지 전송
if latest_num != post_num :
latest_num = post_num
#link = 'http://www.slrclub.com/bbs/vx2.php?id=free&no='+posts.find("td", { "class" : "list_num no_att"}).text
link = 'http://www.slrclub.com/bbs/vx2.php?id=free&no='+post_num
title = posts.find("td", {"class" : "sbj"}).text
text = '<자게 업데이트>'+'
'+link
bot.sendMessage(-1111111111111, text)
# 프롬프트 로그
print(post_num)
#print(title)
print(link)
time.sleep(10) # 10초 간격으로 크롤링
print('bot 동작 중 현재 게시글 번호' + latest_num)
현 구독자 3명
ㄷㄷㄷㄷㄷㄷㄷㄷㄷㄷ
의견주시면 공부해서 더 개선 하도..........록........