[4]
씪씪 | 04:51 | 조회 0 |루리웹
[8]
치르47 | 04:47 | 조회 0 |루리웹
[1]
송파배짱이 | 03:07 | 조회 707 |보배드림
[0]
流氓醫生 | 04:55 | 조회 53 |SLR클럽
[32]
| 04:40 | 조회 0 |핫게kr
[5]
치르47 | 04:42 | 조회 0 |루리웹
[13]
루리웹-222734216 | 04:39 | 조회 0 |루리웹
[4]
안면인식 장애 | 04:38 | 조회 0 |루리웹
[16]
하샤아웨이 | 04:37 | 조회 0 |루리웹
[6]
안면인식 장애 | 04:36 | 조회 0 |루리웹
[5]
노갈드 | 04:35 | 조회 0 |루리웹
[0]
D_수리수리 | 04:44 | 조회 30 |SLR클럽
[19]
근드운 | 04:24 | 조회 2076 |오늘의유머
[3]
컨셉-아바투르 | 04:33 | 조회 0 |루리웹
[5]
전귀엽기라도하죠 | 04:18 | 조회 0 |루리웹
댓글(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명
ㄷㄷㄷㄷㄷㄷㄷㄷㄷㄷ
의견주시면 공부해서 더 개선 하도..........록........