Skip to content

Instantly share code, notes, and snippets.

@puhitaku
Created March 1, 2021 05:28
Show Gist options
  • Save puhitaku/3b481b34d9f2f020e703142b85dab8f5 to your computer and use it in GitHub Desktop.
Save puhitaku/3b481b34d9f2f020e703142b85dab8f5 to your computer and use it in GitHub Desktop.
import time
from datetime import datetime
from email.utils import parsedate
# pip install requests beautifulsoup4
import requests
from bs4 import BeautifulSoup as BS
last = None
while True:
try:
res = requests.get('https://brain-library.com/web/book/search/result?sw=%E3%83%96%E3%83%AC%E3%83%BC%E3%83%B3%E3%82%A2%E3%83%97%E3%83%AA&res=false&brver=1')
except:
res = None
if res is None or res.status_code not in [200, 404]:
time.sleep(600)
continue
bs = BS(res.text, 'html.parser')
apps = bs.find_all('li', class_='item-01-wrap')
if last is None:
print(f'Found apps at present: {len(apps)}')
print("I'll tell you when a new app is released")
elif last < len(apps):
print('UPDATE!! {len(apps)} app(s)')
last = len(apps)
time.sleep(600)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment