[6]
슈퍼그랑죠_ | 09:46 | 조회 673 |SLR클럽
[7]
오송연구원 | 09:38 | 조회 687 |SLR클럽
[14]
BuBu | 08:29 | 조회 2790 |보배드림
[9]
루리웹-28749131 | 09:47 | 조회 0 |루리웹
[4]
jenesuispas | 09:50 | 조회 0 |핫게kr
[9]
사팍 | 09:45 | 조회 0 |핫게kr
[5]
메스가키 소악마 | 09:43 | 조회 0 |루리웹
[15]
TotalEclipse | 09:45 | 조회 0 |핫게kr
[23]
코드명엔젤 | 09:45 | 조회 0 |핫게kr
[24]
희수™ | 09:45 | 조회 0 |핫게kr
[57]
메스가키 소악마 | 09:42 | 조회 0 |루리웹
[20]
월돚하면서루리웹하기 | 09:41 | 조회 0 |루리웹
[18]
메스가키 소악마 | 09:38 | 조회 0 |루리웹
[10]
logoxity | 09:34 | 조회 556 |SLR클럽
[5]
루리웹-8253758017 | 09:37 | 조회 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명
ㄷㄷㄷㄷㄷㄷㄷㄷㄷㄷ
의견주시면 공부해서 더 개선 하도..........록........